mirror of
git://f0xx.org/ac/ac-session-studio
synced 2026-07-29 01:38:39 +03:00
- Launcher.java: non-Application Main-Class entry point (bypasses JVM Application subclass check) - build.gradle: shadow plugin 8.1.1 for fat jar; startScripts patched with --module-path \$APP_HOME/lib + --add-modules; generateWrapper task writes project-root ./ac-session-studio script - ac-session-studio: generated launcher wrapper (./ac-session-studio to run) java -jar build/libs/ac-session-studio.jar still requires --module-path; use ./ac-session-studio instead Co-authored-by: Cursor <cursoragent@cursor.com>
77 lines
2.0 KiB
Groovy
77 lines
2.0 KiB
Groovy
plugins {
|
|
id 'application'
|
|
id 'org.openjfx.javafxplugin' version '0.1.0'
|
|
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(21)
|
|
}
|
|
}
|
|
|
|
javafx {
|
|
version = '21'
|
|
modules = ['javafx.controls']
|
|
}
|
|
|
|
application {
|
|
mainClass = 'com.foxx.androidcast.studio.SessionStudioApp'
|
|
}
|
|
|
|
// Patch generated Unix start script to add --module-path $APP_HOME/lib.
|
|
tasks.named('startScripts').configure {
|
|
doLast {
|
|
def script = unixScript
|
|
// Replace the -classpath line to also include --module-path before it
|
|
script.text = script.text.replace(
|
|
' -classpath "$CLASSPATH" \\',
|
|
' --module-path "$APP_HOME/lib" \\\n --add-modules javafx.controls,javafx.graphics,javafx.base \\\n -classpath "$CLASSPATH" \\'
|
|
)
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation 'org.json:json:20240303'
|
|
}
|
|
|
|
jar {
|
|
manifest {
|
|
attributes 'Main-Class': 'com.foxx.androidcast.studio.Launcher'
|
|
}
|
|
}
|
|
|
|
shadowJar {
|
|
archiveBaseName = 'ac-session-studio'
|
|
archiveClassifier = ''
|
|
archiveVersion = ''
|
|
manifest {
|
|
attributes 'Main-Class': 'com.foxx.androidcast.studio.Launcher'
|
|
}
|
|
mergeServiceFiles()
|
|
}
|
|
|
|
// After installDist, generate a convenience wrapper at the project root
|
|
tasks.register('generateWrapper') {
|
|
dependsOn installDist
|
|
doLast {
|
|
def wrapper = file("${rootProject.projectDir}/ac-session-studio")
|
|
def distBin = "${buildDir}/install/ac-session-studio/bin/ac-session-studio"
|
|
wrapper.text = """\
|
|
#!/bin/sh
|
|
# Auto-generated launcher wrapper — re-run ./gradlew generateWrapper to refresh
|
|
SCRIPT_DIR="\$(cd "\$(dirname "\$0")" && pwd)"
|
|
exec "\${SCRIPT_DIR}/build/install/ac-session-studio/bin/ac-session-studio" "\$@"
|
|
"""
|
|
wrapper.setExecutable(true)
|
|
println "Wrapper written: ${wrapper}"
|
|
}
|
|
}
|
|
|
|
// Also attach generateWrapper to the standard build lifecycle
|
|
build.dependsOn generateWrapper
|