From af6aefc86235d07cb422eab6b4fa4a0e1fdda346 Mon Sep 17 00:00:00 2001 From: ayeshLK Date: Wed, 7 Aug 2024 14:24:06 +0530 Subject: [PATCH] Restructure plugin code --- .../io/ballerina/plugin/BallerinaPlugin.groovy | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy b/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy index 825a2c5..9e64b79 100644 --- a/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy +++ b/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy @@ -295,7 +295,7 @@ class BallerinaPlugin implements Plugin { } // Pack bala first - def result = project.exec { + project.exec { workingDir project.projectDir environment 'JAVA_OPTS', '-DBALLERINA_DEV_COMPILE_BALLERINA_ORG=true' if (ballerinaExtension.isConnector) { @@ -312,17 +312,9 @@ class BallerinaPlugin implements Plugin { } } } - result.wait(50000) - - def balaPath = "$project.projectDir/${balBuildTarget}/bala" - def balaDir = new File(balaPath) - if (!balaDir.exists()) { - throw new FileNotFoundException( - "[Error] 'bala' directory does not exist: ${balaPath}, hence exiting") - } // extract bala file to balaArtifact - balaDir.eachFileMatch(~/.*.bala/) { balaFile -> + new File("$project.projectDir/${balBuildTarget}/bala").eachFileMatch(~/.*.bala/) { balaFile -> project.copy { from project.zipTree(balaFile) into new File("$balaArtifact/bala/${packageOrg}/${packageName}/${balaVersion}/${platform}")