-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbuild.gradle
135 lines (115 loc) · 4.24 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
* This file is part of Impact Installer.
*
* Copyright (C) 2019 ImpactDevelopment and contributors
*
* See the CONTRIBUTORS.md file for a list of copyright holders
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
import proguard.gradle.ProGuardTask
buildscript {
dependencies {
classpath 'net.sf.proguard:proguard-gradle:6.1.0'
classpath 'net.sf.proguard:proguard-base:6.1.0'
}
}
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '4.0.4'
id 'edu.sc.seis.launch4j' version '2.4.6'
}
ext {
id = 'ImpactInstaller'
group 'io.github.ImpactDevelopment'
version '0.9.5'
description = 'Impact Installer'
mainClassName = 'io.github.ImpactDevelopment.installer.Installer'
targetCompatibility = sourceCompatibility = JavaVersion.VERSION_1_8
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation 'com.beust:jcommander:1.72'
implementation 'commons-io:commons-io:2.6'
implementation 'org.apache.commons:commons-compress:1.18'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.atlassian.commonmark:commonmark:0.12.1'
implementation 'org.bouncycastle:bcprov-jdk15on:1.60'
implementation 'org.bouncycastle:bcpg-jdk15on:1.60'
implementation 'com.google.code.findbugs:jsr305:3.0.2'
implementation 'com.brsanthu:google-analytics-java:2.0.0'
}
jar {
destinationDir = temporaryDir
manifest {
attributes(
'Main-Class': project.mainClassName,
'Implementation-Title': name,
'Implementation-Version': version
)
}
}
shadowJar {
classifier = 'unoptimised'
}
task('optimize', type: ProGuardTask, dependsOn: shadowJar) {
injars tasks.shadowJar.outputs.files
outjars "${buildDir}/libs/${project.tasks.jar.archiveName}"
libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
configuration "${projectDir}/proguard.conf"
verbose()
dontwarn()
keepattributes 'Signature'
keepattributes '*Annotation*'
optimizationpasses 9
dontusemixedcaseclassnames()
keepdirectories 'icons'
keep 'class io.github.ImpactDevelopment.installer.** { *; }'
keep 'class com.beust.jcommander.** { *; }'
keep 'class com.brsanthu.** { *; }'
[
// keep only the RSA stuff from bouncycastle
'org.bouncycastle.jcajce.provider.asymmetric.rsa.PSSSignatureSpi$SHA512withRSA',
'org.bouncycastle.jcajce.provider.asymmetric.rsa.DigestSignatureSpi$SHA512',
'org.bouncycastle.jcajce.provider.asymmetric.rsa.DigestSignatureSpi$SHA256',
'org.bouncycastle.jcajce.provider.asymmetric.rsa.KeyFactorySpi',
'org.bouncycastle.jcajce.provider.asymmetric.RSA$Mappings'
].each {
keep "class ${it}"
}
}
createExe {
dependsOn 'optimize'
mainClassName = project.mainClassName
copyConfigurable = project.tasks.optimize.outputs.files
jar = "lib/${project.tasks.jar.archiveName}"
outfile = tasks.jar.archiveName - ".jar" + ".exe"
icon = "${projectDir}/exe/Icon.ico"
manifest = "${projectDir}/exe/manifest.xml"
companyName = 'ImpactDevelopment'
copyright = 'Copyright (C) Impact Developers'
fileDescription = project.description
version = textVersion = project.version
headerType = 'gui'
stayAlive = true // This should make stdout work, but it doesn't
// Default to Mojang's JRE and fallback to JRE version search
bundledJrePath = '%PROGRAMFILES(X86)%/Minecraft Launcher/runtime/jre-x64'
bundledJreAsFallback = false
jreMinVersion = project.targetCompatibility
}
build.finalizedBy(createExe)