Skip to content

Commit ecf39c0

Browse files
Merge pull request #227 from ballerina-platform/task
Make the Ballerina project tooling friendly
2 parents 7a4d192 + 35dcc5d commit ecf39c0

File tree

6 files changed

+27
-10
lines changed

6 files changed

+27
-10
lines changed

.github/workflows/publish-release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444
publishUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
4545
publishPAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
4646
run: |
47+
git config user.name ${{ secrets.BALLERINA_BOT_USERNAME }}
48+
git config user.email ${{ secrets.BALLERINA_BOT_EMAIL }}
4749
./gradlew release -Prelease.useAutomaticVersion=true
4850
./gradlew -Pversion=${VERSION} publish -x test -PpublishToCentral=true
4951
- name: GitHub Release and Release Sync PR

ballerina/Ballerina.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
22
org = "ballerina"
33
name = "regex"
4-
version = "@toml.version@"
4+
version = "1.0.0"
55
distribution = "slbeta3"

ballerina/Dependencies.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dependencies-toml-version = "2"
99
[[package]]
1010
org = "ballerina"
1111
name = "jballerina.java"
12-
version = "0.9.0"
12+
version = "0.0.0"
1313
transitive = false
1414
modules = [
1515
{org = "ballerina", packageName = "jballerina.java", moduleName = "jballerina.java"}
@@ -18,7 +18,7 @@ modules = [
1818
[[package]]
1919
org = "ballerina"
2020
name = "test"
21-
version = "0.8.0"
21+
version = "0.0.0"
2222
scope = "testOnly"
2323
transitive = false
2424
dependencies = [

ballerina/build.gradle

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
* limitations under the License.
1515
*
1616
*/
17+
18+
import org.apache.tools.ant.taskdefs.condition.Os
19+
1720
buildscript {
1821
repositories {
1922
maven {
@@ -34,8 +37,8 @@ description = 'Ballerina - Regex Ballerina Generator'
3437
def packageName = "regex"
3538
def packageOrg = "ballerina"
3639
def tomlVersion = stripBallerinaExtensionVersion("${project.version}")
37-
def ballerinaConfigFile = new File("$project.projectDir/Ballerina.toml")
38-
def originalConfig = ballerinaConfigFile.text
40+
def ballerinaTomlFilePlaceHolder = new File("${project.rootDir}/build-config/resources/Ballerina.toml")
41+
def ballerinaTomlFile = new File("$project.projectDir/Ballerina.toml")
3942

4043
def stripBallerinaExtensionVersion(String extVersion) {
4144
if (extVersion.matches(project.ext.timestampedVersionRegex)) {
@@ -62,15 +65,22 @@ ballerina {
6265

6366
task updateTomlFiles {
6467
doLast {
65-
def newConfig = ballerinaConfigFile.text.replace("@project.version@", project.version)
68+
def newConfig = ballerinaTomlFilePlaceHolder.text.replace("@project.version@", project.version)
6669
newConfig = newConfig.replace("@toml.version@", tomlVersion)
67-
ballerinaConfigFile.text = newConfig
70+
ballerinaTomlFile.text = newConfig
6871
}
6972
}
7073

71-
task revertTomlFiles {
74+
task commitTomlFiles {
7275
doLast {
73-
ballerinaConfigFile.text = originalConfig
76+
project.exec {
77+
ignoreExitValue true
78+
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
79+
commandLine 'cmd', '/c', "git commit Ballerina.toml Dependencies.toml -m \"[Automated] Update the native jar versions\""
80+
} else {
81+
commandLine 'sh', '-c', "git commit Ballerina.toml Dependencies.toml -m '[Automated] Update the native jar versions'"
82+
}
83+
}
7484
}
7585
}
7686

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[package]
2+
org = "ballerina"
3+
name = "regex"
4+
version = "@toml.version@"
5+
distribution = "slbeta3"

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version=1.0.0-SNAPSHOT
44

55
ballerinaLangVersion=2.0.0-beta.3-20210910-102000-f3eade9f
66

7-
ballerinaGradlePluginVersion=0.10.3
7+
ballerinaGradlePluginVersion=0.11.0
88
testngVersion=6.14.3
99
slf4jVersion=1.7.30
1010
githubSpotbugsVersion=4.0.5

0 commit comments

Comments
 (0)