|
1 |
| -// To publish first run ./gradlew installDist |
2 |
| -// then copy to wurstpack folder |
| 1 | +// Apply shadow plugin (assumes this is applied from main build.gradle with buildscript setup) |
| 2 | +apply plugin: 'com.github.johnrengelman.shadow' |
3 | 3 |
|
4 |
| -jar { |
5 |
| - version = null |
| 4 | +// Shadow JAR config using externally defined mainClassName |
| 5 | +shadowJar { |
| 6 | + archiveBaseName.set('wurstscript') |
| 7 | + archiveClassifier.set('') |
| 8 | + archiveVersion.set('') |
6 | 9 | manifest {
|
7 |
| - attributes( |
8 |
| - 'Class-Path': configurations.runtimeClasspath.collect { it.getName() }.join(' '), |
9 |
| - 'Main-Class': mainClassName |
10 |
| - ) |
| 10 | + attributes 'Main-Class': mainClassName |
11 | 11 | }
|
12 | 12 | }
|
13 | 13 |
|
| 14 | +// Get reference to fat JAR for reuse |
| 15 | +def fatJar = shadowJar.archiveFile.map { it.asFile } |
| 16 | + |
| 17 | +// Install fat jar into ~/.wurst |
14 | 18 | task make_for_userdir(type: Copy) {
|
15 |
| - from 'build/install/wurstscript/lib' |
| 19 | + from fatJar |
16 | 20 | into "${System.properties['user.home']}/.wurst/"
|
17 | 21 | }
|
| 22 | +make_for_userdir.dependsOn(shadowJar) |
18 | 23 |
|
19 |
| -make_for_userdir.dependsOn(installDist) |
20 |
| - |
| 24 | +// Copy fat jar into Wurstpack bundle dir |
21 | 25 | task make_for_wurstpack(type: Copy) {
|
22 |
| - from 'build/install/wurstscript/lib' |
| 26 | + from fatJar |
23 | 27 | into '../Wurstpack/wurstscript/'
|
24 | 28 | }
|
25 |
| -make_for_wurstpack.dependsOn(installDist) |
26 |
| - |
| 29 | +make_for_wurstpack.dependsOn(shadowJar) |
27 | 30 |
|
| 31 | +// Full zip of Wurstpack (includes wrappers, .exe, etc.) |
28 | 32 | task create_zip_wurstpack_complete(type: Zip) {
|
29 | 33 | from '../Wurstpack'
|
30 | 34 | archiveFileName.set('wurstpack_complete.zip')
|
31 | 35 | }
|
32 | 36 | create_zip_wurstpack_complete.dependsOn(make_for_wurstpack)
|
33 | 37 |
|
| 38 | +// Compiler-only zip (just the fat jar and related files) |
34 | 39 | task create_zip_wurstpack_compiler(type: Zip) {
|
35 | 40 | from '../Wurstpack/wurstscript/'
|
36 | 41 | archiveFileName.set('wurstpack_compiler.zip')
|
37 | 42 | }
|
38 | 43 | create_zip_wurstpack_compiler.dependsOn(make_for_wurstpack)
|
39 | 44 |
|
40 |
| - |
41 |
| - |
| 45 | +// Bundle downloads for GitHub release |
42 | 46 | task create_zips {
|
43 | 47 | doLast {
|
44 | 48 | mkdir("../downloads/")
|
| 49 | + |
45 | 50 | copy {
|
46 |
| - from 'build/distributions/' |
47 |
| - into '../downloads/' |
48 |
| - } |
49 |
| - copy { |
50 |
| - from 'build/install/wurstscript/lib/wurstscript.jar' |
| 51 | + from fatJar |
51 | 52 | into '../downloads/'
|
52 | 53 | }
|
| 54 | + |
53 | 55 | copy {
|
54 | 56 | from '../Wurstpack'
|
55 | 57 | into '../downloads/Wurstpack/'
|
56 | 58 | }
|
| 59 | + |
57 | 60 | copy {
|
58 | 61 | from '../WurstSetup/build/libs/WurstSetup.jar'
|
59 | 62 | into '../downloads/'
|
60 | 63 | }
|
61 |
| - // create checksums |
62 |
| - mkdir("../Checksums/bin") |
63 | 64 |
|
| 65 | + // Generate checksums |
| 66 | + mkdir("../Checksums/bin") |
64 | 67 | javaexec {
|
65 | 68 | classpath = sourceSets.main.runtimeClasspath
|
66 | 69 | main = "de.peeeq.wurstio.Checksums"
|
67 |
| - args = ["../downloads/Wurstpack/", |
68 |
| - "../downloads/wurstpack.md5"] |
| 70 | + args = [ |
| 71 | + "../downloads/Wurstpack/", |
| 72 | + "../downloads/wurstpack.md5" |
| 73 | + ] |
69 | 74 | }
|
70 | 75 | }
|
71 | 76 | }
|
72 |
| -create_zips.dependsOn(installDist) |
| 77 | +create_zips.dependsOn(shadowJar) |
73 | 78 | create_zips.dependsOn(create_zip_wurstpack_complete)
|
74 | 79 | create_zips.dependsOn(create_zip_wurstpack_compiler)
|
75 | 80 |
|
| 81 | +// Hotdoc generation |
76 | 82 | task generate_hotdoc {
|
77 | 83 | doLast {
|
78 | 84 | copy {
|
79 |
| - from("/src/main/resources/") |
80 |
| - into("/build/classes/main/") |
| 85 | + from("src/main/resources/") |
| 86 | + into("build/classes/main/") |
81 | 87 | }
|
82 | 88 | javaexec {
|
83 | 89 | classpath = sourceSets.main.runtimeClasspath
|
84 | 90 | main = "de.peeeq.wurstio.Main"
|
85 |
| - args = ["--hotdoc", |
| 91 | + args = [ |
| 92 | + "--hotdoc", |
86 | 93 | "./build/deps/",
|
87 |
| - "../downloads/hotdoc"] |
| 94 | + "../downloads/hotdoc" |
| 95 | + ] |
88 | 96 | }
|
89 | 97 | }
|
90 | 98 | }
|
|
0 commit comments