Skip to content

Commit 14a17e6

Browse files
committed
feat: refactored dist build code.
1 parent c6667b3 commit 14a17e6

File tree

5 files changed

+46
-78
lines changed

5 files changed

+46
-78
lines changed

buildSrc/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
plugins {
22
id 'groovy-gradle-plugin'
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
}
8+
9+
dependencies {
10+
implementation("com.gradleup.shadow:com.gradleup.shadow.gradle.plugin:9.1.0")
311
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
plugins {
2+
id 'java-conv'
3+
id 'com.gradleup.shadow'
4+
id 'application'
5+
}
6+
7+
shadowJar {
8+
archiveBaseName.set('gumtree')
9+
archiveClassifier.set('')
10+
archiveVersion.set('')
11+
mergeServiceFiles()
12+
mergeServiceFiles {
13+
path = 'META-INF/annotations'
14+
}
15+
}
16+
17+
application {
18+
mainClass = 'com.github.gumtreediff.client.Run'
19+
applicationName = 'gumtree'
20+
}
21+
22+
tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
23+
archiveBaseName.set('gumtree')
24+
}
25+
26+
shadowDistZip.enabled = true
27+
distTar.enabled = false
28+
distZip.enabled = false
29+
startScripts.enabled = false
30+
shadowDistTar.enabled = false
31+
32+
jar.enabled = false
33+
34+
build.finalizedBy installShadowDist

dist-minimal/build.gradle

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
plugins {
2-
id 'java-conv'
3-
id 'com.gradleup.shadow' version '9.0.0-rc3'
4-
id 'application'
2+
id 'java-dist-conv'
53
}
64

75
description = 'GumTree minimal distribution.'
@@ -16,39 +14,4 @@ dependencies {
1614
implementation project(':gen.xml')
1715
implementation project(':gen.yaml')
1816
implementation project(':gen.json')
19-
}
20-
21-
shadowJar {
22-
archiveBaseName.set('gumtree')
23-
archiveClassifier.set('')
24-
archiveVersion.set('')
25-
mergeServiceFiles()
26-
mergeServiceFiles {
27-
path = 'META-INF/annotations'
28-
}
29-
}
30-
31-
distributions {
32-
shadow {
33-
distributionBaseName = 'gumtree'
34-
}
35-
}
36-
37-
application {
38-
mainClass = 'com.github.gumtreediff.client.Run'
39-
applicationName = 'gumtree'
40-
}
41-
42-
tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
43-
archiveBaseName.set('gumtree')
44-
}
45-
46-
shadowDistZip.enabled = true
47-
distTar.enabled = false
48-
distZip.enabled = false
49-
startScripts.enabled = false
50-
shadowDistTar.enabled = false
51-
52-
jar.enabled = false
53-
54-
build.finalizedBy installShadowDist
17+
}

dist/build.gradle

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
plugins {
2-
id 'java-conv'
3-
id 'com.gradleup.shadow' version '9.0.0-rc3'
4-
id 'application'
2+
id 'java-dist-conv'
53
}
64

75
description = 'GumTree distribution.'
@@ -19,38 +17,3 @@ dependencies {
1917
implementation project(':gen.xml')
2018
implementation project(':gen.yaml')
2119
}
22-
23-
shadowJar {
24-
archiveBaseName.set('gumtree')
25-
archiveClassifier.set('')
26-
archiveVersion.set('')
27-
mergeServiceFiles()
28-
mergeServiceFiles {
29-
path = 'META-INF/annotations'
30-
}
31-
}
32-
33-
distributions {
34-
shadow {
35-
distributionBaseName = 'gumtree'
36-
}
37-
}
38-
39-
application {
40-
mainClass = 'com.github.gumtreediff.client.Run'
41-
applicationName = 'gumtree'
42-
}
43-
44-
tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
45-
archiveBaseName.set('gumtree')
46-
}
47-
48-
shadowDistZip.enabled = true
49-
distTar.enabled = false
50-
distZip.enabled = false
51-
startScripts.enabled = false
52-
shadowDistTar.enabled = false
53-
54-
jar.enabled = false
55-
56-
build.finalizedBy installShadowDist

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ENV TZ=GMT
2828
ENV LANG=C.UTF-8
2929

3030
# Copy gumtree distribution from build-stage.
31-
COPY --from=build-stage /opt/gumtree/dist/build/install/gumtree/ /opt/gumtree
31+
COPY --from=build-stage /opt/gumtree/dist/build/install/dist-shadow/ /opt/gumtree
3232
# Copy srcml package from build-stage.
3333
COPY --from=build-stage /*.deb /opt
3434

0 commit comments

Comments
 (0)