From 51cbf6de6ae82da2fd824bde21f97062fc3c621d Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Fri, 16 Feb 2024 14:18:47 +0530 Subject: [PATCH 1/3] Update docker command for clean task --- src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy b/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy index 387d85d..d414e05 100644 --- a/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy +++ b/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy @@ -414,9 +414,8 @@ class BallerinaPlugin implements Plugin { def deleteUsingDocker = """ docker run -u root \ -v $parentDirectory:/home/ballerina/$parentDirectory.name \ - -v $projectDirectory:/home/ballerina/$parentDirectory.name/$projectDirectory.name \ ballerina/ballerina:$ballerinaDockerTag \ - /bin/sh -c "cd $parentDirectory.name/$projectDirectory.name && rm -rf build target" + /bin/sh -c "cd /home/ballerina/$parentDirectory.name && rm -rf build target ballerina/build ballerina/target" """ if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'cmd', '/c', "$deleteUsingDocker" From 4451c212af29195aed87f40874f85b7e9b04ca83 Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Fri, 16 Feb 2024 15:33:00 +0530 Subject: [PATCH 2/3] Add seperate docker commands to remove 'build' and 'target' directories --- .../io/ballerina/plugin/BallerinaPlugin.groovy | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy b/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy index d414e05..622bd41 100644 --- a/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy +++ b/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy @@ -411,11 +411,21 @@ class BallerinaPlugin implements Plugin { doLast { if (buildOnDocker) { project.exec { - def deleteUsingDocker = """ + def deleteBuildUsingDocker = """ docker run -u root \ - -v $parentDirectory:/home/ballerina/$parentDirectory.name \ - ballerina/ballerina:$ballerinaDockerTag \ - /bin/sh -c "cd /home/ballerina/$parentDirectory.name && rm -rf build target ballerina/build ballerina/target" + -v $parentDirectory:/home/ballerina/$parentDirectory.name \ + ballerina/ballerina:$ballerinaDockerTag \ + /bin/sh -c "find /home/ballerina/$parentDirectory.name -type d -name 'build' -exec rm -rf {} +" + """ + def deleteTargetUsingDocker = """ + docker run -u root \ + -v $parentDirectory:/home/ballerina/$parentDirectory.name \ + ballerina/ballerina:$ballerinaDockerTag \ + /bin/sh -c "find /home/ballerina/$parentDirectory.name -type d -name 'target' -exec rm -rf {} +" + """ + def deleteUsingDocker = """ + $deleteBuildUsingDocker + $deleteTargetUsingDocker """ if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'cmd', '/c', "$deleteUsingDocker" From 35a758c5759fee37d3d4a537ac8be81d80c55cde Mon Sep 17 00:00:00 2001 From: Nuvindu Date: Fri, 16 Feb 2024 17:03:58 +0530 Subject: [PATCH 3/3] Combine docker clean commands --- .../io/ballerina/plugin/BallerinaPlugin.groovy | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy b/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy index 622bd41..49f7070 100644 --- a/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy +++ b/src/main/groovy/io/ballerina/plugin/BallerinaPlugin.groovy @@ -411,21 +411,11 @@ class BallerinaPlugin implements Plugin { doLast { if (buildOnDocker) { project.exec { - def deleteBuildUsingDocker = """ - docker run -u root \ - -v $parentDirectory:/home/ballerina/$parentDirectory.name \ - ballerina/ballerina:$ballerinaDockerTag \ - /bin/sh -c "find /home/ballerina/$parentDirectory.name -type d -name 'build' -exec rm -rf {} +" - """ - def deleteTargetUsingDocker = """ + def deleteUsingDocker = """ docker run -u root \ -v $parentDirectory:/home/ballerina/$parentDirectory.name \ ballerina/ballerina:$ballerinaDockerTag \ - /bin/sh -c "find /home/ballerina/$parentDirectory.name -type d -name 'target' -exec rm -rf {} +" - """ - def deleteUsingDocker = """ - $deleteBuildUsingDocker - $deleteTargetUsingDocker + /bin/sh -c "find /home/ballerina/$parentDirectory.name -type d -name 'build' -exec rm -rf {} + && find /home/ballerina/$parentDirectory.name -type d -name 'target' -exec rm -rf {} +" """ if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'cmd', '/c', "$deleteUsingDocker"