Skip to content

Commit

Permalink
Merge pull request #99 from ballerina-platform/make-lang-version-opti…
Browse files Browse the repository at this point in the history
…onal
  • Loading branch information
ThisaruGuruge authored Sep 19, 2023
2 parents f912320 + 2d19377 commit 1815b23
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class BallerinaPlugin implements Plugin<Project> {
println("[Warning] skipping downloading jBallerinaTools dependency: project uses docker to build the module")
} else {
if (ballerinaExtension.langVersion == null) {
jbalTools("org.ballerinalang:jballerina-tools:${project.ballerinaLangVersion}") {
jbalTools("org.ballerinalang:jballerina-tools:${ballerinaExtension.langVersion}") {
transitive = false
}
} else {
Expand Down Expand Up @@ -181,7 +181,7 @@ class BallerinaPlugin implements Plugin<Project> {
project.configurations.ballerinaStdLibs.resolvedConfiguration.resolvedArtifacts.each { artifact ->
def artifactExtractedPath = "${project.buildDir}/extracted-stdlibs/" + artifact.name + '-zip'
project.copy {
def ballerinaDist = "build/jballerina-tools-${project.ballerinaLangVersion}"
def ballerinaDist = "build/jballerina-tools-${ballerinaExtension.langVersion}"
into ballerinaDist
into('repo/bala') {
from "${artifactExtractedPath}/bala"
Expand Down Expand Up @@ -268,7 +268,6 @@ class BallerinaPlugin implements Plugin<Project> {

inputs.dir projectDirectory
doLast {
String distributionBinPath = project.projectDir.absolutePath + "/build/jballerina-tools-${ballerinaExtension.langVersion}/bin"
String packageName = ballerinaExtension.module
String balaVersion
if (ballerinaExtension.customTomlVersion == null) {
Expand Down Expand Up @@ -301,10 +300,13 @@ class BallerinaPlugin implements Plugin<Project> {
} else {
commandLine 'sh', '-c', "docker run --rm --net=host --user \$(id -u):\$(id -g) -v $project.projectDir/..:/home -v $project.projectDir:/home/ballerina ballerina/ballerina:$ballerinaDockerTag $balJavaDebugParam bal pack --target-dir ${balBuildTarget} ${debugParams}"
}
} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'cmd', '/c', "$balJavaDebugParam $distributionBinPath/bal.bat pack --target-dir ${balBuildTarget} --offline ${debugParams} && exit %%ERRORLEVEL%%"
} else {
commandLine 'sh', '-c', "$balJavaDebugParam $distributionBinPath/bal pack --target-dir ${balBuildTarget} --offline ${debugParams}"
String distributionBinPath = project.projectDir.absolutePath + "/build/jballerina-tools-${ballerinaExtension.langVersion}/bin"
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'cmd', '/c', "$balJavaDebugParam $distributionBinPath/bal.bat pack --target-dir ${balBuildTarget} --offline ${debugParams} && exit %%ERRORLEVEL%%"
} else {
commandLine 'sh', '-c', "$balJavaDebugParam $distributionBinPath/bal pack --target-dir ${balBuildTarget} --offline ${debugParams}"
}
}
}
// Run tests
Expand Down Expand Up @@ -389,7 +391,6 @@ class BallerinaPlugin implements Plugin<Project> {
finalizedBy(project.commitTomlFiles)
doLast {
if (needSeparateTest) {
String distributionBinPath = project.projectDir.absolutePath + "/build/jballerina-tools-${ballerinaExtension.langVersion}/bin"
project.exec {
workingDir project.projectDir
environment 'JAVA_OPTS', '-DBALLERINA_DEV_COMPILE_BALLERINA_ORG=true'
Expand All @@ -399,10 +400,13 @@ class BallerinaPlugin implements Plugin<Project> {
} else {
commandLine 'sh', '-c', "docker run --rm --net=host --user \$(id -u):\$(id -g) -v ${project.projectDir}/..:/home -v $project.projectDir:/home/ballerina ballerina/ballerina:$ballerinaDockerTag bal test ${graalvmFlag} ${testCoverageParams} ${groupParams} ${disableGroups} ${debugParams}"
}
} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'cmd', '/c', "${balJavaDebugParam} ${distributionBinPath}/bal.bat test --offline ${graalvmFlag} ${testCoverageParams} ${groupParams} ${disableGroups} ${debugParams} && exit %%ERRORLEVEL%%"
} else {
commandLine 'sh', '-c', "${balJavaDebugParam} ${distributionBinPath}/bal test --offline ${graalvmFlag} ${testCoverageParams} ${groupParams} ${disableGroups} ${debugParams}"
String distributionBinPath = project.projectDir.absolutePath + "/build/jballerina-tools-${ballerinaExtension.langVersion}/bin"
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'cmd', '/c', "${balJavaDebugParam} ${distributionBinPath}/bal.bat test --offline ${graalvmFlag} ${testCoverageParams} ${groupParams} ${disableGroups} ${debugParams} && exit %%ERRORLEVEL%%"
} else {
commandLine 'sh', '-c', "${balJavaDebugParam} ${distributionBinPath}/bal test --offline ${graalvmFlag} ${testCoverageParams} ${groupParams} ${disableGroups} ${debugParams}"
}
}
}
}
Expand Down

0 comments on commit 1815b23

Please sign in to comment.