Skip to content

Commit d204853

Browse files
authored
chore: separate tag for enablers (#4356)
Signed-off-by: ac892247 <a.chmelo@gmail.com>
1 parent 4098244 commit d204853

File tree

3 files changed

+70
-8
lines changed

3 files changed

+70
-8
lines changed

build.gradle

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,21 @@ apply plugin: 'net.researchgate.release'
336336

337337
ext.releaseScope = project.hasProperty('release.scope') ? project.getProperty('release.scope') : 'patch'
338338

339+
340+
341+
//1. Define properties for enablers
342+
def enablerProps = new Properties()
343+
def enablerPropsFile = new File(rootProject.projectDir, "enabler.properties")
344+
345+
//2. Load the file if it exists
346+
if (enablerPropsFile.exists()) {
347+
enablerPropsFile.withInputStream { stream ->
348+
enablerProps.load(stream)
349+
}
350+
}
351+
352+
//3. Get the version, or use the rootProject.version as a fallback
353+
def sdkVersion = enablerProps.getProperty("version")
339354
release {
340355
failOnCommitNeeded = true
341356
failOnPublishNeeded = true
@@ -346,11 +361,13 @@ release {
346361
preCommitText = '[Gradle Release plugin]'
347362
preTagCommitMessage = '[skip ci] Before tag commit'
348363
tagCommitMessage = 'Release:'
349-
tagTemplate = 'v${version}'
364+
tagTemplate = project.hasProperty('releaseEnablers') ? 'enablers-v${version}' : 'v${version}'
350365
newVersionCommitMessage = 'Create new version:'
351366
versionPropertyFile = project.hasProperty('releaseEnablers') ? 'enabler.properties' : 'gradle.properties'
352367
buildTasks = project.hasProperty('releaseEnablers') ? ['buildEnablers'] : ['buildZoweServer']
353-
368+
if(project.hasProperty('releaseEnablers')){
369+
project.setVersion(sdkVersion)
370+
}
354371
if (releaseScope == 'minor') {
355372
versionPatterns = [
356373
/[.]*\.(\d+)\.(\d+)[.]*/: { Matcher m, Project p -> m.replaceAll(".${(m[0][1] as int) + 1}.0") }

enabler.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11

2-
version=3.3.16
2+
version=3.3.17-SNAPSHOT

gradle/publish.gradle

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,10 @@ ext.servicesToPublish = [
3535
]
3636

3737
ext.zoweComponentsToPublish = ext.servicesToPublish + ext.javaLibraries
38-
ext.projectsToPublish = ext.zoweComponentsToPublish + ext.enablers
3938

4039
ext.sdksToPublish = ext.enablers + ext.javaLibraries
4140

42-
configure(subprojects.findAll { it.name in projectsToPublish }) {
41+
configure(subprojects.findAll { it.name in zoweComponentsToPublish }) {
4342
apply plugin: 'maven-publish'
4443
apply plugin: 'java'
4544

@@ -71,12 +70,58 @@ configure(subprojects.findAll { it.name in projectsToPublish }) {
7170
}
7271
}
7372

73+
//1. Define properties for enablers
74+
def enablerProps = new Properties()
75+
def enablerPropsFile = new File(rootProject.projectDir, "enabler.properties")
76+
77+
//2. Load the file if it exists
78+
if (enablerPropsFile.exists()) {
79+
enablerPropsFile.withInputStream { stream ->
80+
enablerProps.load(stream)
81+
}
82+
}
83+
84+
//3. Get the version, or use the rootProject.version as a fallback
85+
def sdkVersion = enablerProps.getProperty("version")
86+
87+
configure(subprojects.findAll { it.name in sdksToPublish }) {
88+
apply plugin: 'maven-publish'
89+
apply plugin: 'java'
90+
91+
publishing {
92+
repositories.maven {
93+
credentials {
94+
username project.hasProperty("zowe.deploy.username") ? project.getProperty("zowe.deploy.username") : ""
95+
password project.hasProperty("zowe.deploy.password") ? project.getProperty("zowe.deploy.password") : ""
96+
}
97+
if (sdkVersion.endsWith("-SNAPSHOT")) {
98+
setUrl(artifactoryPublishingMavenSnapshotRepo)
99+
} else {
100+
setUrl(artifactoryPublishingMavenRepo)
101+
}
102+
}
103+
104+
publications {
105+
mavenJava(MavenPublication) {
106+
pom {
107+
licenses {
108+
license {
109+
name = 'Eclipse Public License, v2.0'
110+
url = 'https://www.eclipse.org/legal/epl-2.0/'
111+
}
112+
}
113+
}
114+
}
115+
}
116+
}
117+
}
118+
74119
configure(subprojects.findAll { it.name in sdksToPublish }) {
75120
publishing {
76121
publications {
77122
mavenJava(MavenPublication) {
78123
groupId 'org.zowe.apiml.sdk'
79-
version rootProject.version
124+
version sdkVersion
80125
artifactId "${project.name}"
81126

82127
from components.java
@@ -95,11 +140,11 @@ configure(subprojects.findAll { it.name in sdksToPublish }) {
95140
tasks.withType(Jar) {
96141
manifest {
97142
attributes "Specification-Title": project.name
98-
attributes "Specification-Version": rootProject.version
143+
attributes "Specification-Version": sdkVersion
99144
attributes "Specification-Vendor": "Zowe org"
100145

101146
attributes "Implementation-Title": project.name
102-
attributes "Implementation-Version": rootProject.version
147+
attributes "Implementation-Version": sdkVersion
103148
attributes "Implementation-Vendor": "Zowe org"
104149
attributes "Implementation-Vendor-Id": "org.zowe.apiml.sdk"
105150
}

0 commit comments

Comments
 (0)