-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.gradle
More file actions
165 lines (140 loc) · 4.97 KB
/
build.gradle
File metadata and controls
165 lines (140 loc) · 4.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
///////////////////////////////////////////////////////////////////////////////
//
// Build Script for building JavaPOS Device Controls Library
//
// Author: denis.kuniss@dieboldnixdorf.com (2021)
//
///////////////////////////////////////////////////////////////////////////////
plugins {
id 'java-library'
id 'signing'
id 'eclipse'
id 'maven-publish'
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
id 'project-report'
// id 'jacoco'
}
ext.githubProjectUrl = 'https://github.com/JavaPOSWorkingGroup/javapos-controls'
wrapper {
gradleVersion = '8.14.3'
}
///////////////////////////////////////////////////////////////////////////////
// Names and Versions
///////////////////////////////////////////////////////////////////////////////
def artifactName = 'javapos-controls'
group = 'org.javapos'
def uposVersion = '1.15' // if this version is going to be changed, first add "-SNAPSHOT" to the
// 'version' variable below for publishing to MavenCentral's Snapshot repo first as test
version="${uposVersion}.1-SNAPSHOT" // the last part after dot is the build/release version
// dependency versions
def javaposContractsVersion = "$uposVersion.0"
///////////////////////////////////////////////////////////////////////////////
// Build Dependencies
///////////////////////////////////////////////////////////////////////////////
repositories {
mavenCentral()
// for resolving snapshots from MavenCentral if not going for a real release
if (!isReleaseRun())
{
logger.warn("WARN: Seems not to be a release, so Maven Central snapshot repository is fetched!");
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
}
if (!System.getenv('CI')) {
mavenLocal()
}
}
// this gets true if Github Actions workflow defines github.event.action project variable at Gradle command line
// AND the event action is 'released' (see release.yml)
def boolean isReleaseRun() {
return System.getenv('CI') && null != findProperty('github.event.action') && 'released'.equals(getProperty('github.event.action'))
}
// check whether github.event.action is defined on CI
if (System.getenv('CI') && null == findProperty('github.event.action'))
logger.warn('WARN: Project property github.event.action is not defined, so, it cannot be determined whether a release is ongoing.')
dependencies {
api "org.javapos:javapos-contracts:$javaposContractsVersion"
api "org.javapos:javapos-config-loader:2.2.0"
testImplementation "junit:junit:4.+"
testImplementation "org.hamcrest:hamcrest-library:1.3"
}
///////////////////////////////////////////////////////////////////////////////
// Project Configurations
///////////////////////////////////////////////////////////////////////////////
def javaposManifest = java.manifest {
attributes('Specification-Title': 'UnifiedPOS Standard',
'Specification-Vendor': 'UnifiedPOS Committee',
'Specification-Version': uposVersion,
'Implementation-Title': 'JavaPOS Device Controls',
'Implementation-Vendor': 'github.com/JavaPOSWorkingGroup',
'Implementation-Version': version)
}
///////////////////////////////////////////////////////////////////////////////
// Build Tasks
///////////////////////////////////////////////////////////////////////////////
java {
withSourcesJar()
withJavadocJar()
sourceCompatibility = JavaVersion.VERSION_1_8
}
jar {
archiveBaseName = artifactName
manifest = javaposManifest
from ('CHANGELOG.md') {
into 'META-INF'
}
}
sourcesJar {
manifest = javaposManifest
from ('CHANGELOG.md') {
into 'META-INF'
}
}
///////////////////////////////////////////////////////////////////////////////
// Artifact Upload
///////////////////////////////////////////////////////////////////////////////
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from(components.java)
pom {
name = artifactName
description = 'JavaPOS Device Controls Library'
url = githubProjectUrl
licenses {
license {
name = 'Common Public License (CPL) -- V1.0'
url = 'https://www.eclipse.org/legal/cpl-v10.html'
}
}
developers {
developer {
id = 'javapos'
name = 'JavaPOS Working Group'
email = 'builder@javapos.org'
}
}
scm {
connection = "scm:${githubProjectUrl}.git"
developerConnection = "scm:git:${githubProjectUrl}.git"
url = "${githubProjectUrl}.git"
}
}
}
}
}
signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}