-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
216 lines (179 loc) · 6.88 KB
/
build.gradle.kts
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
import java.lang.Boolean
import java.util.Locale
import org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry
import org.gradle.plugins.ide.eclipse.model.AccessRule
val releaseVersion = "0.12"
val developmentVersion = "1.0"
version = if( Boolean.getBoolean( "release" ) ) releaseVersion else developmentVersion
// check required Java version
when( JavaVersion.current() ) {
JavaVersion.VERSION_19 -> true
else -> throw RuntimeException( "Java 19 required (running ${System.getProperty( "java.version" )})" )
}
// use Java 19 source/target compatibility
val javaCompatibility = 19
val osName = System.getProperty( "os.name" ).lowercase( Locale.ENGLISH )
val osArch = System.getProperty( "os.arch" )
val isWindows = osName.startsWith( "windows" )
val isMac = osName.startsWith( "mac" )
val isLinux = osName.startsWith( "linux" )
// log version, Gradle and Java versions
println()
println( "-------------------------------------------------------------------------------" )
println( "BookDesigner Version: ${version}" )
println( "Gradle ${gradle.gradleVersion} at ${gradle.gradleHomeDir}" )
println( "Java ${System.getProperty( "java.version" )} ${System.getProperty( "java.vendor" )}" )
println()
plugins {
java
application
id( "org.openjfx.javafxplugin" ) version "0.0.13"
id( "org.beryx.runtime" ) version "1.13.0"
eclipse
kotlin("jvm")
}
repositories {
mavenCentral()
}
javafx {
version = "19.0.2.1"
modules = listOf( "javafx.controls", "javafx.swing", "javafx.web" )
}
dependencies {
implementation( "org.fxmisc.richtext:richtextfx:0.11.0" )
implementation( "com.miglayout:miglayout-javafx:11.0" )
implementation( "de.jensd:fontawesomefx-fontawesome:4.7.0-9.1.2" )
implementation( "org.controlsfx:controlsfx:11.1.2" )
implementation( "fr.brouillard.oss:cssfx:11.5.1" )
implementation( "org.apache.commons:commons-lang3:3.12.0" )
implementation( "com.esotericsoftware.yamlbeans:yamlbeans:1.15" )
val flexmarkVersion = "0.64.0"
implementation( "com.vladsch.flexmark:flexmark:${flexmarkVersion}" )
implementation( "com.vladsch.flexmark:flexmark-ext-abbreviation:${flexmarkVersion}" )
implementation( "com.vladsch.flexmark:flexmark-ext-anchorlink:${flexmarkVersion}" )
implementation( "com.vladsch.flexmark:flexmark-ext-aside:${flexmarkVersion}" )
implementation( "com.vladsch.flexmark:flexmark-ext-autolink:${flexmarkVersion}" )
implementation( "com.vladsch.flexmark:flexmark-ext-definition:${flexmarkVersion}" )
implementation( "com.vladsch.flexmark:flexmark-ext-footnotes:${flexmarkVersion}" )
implementation( "com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:${flexmarkVersion}" )
implementation( "com.vladsch.flexmark:flexmark-ext-gfm-tasklist:${flexmarkVersion}" )
implementation( "com.vladsch.flexmark:flexmark-ext-tables:${flexmarkVersion}" )
implementation( "com.vladsch.flexmark:flexmark-ext-toc:${flexmarkVersion}" )
implementation( "com.vladsch.flexmark:flexmark-ext-wikilink:${flexmarkVersion}" )
implementation( "com.vladsch.flexmark:flexmark-ext-yaml-front-matter:${flexmarkVersion}" )
val commonmarkVersion = "0.21.0"
implementation( "org.commonmark:commonmark:${commonmarkVersion}" )
implementation( "org.commonmark:commonmark-ext-autolink:${commonmarkVersion}" )
implementation( "org.commonmark:commonmark-ext-gfm-strikethrough:${commonmarkVersion}" )
implementation( "org.commonmark:commonmark-ext-gfm-tables:${commonmarkVersion}" )
implementation( "org.commonmark:commonmark-ext-heading-anchor:${commonmarkVersion}" )
implementation( "org.commonmark:commonmark-ext-ins:${commonmarkVersion}" )
implementation( "org.commonmark:commonmark-ext-yaml-front-matter:${commonmarkVersion}" )
val languagetoolVersion = "6.0"
implementation( "org.languagetool:language-all:${languagetoolVersion}" )
implementation( "com.google.guava:guava:31.1-jre" ) // required for languagetool, which would otherwise use '31.1-android'
// used to parse SML
implementation("com.github.h0tk3y.betterParse:better-parse:0.4.4")
testImplementation( "junit:junit:4.13.2" )
implementation(kotlin("stdlib-jdk8"))
}
tasks.compileJava {
options.release.set( javaCompatibility )
}
application {
mainClass.set( "at.crowdware.bookdesigner.BookDesignerApp" )
}
distributions {
getByName( "main" ) {
contents {
from( "LICENSE", "README.md", "CHANGES.md" )
into( "images" ) {
from( "images" )
}
}
}
}
runtime {
options.set( listOf( "--strip-debug", "--compress", "2", "--no-header-files", "--no-man-pages" ) )
modules.set( listOf(
"java.prefs",
"java.desktop",
"jdk.jfr",
"java.xml",
"jdk.unsupported",
"java.net.http",
"jdk.jsobject",
"jdk.xml.dom",
"java.logging",
// this requires that Gradle is running on a JDK that includes JavaFX
// e.g. BellSoft Liberica JDK (package 'Full JDK') or Azul Zulu JDK (package 'JDK FX')
"javafx.controls",
"javafx.swing", // for addons
"javafx.web",
) )
jpackage {
imageName = "BookDesigner $version"
val icon = if( isWindows ) "images/bookdesigner.ico"
else if( isMac ) "images/bookdesigner.icns"
else "images/bookdesigner-256.png"
imageOptions = listOf( "--icon", icon )
if( isWindows )
skipInstaller = true
else if( isMac )
installerType = "dmg"
else if( isLinux )
skipInstaller = true
}
}
tasks {
assembleDist {
dependsOn( "distAppZip" )
dependsOn( "distMacDmg" )
}
register<Zip>( "distAppZip" ) {
group = "distribution"
dependsOn( "jpackage" )
onlyIf { isWindows || isLinux }
archiveFileName.set( "bookdesigner-$version-${ if( isWindows ) "win" else "linux" }.zip" )
from( layout.buildDirectory.dir( "jpackage" ) ) {
// exclude JavaFX jars because JavaFX is included in JRE built by jlink
exclude( "**/app/javafx-*.jar" )
}
}
register<Copy>( "distMacDmg" ) {
group = "distribution"
dependsOn( "jpackage" )
onlyIf { isMac }
from( layout.buildDirectory.file( "jpackage/bookdesigner-$version.dmg" ) )
rename( "bookdesigner-$version.dmg", "bookdesigner-$version-mac-$osArch.dmg" )
into( layout.buildDirectory.dir( "distributions" ) )
}
// disable some tasks
distTar { onlyIf{ false } }
distZip { onlyIf{ false } }
}
//---- eclipse ----------------------------------------------------------------
eclipse {
classpath {
file {
whenMerged.add( object: Action<org.gradle.plugins.ide.eclipse.model.Classpath> {
override fun execute( classpath: org.gradle.plugins.ide.eclipse.model.Classpath ) {
val jre = classpath.entries.find {
it is AbstractClasspathEntry &&
it.path.contains("org.eclipse.jdt.launching.JRE_CONTAINER")
} as AbstractClasspathEntry
// make JavaFX API accessible in Eclipse project
// (when refreshing Gradle project in buildship)
jre.accessRules.add(AccessRule("accessible", "javafx/**"))
jre.accessRules.add(AccessRule("accessible", "com/sun/javafx/**"))
// remove trailing slash from jre path
if (jre.path.endsWith("/"))
jre.path = jre.path.substring(0, jre.path.length - 1)
}
} )
}
}
}
kotlin {
jvmToolchain(19)
}