From 5a519a6ca30be4d3011633359aacbbe19fb858bd Mon Sep 17 00:00:00 2001 From: ayeshLK Date: Fri, 28 Jun 2024 16:31:43 +0530 Subject: [PATCH] Add functionality to log docker-build errors --- src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy b/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy index ae2e4ae..e9a31d6 100644 --- a/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy +++ b/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy @@ -267,6 +267,7 @@ class BallerinaPlugin implements Plugin { 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 = """ @@ -279,17 +280,22 @@ class BallerinaPlugin implements Plugin { """ 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)