-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
90 lines (77 loc) · 2.62 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
import org.ajoberstar.grgit.*
plugins {
id 'org.beryx.runtime' version '1.2.0'
id "com.github.johnrengelman.shadow" version "4.0.3"
id 'org.openjfx.javafxplugin' version '0.0.5'
id "org.ajoberstar.grgit" version "3.0.0"
}
repositories {
mavenCentral()
}
sourceCompatibility = 11
targetCompatibility = 11
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
ext {
cloneDir = "$buildDir/clone"
imageDirPath = "$buildDir/pacman"
imageZipPath = "$buildDir/image-zip/pacman.zip"
}
dependencies {
compile 'com.github.almasb:fxgl:0.5.4'
}
application {
// mainClassName = 'com.almasb.fxglgames.pacman.PacmanApp'
mainClassName = 'org.beryx.runtime.launcher.Launcher'
applicationName = 'pacman'
}
// This task clones the AlmasB/FXGLGames project into cloneDir. The commitId is configured in gradle.properties.
task cloneSourceProject {
outputs.dir(cloneDir)
inputs.property("commitId", commitId)
doLast {
project.logger.info("Deleting ${cloneDir}...")
delete(cloneDir)
project.logger.info("Cloning AlmasB/FXGLGames...")
def grgit = Grgit.clone(dir: cloneDir, uri: "https://github.com/AlmasB/FXGLGames.git")
project.logger.debug("grgit: $grgit")
project.logger.info("Resolving commit $commitId")
def commitObj = grgit.resolve.toCommit(commitId)
project.logger.debug("commitObj: $commitObj")
grgit.reset(commit: commitObj, mode: 'soft')
def launcherDir = file("$cloneDir/Pacman/src/main/java/org/beryx/runtime/launcher")
launcherDir.mkdirs()
copy {
from 'launcher/Launcher.java'
into launcherDir
}
}
}
sourceSets.main.java.srcDirs = ["$cloneDir/Pacman/src/main/java"]
sourceSets.main.resources.srcDirs = ["$cloneDir/Pacman/src/main/resources"]
compileJava.dependsOn 'cloneSourceProject'
tasks.jar.enabled = true
javafx {
modules = [ 'javafx.controls', 'javafx.fxml' ]
}
runtime {
imageDir = file(imageDirPath)
imageZip = file(imageZipPath)
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
modules = ['java.desktop', 'java.xml', 'jdk.unsupported', 'java.scripting']
jpackage {
// jpackageHome = '/usr/lib/jvm/jdk14'
if(org.gradle.internal.os.OperatingSystem.current().windows) {
installerType = 'msi'
// imageOptions = ['--win-console']
installerOptions = ['--win-per-user-install', '--win-dir-chooser', '--win-menu', '--win-shortcut']
}
}
}
tasks.runtime.doLast {
copy {
from('src/main/resources')
into("$buildDir/image/bin")
}
}