xpipe/app/build.gradle
2024-01-22 09:49:12 +00:00

211 lines
8.1 KiB
Groovy

plugins {
id 'application'
id "org.moditect.gradleplugin" version "1.0.0-rc3"
}
repositories {
mavenCentral()
}
configurations {
dep
}
apply from: "$rootDir/gradle/gradle_scripts/java.gradle"
apply from: "$rootDir/gradle/gradle_scripts/javafx.gradle"
apply from: "$projectDir/gradle_scripts/richtextfx.gradle"
apply from: "$rootDir/gradle/gradle_scripts/commons.gradle"
apply from: "$rootDir/gradle/gradle_scripts/prettytime.gradle"
apply from: "$projectDir/gradle_scripts/sentry.gradle"
apply from: "$rootDir/gradle/gradle_scripts/lombok.gradle"
apply from: "$projectDir/gradle_scripts/github-api.gradle"
apply from: "$projectDir/gradle_scripts/flexmark.gradle"
apply from: "$rootDir/gradle/gradle_scripts/picocli.gradle"
apply from: "$rootDir/gradle/gradle_scripts/versioncompare.gradle"
apply from: "$rootDir/gradle/gradle_scripts/markdowngenerator.gradle"
configurations {
implementation.extendsFrom(dep)
}
dependencies {
compileOnly project(':api')
implementation project(':core')
implementation project(':beacon')
compileOnly 'org.hamcrest:hamcrest:2.2'
compileOnly 'org.junit.jupiter:junit-jupiter-api:5.9.3'
compileOnly 'org.junit.jupiter:junit-jupiter-params:5.9.3'
implementation 'net.java.dev.jna:jna-jpms:5.13.0'
implementation 'net.java.dev.jna:jna-platform-jpms:5.13.0'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: "2.15.2"
implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-parameter-names', version: "2.15.2"
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: "2.15.2"
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jdk8', version: "2.15.2"
implementation group: 'org.kordamp.ikonli', name: 'ikonli-material2-pack', version: "12.2.0"
implementation group: 'org.kordamp.ikonli', name: 'ikonli-materialdesign2-pack', version: "12.2.0"
implementation group: 'org.kordamp.ikonli', name: 'ikonli-javafx', version: "12.2.0"
implementation group: 'org.kordamp.ikonli', name: 'ikonli-material-pack', version: "12.2.0"
implementation group: 'org.kordamp.ikonli', name: 'ikonli-feather-pack', version: "12.2.0"
implementation (name: 'preferencesfx-core-11.15.0')
implementation (group: 'com.dlsc.formsfx', name: 'formsfx-core', version: '11.6.0') {
exclude group: 'org.openjfx', module: 'javafx-controls'
exclude group: 'org.openjfx', module: 'javafx-fxml'
}
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.7'
implementation 'io.xpipe:modulefs:0.1.4'
implementation 'com.jfoenix:jfoenix:9.0.10'
implementation 'org.controlsfx:controlsfx:11.1.2'
implementation 'net.synedra:validatorfx:0.4.2'
implementation ('io.github.mkpaz:atlantafx-base:2.0.1') {
exclude group: 'org.openjfx', module: 'javafx-base'
exclude group: 'org.openjfx', module: 'javafx-controls'
}
implementation name: 'jSystemThemeDetector-3.8'
implementation group: 'com.github.oshi', name: 'oshi-core-java11', version: '6.4.2'
implementation 'org.jetbrains:annotations:24.0.1'
implementation ('de.jangassen:jfa:1.2.0') {
exclude group: 'net.java.dev.jna', module: 'jna'
}
}
apply from: "$rootDir/gradle/gradle_scripts/junit.gradle"
sourceSets {
main {
output.resourcesDir("${project.layout.buildDirectory.get()}/classes/java/main")
}
}
dependencies {
testImplementation project(':api')
testImplementation project(':core')
}
project.allExtensions.forEach((Project p) -> {
dependencies {
testCompileOnly p
}
})
project.ext {
jvmRunArgs = [
"--add-exports", "javafx.graphics/com.sun.javafx.scene=com.jfoenix",
"--add-exports", "javafx.graphics/com.sun.javafx.stage=com.jfoenix",
"--add-exports", "javafx.base/com.sun.javafx.binding=com.jfoenix",
"--add-exports", "javafx.base/com.sun.javafx.event=com.jfoenix",
"--add-exports", "javafx.controls/com.sun.javafx.scene.control=com.jfoenix",
"--add-exports", "javafx.controls/com.sun.javafx.scene.control.behavior=com.jfoenix",
"--add-exports", "javafx.graphics/com.sun.javafx.scene.traversal=org.controlsfx.controls",
"--add-exports", "javafx.graphics/com.sun.javafx.scene=org.controlsfx.controls",
"--add-exports", "org.apache.commons.lang3/org.apache.commons.lang3.math=io.xpipe.app",
"--add-opens", "java.base/java.lang=io.xpipe.app",
"--add-opens", "java.base/java.nio.file=io.xpipe.app",
"--add-opens", "java.base/java.lang.reflect=com.jfoenix",
"--add-opens", "java.base/java.lang.reflect=com.jfoenix",
"--add-opens", "java.base/java.lang=io.xpipe.core",
"--add-opens", "java.desktop/java.awt=io.xpipe.app",
"--add-opens", "net.synedra.validatorfx/net.synedra.validatorfx=io.xpipe.app",
"--add-opens", 'com.dlsc.preferencesfx/com.dlsc.preferencesfx.view=io.xpipe.app',
"--add-opens", 'com.dlsc.preferencesfx/com.dlsc.preferencesfx.model=io.xpipe.app',
"-Xmx8g",
"-Dio.xpipe.app.arch=$rootProject.arch",
"-Dfile.encoding=UTF-8",
// Disable this for now as it requires Windows 10+
// '-XX:+UseZGC',
"-Dvisualvm.display.name=XPipe"
]
}
import org.gradle.internal.os.OperatingSystem
if (OperatingSystem.current() == OperatingSystem.LINUX) {
jvmRunArgs.addAll("--add-opens", "java.desktop/sun.awt.X11=io.xpipe.app")
}
def extensionJarDepList = project.allExtensions.stream().map(p -> p.getTasksByName('jar', true)).toList();
jar {
finalizedBy(extensionJarDepList)
}
application {
mainModule = 'io.xpipe.app'
mainClass = 'io.xpipe.app.Main'
applicationDefaultJvmArgs = jvmRunArgs
applicationDefaultJvmArgs.add('-XX:+EnableDynamicAgentLoading')
}
run {
systemProperty 'io.xpipe.app.useVirtualThreads', 'false'
systemProperty 'io.xpipe.app.mode', 'gui'
systemProperty 'io.xpipe.app.dataDir', "$projectDir/local_git8/"
systemProperty 'io.xpipe.app.writeLogs', "true"
systemProperty 'io.xpipe.app.writeSysOut', "true"
systemProperty 'io.xpipe.app.developerMode', "true"
systemProperty 'io.xpipe.app.logLevel', "trace"
systemProperty 'io.xpipe.app.fullVersion', rootProject.fullVersion
systemProperty 'io.xpipe.app.showcase', 'false'
// systemProperty "io.xpipe.beacon.port", "21724"
// systemProperty "io.xpipe.beacon.printMessages", "true"
// systemProperty 'io.xpipe.app.debugPlatform', "true"
// systemProperty "io.xpipe.beacon.localProxy", "true"
systemProperty 'java.library.path', "./lib"
workingDir = rootDir
}
task runAttachedDebugger(type: JavaExec) {
workingDir = rootDir
classpath = run.classpath
mainModule = 'io.xpipe.app'
mainClass = 'io.xpipe.app.Main'
modularity.inferModulePath = true
jvmArgs += jvmRunArgs
jvmArgs += List.of(
"-javaagent:${System.getProperty("user.home")}/.attachme/attachme-agent-1.2.4.jar=port:7857,host:localhost".toString(),
"-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=127.0.0.1:0"
)
jvmArgs += '-XX:+EnableDynamicAgentLoading'
systemProperties run.systemProperties
}
processResources {
doLast {
def cssFiles = fileTree(dir: "$sourceSets.main.output.resourcesDir/io/xpipe/app/resources/style")
cssFiles.include "**/*.css"
cssFiles.each { css ->
logger.info("converting CSS to BSS ${css}");
javaexec {
workingDir = project.projectDir
jvmArgs += "--module-path=$sourceSets.main.runtimeClasspath.asPath,"
jvmArgs += "--add-modules=javafx.graphics"
main = "com.sun.javafx.css.parser.Css2Bin"
args css
}
delete css
}
}
doLast {
def resourcesDir = new File(sourceSets.main.output.resourcesDir, "io/xpipe/app/resources/third-party")
resourcesDir.mkdirs()
copy {
from "$rootDir/dist/licenses"
into resourcesDir
}
}
}
distTar {
enabled = false;
}
distZip {
enabled = false;
}