Skip to content

Commit

Permalink
Merge pull request #149 from ayeshLK/main
Browse files Browse the repository at this point in the history
Add functionality to log docker-build errors
  • Loading branch information
ayeshLK authored Jun 28, 2024
2 parents 3ddc6cb + 5a519a6 commit 04c9b80
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ class BallerinaPlugin implements Plugin<Project> {
project.exec {
workingDir project.projectDir
environment 'JAVA_OPTS', '-DBALLERINA_DEV_COMPILE_BALLERINA_ORG=true'
def buildResult = new ByteArrayOutputStream()
if (buildOnDocker) {
createDockerEnvFile("$project.projectDir/docker.env")
def balPackWithDocker = """
Expand All @@ -279,17 +280,22 @@ class BallerinaPlugin implements Plugin<Project> {
"""
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'cmd', '/c', "$balPackWithDocker && exit %%ERRORLEVEL%%"
standardOutput = buildResult
} else {
commandLine 'sh', '-c', "$balPackWithDocker"
standardOutput = buildResult
}
} else {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'cmd', '/c', "$distributionBinPath/bal.bat pack --target-dir ${balBuildTarget} --offline && exit %%ERRORLEVEL%%"
standardOutput = buildResult
} else {
commandLine 'sh', '-c', "$distributionBinPath/bal pack --target-dir ${balBuildTarget} --offline"
standardOutput = buildResult
}
}
}
println "Command output: ${buildResult.toString()}"

def balaPath = "$project.projectDir/${balBuildTarget}/bala"
def balaDir = new File(balaPath)
Expand Down

0 comments on commit 04c9b80

Please sign in to comment.