Skip to content

Commit

Permalink
Improve gradle scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
niveathika committed Jul 9, 2024
1 parent bde4c7b commit 00cb854
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
secrets: inherit
with:
repo-name: module-ballerinax-googleapis.gmail
additional-test-flags: -Pgroups=mock
additional-test-flags: -x :googleapis.gmail-examples:test -Pgroups=mock
2 changes: 1 addition & 1 deletion .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
secrets: inherit
with:
repo-name: module-ballerinax-googleapis.gmail
additional-build-flags: "-x :googleapis.gmail-examples:build"
additional-test-flags: "-x :googleapis.gmail-examples:test"
2 changes: 1 addition & 1 deletion .github/workflows/dev-stage-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
secrets: inherit
with:
environment: ${{ github.event.inputs.environment }}
additional-publish-flags: "-x :googleapis.gmail-examples:build"
additional-publish-flags: "-x :googleapis.gmail-examples:test"
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
uses: ballerina-platform/ballerina-library/.github/workflows/pr-build-connector-template.yml@main
secrets: inherit
with:
additional-test-flags: -Pgroups=mock
additional-test-flags: -x :googleapis.gmail-examples:test -Pgroups=mock
4 changes: 1 addition & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ jobs:
with:
package-name: googleapis.gmail
package-org: ballerinax
additional-build-flags: "-x :googleapis.gmail-examples:build"
additional-release-flags: "-x :googleapis.gmail-examples:build"
additional-publish-flags: "-x :googleapis.gmail-examples:build"
additional-publish-flags: "-x :googleapis.gmail-examples:test"
2 changes: 1 addition & 1 deletion .github/workflows/trivy-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Trivy
on:
workflow_dispatch:
schedule:
- cron: "30 20 * * *"
- cron: "30 20 * * *"

jobs:
call_workflow:
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
*/

plugins {
id 'com.github.spotbugs-base'
id 'com.github.johnrengelman.shadow'
id 'de.undercouch.download'
id 'net.researchgate.release'
}

Expand Down Expand Up @@ -60,6 +57,9 @@ allprojects {

def moduleVersion = project.version.replace("-SNAPSHOT", "")

task clean {
}

task build {
dependsOn(':googleapis.gmail-ballerina:build')
dependsOn(':googleapis.gmail-examples:build')
Expand Down
27 changes: 8 additions & 19 deletions examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,7 @@

import org.apache.tools.ant.taskdefs.condition.Os

apply plugin: 'java'

def graalvmFlag = ""

task testExamples {
if (project.hasProperty("balGraalVMTest")) {
graalvmFlag = "--graalvm"
}
task test {
doLast {
try {
exec {
Expand All @@ -38,18 +31,16 @@ task testExamples {
}
}
} catch (Exception e) {
println("Example Build failed: " + e.message)
println("Example Run failed: " + e.message)
throw e
}
}
}

task buildExamples {
task build {
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(":gmail-examples:test")) {
buildExamples.enabled = false
} else {
testExamples.enabled = false
if (graph.hasTask(":sap.s4hana.googleapis.gmail-examples:test")) {
build.enabled = false
}
}
doLast {
Expand All @@ -58,7 +49,7 @@ task buildExamples {
workingDir project.projectDir
println("Working dir: ${workingDir}")
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'sh', "/c", "chmod +x ./build.s && ./build.sh build && exit %%ERRORLEVEL%%"
commandLine 'sh', "/c", "chmod +x ./build.sh && ./build.sh build && exit %%ERRORLEVEL%%"
} else {
commandLine 'sh', "-c", "chmod +x ./build.sh && ./build.sh build"
}
Expand All @@ -70,7 +61,5 @@ task buildExamples {
}
}

buildExamples.dependsOn ":googleapis.gmail-ballerina:build"
testExamples.dependsOn ":googleapis.gmail-ballerina:build"
test.dependsOn testExamples
build.dependsOn buildExamples
test.dependsOn ":googleapis.gmail-ballerina:build"
build.dependsOn ":googleapis.gmail-ballerina:build"
3 changes: 0 additions & 3 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

pluginManagement {
plugins {
id "com.github.spotbugs-base" version "${spotbugsPluginVersion}"
id "com.github.johnrengelman.shadow" version "${shadowJarPluginVersion}"
id "de.undercouch.download" version "${downloadPluginVersion}"
id "net.researchgate.release" version "${releasePluginVersion}"
id "io.ballerina.plugin" version "${ballerinaGradlePluginVersion}"
}
Expand Down

0 comments on commit 00cb854

Please sign in to comment.