-
Notifications
You must be signed in to change notification settings - Fork 22
/
build.gradle
55 lines (49 loc) · 1.74 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
apply plugin: 'java'
repositories {
mavenLocal() // TODO: use lib/ instead?
maven { url 'https://mvn.freenetproject.org' }
jcenter()
}
dependencies {
compile project(':fred')
}
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
def fredversion
task buildInfo {
try {
def gitcmd = "git"
if (DefaultNativePlatform.getCurrentOperatingSystem().isWindows()) {
gitcmd = "C:\\Program Files\\Git\\bin\\git.exe"
}
def cmd = "${gitcmd} describe --always --abbrev=4 --dirty"
def proc = cmd.execute(null, new File("fred"))
fredversion = proc.text.trim().substring(6,10)
} catch (java.io.IOException e) {
fredversion = "@unknown@"
}
}
task unzip(type: Copy) {
// since your zip is in the buildDir, I suppose you'll need deferred evaluation, hence the from(Closure) variant
from {
zipTree("install_bundle/jre-10.0.2_windows-x64_bin.zip").singleFile
}
into "install_bundle"
}
task updateSetupFile {
doLast {
def file = new File("fred_version.iss")
file.write("#define AppVersion \"0.7.5 build ${fredversion}\"\r\n")
file = new File("fred_deps.iss")
file.delete()
configurations.compile.resolvedConfiguration.resolvedArtifacts.each {
dep -> switch(dep.getName()) {
case "freenet":
file.append("Source: \"freenet.jar\"; DestDir: \"{app}\"; Flags: ignoreversion; AfterInstall: FreenetJarDoAfterInstall\r\n"); break;
case "freenet-ext":
file.append("Source: \"${dep.getFile()}\"; DestDir: \"{app}\"; DestName: \"freenet-ext.jar\"; Flags: ignoreversion; AfterInstall: FreenetJarDoAfterInstall\r\n"); break;
default:
file.append("Source: \"${dep.getFile()}\"; DestDir: \"{app}\"; Flags: ignoreversion;\r\n"); break;
}
}
}
}