Skip to content

Commit 2a9c472

Browse files
Merge pull request #19 from ballerina-platform/danesh-pr
Re-order Build Tasks to Publish to the Ballerina Central
2 parents 4e2f559 + 125fea3 commit 2a9c472

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def moduleVersion = project.version.replace("-SNAPSHOT", "")
6666

6767
release {
6868
failOnPublishNeeded = false
69-
69+
failOnSnapshotDependencies = true
7070
buildTasks = ['build']
7171
versionPropertyFile = 'gradle.properties'
7272
tagTemplate = 'v$version'

regex-ballerina/build.gradle

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,12 @@ task initializeVariables {
8888
}
8989

9090
gradle.taskGraph.whenReady { graph ->
91-
if (graph.hasTask(":${packageName}-ballerina:build") || graph.hasTask(":${packageName}-ballerina:publish")) {
91+
if (graph.hasTask(":${packageName}-ballerina:build") ||
92+
graph.hasTask(":${packageName}-ballerina:publish") ||
93+
graph.hasTask(":${packageName}-ballerina:publishToMavenLocal")) {
9294
ballerinaTest.enabled = false
95+
} else {
96+
ballerinaTest.enabled = true
9397
}
9498

9599
if (graph.hasTask(":${packageName}-ballerina:test")) {
@@ -180,6 +184,9 @@ task ballerinaBuild {
180184

181185
task ballerinaPublish {
182186
doLast {
187+
if (project.version.endsWith('-SNAPSHOT')) {
188+
return
189+
}
183190
if (ballerinaCentralAccessToken != null) {
184191
println("Publishing to the ballerina central...")
185192
exec {
@@ -188,9 +195,11 @@ task ballerinaPublish {
188195
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
189196
commandLine 'cmd', '/c', "$distributionBinPath/bal.bat push ${packageName} && exit %%ERRORLEVEL%%"
190197
} else {
191-
commandLine 'sh', '-c', "$distributionBinPath/bal push ${packageName}"
198+
commandLine 'sh', '-c', "$distributionBinPath/bal push"
192199
}
193200
}
201+
} else {
202+
throw new InvalidUserDataException("Central Access Token is not present")
194203
}
195204
}
196205
}
@@ -228,4 +237,8 @@ updateTomlVersions.dependsOn unpackJballerinaTools
228237
build.dependsOn ballerinaBuild
229238

230239
ballerinaPublish.dependsOn ballerinaBuild
240+
ballerinaPublish.finalizedBy revertTomlFile
241+
ballerinaPublish.dependsOn initializeVariables
242+
ballerinaPublish.dependsOn updateTomlVersions
243+
ballerinaPublish.dependsOn ":${packageName}-native:build"
231244
publish.dependsOn ballerinaPublish

0 commit comments

Comments
 (0)