Skip to content

Commit

Permalink
Add logs for std-out and err-out streams
Browse files Browse the repository at this point in the history
  • Loading branch information
ayeshLK committed Jul 1, 2024
1 parent 36d02cb commit af6e226
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ class BallerinaPlugin implements Plugin<Project> {
} else {
packageOrg = ballerinaExtension.packageOrganization
}

def outStream = new ByteArrayOutputStream()
def errStream = new ByteArrayOutputStream()
// Pack bala first
project.exec {
workingDir project.projectDir
Expand All @@ -279,8 +282,10 @@ class BallerinaPlugin implements Plugin<Project> {
"""
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
println "Executing command on windows: ${balPackWithDocker}"
standardOutput = outStream
errorOutput = errStream
// commandLine 'cmd', '/c', "$balPackWithDocker && exit %%ERRORLEVEL%%"
commandLine 'cmd', '/c', "cd $parentDirectory.name/$projectDirectory.name && bal pack --target-dir ${balBuildTarget}"
commandLine 'cmd', '/c', "cd $projectDirectory.name && bal pack --target-dir ${balBuildTarget}"
} else {
commandLine 'sh', '-c', "$balPackWithDocker"
}
Expand All @@ -292,6 +297,7 @@ class BallerinaPlugin implements Plugin<Project> {
}
}
}
println("StdOut: ${outStream.toString()} \n ErrOut: ${errStream.toString()}\n")

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

0 comments on commit af6e226

Please sign in to comment.