Skip to content

Commit 533a8c5

Browse files
committed
never not fighting gradle
1 parent d4030e4 commit 533a8c5

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

agent-csa-bundle/build.gradle.kts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ dependencies {
4747
tasks {
4848
// This exists purely to get the extension jar into our build dir
4949
val copyCsaJar by registering(Jar::class) {
50+
onlyIf("csa is only built from gitlab"){
51+
System.getenv("GITLAB_CI") != null
52+
}
5053
archiveFileName.set("oss-agent-mtagent-extension-deployment.jar")
5154
doFirst {
5255
from(zipTree(csaReleases.singleFile))
@@ -55,13 +58,19 @@ tasks {
5558

5659
// Extract and rename extension classes
5760
val extractExtensionClasses by registering(Copy::class) {
61+
onlyIf("csa is only built from gitlab"){
62+
System.getenv("GITLAB_CI") != null
63+
}
5864
dependsOn(copyCsaJar)
5965
from(zipTree(copyCsaJar.get().archiveFile))
6066
into("build/ext-exploded")
6167
}
6268

6369
// Rename class to classdata
6470
val renameClasstoClassdata by registering(Copy::class) {
71+
onlyIf("csa is only built from gitlab"){
72+
System.getenv("GITLAB_CI") != null
73+
}
6574
dependsOn(extractExtensionClasses)
6675
from("build/ext-exploded/com/cisco/mtagent/adaptors/")
6776
into("build/ext-exploded/com/cisco/mtagent/adaptors/")
@@ -72,12 +81,18 @@ tasks {
7281

7382
// Copy service file so path on disk matches path in jar
7483
val copyServiceFile by registering(Copy::class) {
84+
onlyIf("csa is only built from gitlab"){
85+
System.getenv("GITLAB_CI") != null
86+
}
7587
dependsOn(extractExtensionClasses)
7688
from("build/ext-exploded/META-INF/services/")
7789
into("build/ext-exploded/inst/META-INF/services/")
7890
}
7991

8092
val shadowCsaClasses by registering(ShadowJar::class) {
93+
onlyIf("csa is only built from gitlab"){
94+
System.getenv("GITLAB_CI") != null
95+
}
8196
archiveFileName.set("shadow-csa-classes.jar")
8297
dependsOn(copyServiceFile, renameClasstoClassdata, splunkAgent)
8398

@@ -108,7 +123,9 @@ tasks {
108123
}
109124

110125
jar {
111-
enabled = System.getenv("GITLAB_CI") != null
126+
onlyIf("csa is only built from gitlab"){
127+
System.getenv("GITLAB_CI") != null
128+
}
112129
dependsOn(shadowCsaClasses)
113130
from(zipTree(shadowCsaClasses.get().archiveFile.get()))
114131
from(copyCsaJar.get().archiveFile.get())

0 commit comments

Comments
 (0)