diff options
Diffstat (limited to 'build.gradle')
| -rw-r--r-- | build.gradle | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/build.gradle b/build.gradle index f267b6a7..ca61c1e2 100644 --- a/build.gradle +++ b/build.gradle | |||
| @@ -139,28 +139,11 @@ shadowJar { | |||
| 139 | exclude 'META-INF/maven/**' | 139 | exclude 'META-INF/maven/**' |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | // Now make the deployable application jar with extra classes stripped out using | ||
| 143 | // ProGuard (don't use JavaExec because we want to redirect output to a file). | ||
| 144 | task('thinJar', dependsOn: shadowJar) << { | ||
| 145 | javaexec { | ||
| 146 | main 'proguard.ProGuard' | ||
| 147 | classpath configurations.proGuard | ||
| 148 | |||
| 149 | args '@proguard-build.conf', '-injars', shadowJar.archivePath, | ||
| 150 | // well this works... | ||
| 151 | '-outjars', file("build/libs/$project.name-${version}-thin.jar") | ||
| 152 | |||
| 153 | // Cut down on console spam | ||
| 154 | standardOutput new File(buildDir, 'proguard.log').newOutputStream(); | ||
| 155 | } | ||
| 156 | println 'Saved ProGuard output to build/proguard.log' | ||
| 157 | } | ||
| 158 | |||
| 159 | // Create a library jar, containing only the deobfuscation code, for use at | 142 | // Create a library jar, containing only the deobfuscation code, for use at |
| 160 | // runtime. This will be deployed to Maven Local with a POM, and can be uploaded | 143 | // runtime. This will be deployed to Maven Local with a POM, and can be uploaded |
| 161 | // to a remote server manually (for now anyway). | 144 | // to a remote server manually (for now anyway). |
| 162 | task('libJar', type: Jar, dependsOn: classes) { | 145 | task('libJar', type: Jar, dependsOn: classes) { |
| 163 | baseName = 'enigma-lib' | 146 | classifier = 'lib' |
| 164 | 147 | ||
| 165 | from("$buildDir/classes/main") { | 148 | from("$buildDir/classes/main") { |
| 166 | exclude 'cuchaz/enigma/gui/**' | 149 | exclude 'cuchaz/enigma/gui/**' |
| @@ -172,26 +155,13 @@ task('libJar', type: Jar, dependsOn: classes) { | |||
| 172 | exclude 'cuchaz/enigma/ConvertMain*.class' | 155 | exclude 'cuchaz/enigma/ConvertMain*.class' |
| 173 | } | 156 | } |
| 174 | } | 157 | } |
| 175 | artifacts.archives libJar { name 'enigma-lib' } | ||
| 176 | 158 | ||
| 177 | artifacts { | 159 | artifacts { |
| 178 | archives shadowJar | 160 | archives shadowJar |
| 179 | } | 161 | archives libJar |
| 180 | |||
| 181 | // Here we need a bit of hackery to remove the default Maven deployment and just | ||
| 182 | // deploy enigma-lib. Works, but not ideal :( | ||
| 183 | configurations.archives { | ||
| 184 | artifacts.iterator().with { | ||
| 185 | while (it.hasNext()) { | ||
| 186 | if (it.next().name == 'enigma') { | ||
| 187 | it.remove() | ||
| 188 | } | ||
| 189 | } | ||
| 190 | } | ||
| 191 | } | 162 | } |
| 192 | 163 | ||
| 193 | // And finally, make the build generate / install the jars. | 164 | // And finally, make the build generate / install the jars. |
| 194 | assemble.dependsOn thinJar | ||
| 195 | build.dependsOn install | 165 | build.dependsOn install |
| 196 | 166 | ||
| 197 | uploadArchives { | 167 | uploadArchives { |