buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'org.owasp:dependency-check-gradle:9.0.1'
classpath "com.github.spotbugs.snom:spotbugs-gradle-plugin:5.2.4"
}
}
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.1.0'
id 'com.palantir.git-version' version '3.0.0'
id "com.github.spotbugs" version "5.2.4"
}
spotbugs {
excludeFilter.set(
file( "${projectDir}/bug-filter.xml" )
)
}
apply plugin: 'org.owasp.dependencycheck'
repositories {
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://nexus.bedatadriven.com/content/groups/public' }
maven {
url "https://css4j.github.io/maven"
mavenContent {
releasesOnly()
}
content {
includeGroup 'com.github.css4j'
includeGroup 'io.sf.carte'
includeGroup 'io.sf.jclf'
}
}
}
String[] os = ['win', 'mac', 'linux']
if (project.hasProperty( 'targetOs' )) {
if ('windows' == targetOs) {
os = ["win"]
} else if ('macos' == targetOs) {
os = ["mac"]
} else {
os = [targetOs]
}
}
def moduleSecurity = [
'--add-opens=javafx.graphics/javafx.scene=ALL-UNNAMED',
'--add-opens=javafx.controls/javafx.scene.control=ALL-UNNAMED',
'--add-opens=javafx.controls/javafx.scene.control.skin=ALL-UNNAMED',
'--add-opens=javafx.graphics/javafx.scene.text=ALL-UNNAMED',
'--add-opens=javafx.graphics/com.sun.javafx.css=ALL-UNNAMED',
'--add-opens=javafx.graphics/com.sun.javafx.text=ALL-UNNAMED',
'--add-exports=javafx.base/com.sun.javafx.event=ALL-UNNAMED',
'--add-exports=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED',
'--add-exports=javafx.graphics/com.sun.javafx.geom=ALL-UNNAMED',
'--add-exports=javafx.graphics/com.sun.javafx.text=ALL-UNNAMED',
'--add-exports=javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED',
'--add-exports=javafx.graphics/com.sun.javafx.scene.text=ALL-UNNAMED',
'--add-exports=javafx.graphics/com.sun.javafx.scene.traversal=ALL-UNNAMED',
]
java {
sourceCompatibility = 21
targetCompatibility = 21
}
javafx {
version = '21'
modules = ['javafx.base', 'javafx.controls', 'javafx.graphics', 'javafx.swing']
configuration = 'compileOnly'
}
dependencies {
def v_junit = '5.10.1'
def v_flexmark = '0.64.8'
def v_jackson = '2.15.3'
def v_echosvg = '1.0.1'
def v_picocli = '4.7.5'
implementation 'org.controlsfx:controlsfx:11.2.0'
implementation 'org.fxmisc.richtext:richtextfx:0.11.2'
implementation 'org.fxmisc.flowless:flowless:0.7.2'
implementation 'org.fxmisc.wellbehaved:wellbehavedfx:0.3.3'
implementation 'com.miglayout:miglayout-javafx:11.2'
implementation 'com.dlsc.preferencesfx:preferencesfx-core:11.16.0'
implementation 'com.panemu:tiwulfx-dock:0.2'
implementation "com.vladsch.flexmark:flexmark:${v_flexmark}"
implementation "com.vladsch.flexmark:flexmark-ext-definition:${v_flexmark}"
implementation "com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:${v_flexmark}"
implementation "com.vladsch.flexmark:flexmark-ext-superscript:${v_flexmark}"
implementation "com.vladsch.flexmark:flexmark-ext-tables:${v_flexmark}"
implementation "com.vladsch.flexmark:flexmark-ext-typographic:${v_flexmark}"
implementation 'org.yaml:snakeyaml:2.2'
implementation "com.fasterxml.jackson.core:jackson-core:${v_jackson}"
implementation "com.fasterxml.jackson.core:jackson-databind:${v_jackson}"
implementation "com.fasterxml.jackson.core:jackson-annotations:${v_jackson}"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${v_jackson}"
implementation 'org.jsoup:jsoup:1.17.1'
implementation 'org.xhtmlrenderer:flying-saucer-core:9.3.1'
implementation 'org.apache.commons:commons-compress:1.25.0'
implementation 'org.codehaus.plexus:plexus-utils:4.0.0'
implementation 'org.renjin:renjin-script-engine:3.5-beta76'
implementation 'org.renjin.cran:rjson:0.2.15-renjin-21'
implementation "io.sf.carte:echosvg-awt-util:${v_echosvg}"
implementation "io.sf.carte:echosvg-bridge:${v_echosvg}"
implementation "io.sf.carte:echosvg-css:${v_echosvg}"
implementation "io.sf.carte:echosvg-dom:${v_echosvg}"
implementation "io.sf.carte:echosvg-ext:${v_echosvg}"
implementation "io.sf.carte:echosvg-gvt:${v_echosvg}"
implementation "io.sf.carte:echosvg-parser:${v_echosvg}"
implementation "io.sf.carte:echosvg-svg-dom:${v_echosvg}"
implementation "io.sf.carte:echosvg-svggen:${v_echosvg}"
implementation "io.sf.carte:echosvg-transcoder:${v_echosvg}"
implementation "io.sf.carte:echosvg-util:${v_echosvg}"
implementation "io.sf.carte:echosvg-xml:${v_echosvg}"
implementation 'org.ahocorasick:ahocorasick:0.6.3'
implementation 'org.apache.commons:commons-lang3:3.14.0'
implementation 'com.github.albfernandez:juniversalchardet:2.4.0'
implementation 'jakarta.validation:jakarta.validation-api:3.0.2'
implementation 'org.greenrobot:eventbus-java:3.3.1'
implementation "info.picocli:picocli:${v_picocli}"
annotationProcessor "info.picocli:picocli-codegen:${v_picocli}"
implementation fileTree( include: ['**/*.jar'], dir: 'libs' )
def fx = ['controls', 'graphics', 'fxml', 'swing']
fx.each { fxitem ->
os.each { ositem ->
runtimeOnly "org.openjfx:javafx-${fxitem}:${javafx.version}:${ositem}"
}
}
testImplementation 'org.testfx:testfx-junit5:4.0.17'
testImplementation "org.junit.jupiter:junit-jupiter-api:${v_junit}"
testImplementation "org.junit.jupiter:junit-jupiter-params:${v_junit}"
testImplementation 'org.assertj:assertj-core:3.24.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}
configurations {
all*.exclude group: 'org.mozilla', module: 'rhino'
}
sourceSets {
main {
java {
srcDirs 'src/main'
}
}
test {
java {
srcDirs 'src/test'
}
}
}
final resourceDir = sourceSets.main.resources.srcDirs[0]
final Properties config = new Properties()
final File configFile = file( "${resourceDir}/bootstrap.properties" )
final FileInputStream configStream = new FileInputStream( configFile )
config.load( configStream )
configStream.close()
final String applicationName = config.get( 'application.title' ).toString().toLowerCase()
final String applicationPackage = "com.${applicationName}"
final String applicationClass = "${applicationPackage}.Launcher"
compileJava {
options.compilerArgs += [
"-Xlint:unchecked",
"-Xlint:deprecation",
"-Aproject=${applicationPackage}/${applicationName}"
]
}
application {
mainClass.set( applicationClass )
applicationDefaultJvmArgs = moduleSecurity
}
version = gitVersion()
final File p = new File( "${resourceDir}/com/${applicationName}/app.properties" )
p.write( "application.version=${version}" )
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
doFirst {
manifest {
attributes 'Main-Class': applicationClass
}
}
from {
(configurations.runtimeClasspath.findAll { !it.path.endsWith( ".pom" ) })
.collect { it.isDirectory() ? it : zipTree( it ) }
}
archiveFileName = "${applicationName}.jar"
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
}
distributions {
main {
distributionBaseName.set( applicationName )
contents {
from { ['LICENSE.md', 'README.md'] }
into( 'images' ) {
from { 'images' }
}
}
}
}
test {
useJUnitPlatform()
doFirst { jvmArgs += moduleSecurity }
testLogging { exceptionFormat = 'full' }
}
tasks.withType( JavaCompile ).configureEach {
options.compilerArgs += "--enable-preview"
}
tasks.withType( JavaExec ).configureEach {
jvmArgs += "--enable-preview"
}
tasks.withType( Test ).configureEach {
jvmArgs += "--enable-preview"
}