diff --git a/.gitignore b/.gitignore index 159c8cd..54ac2f5 100644 --- a/.gitignore +++ b/.gitignore @@ -155,8 +155,8 @@ Thumbs.db *~ *.*# *#*# -/.kotlin/ /assets/assets.txt +/assets/sdk/ ## Special cases: diff --git a/android/build.gradle b/android/build.gradle index c340702..f1e7e80 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -47,7 +47,7 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { - minifyEnabled true + minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } diff --git a/android/proguard-rules.pro b/android/proguard-rules.pro index 771fa1a..39a0674 100644 --- a/android/proguard-rules.pro +++ b/android/proguard-rules.pro @@ -24,6 +24,17 @@ -dontwarn android.support.** -dontwarn com.badlogic.gdx.backends.android.AndroidFragmentApplication +# Ignore missing AWT classes (desktop-only, not needed on Android) +-dontwarn java.awt.** +-dontwarn javax.swing.** + +# Ignore Java 9+ classes that don't exist on Android +-dontwarn java.lang.Runtime$Version +-dontwarn java.lang.reflect.InaccessibleObjectException + +# Ignore all Groovy warnings (Gradle's internal dependency) +-dontwarn org.codehaus.groovy.** + # Needed by the gdx-controllers official extension. -keep class com.badlogic.gdx.controllers.android.AndroidControllers @@ -39,6 +50,10 @@ float reportRayFixture(long, float, float, float, float, float); } +# Don't obfuscate code at all, since it's open source and we want people to mess with the game's +# internals and reverse engineer the code as much as possible. +-dontobfuscate + # Ignore missing Java Beans classes (Android doesn't have java.beans, Groovy handles this internally) -dontwarn java.beans.** @@ -61,6 +76,8 @@ # You will probably need this line in most cases: -keep public class com.badlogic.gdx.graphics.Color { *; } +-keep class me.stringdotjar.** { *; } + # These two lines are used with mapping files; see https://developer.android.com/build/shrink-code#retracing -keepattributes LineNumberTable,SourceFile -renamesourcefileattribute SourceFile diff --git a/build.gradle b/build.gradle index 199446c..a90df70 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,6 @@ buildscript { } dependencies { classpath "com.android.tools.build:gradle:8.7.3" - } } diff --git a/core/build.gradle b/core/build.gradle index c0c016b..4dd5eed 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -11,10 +11,34 @@ dependencies { api "games.rednblack.miniaudio:miniaudio:$miniaudioVersion" // FNF:JE. - implementation "org.apache.groovy:groovy:4.0.12" - implementation "org.jetbrains:annotations:15.0" + implementation "org.apache.groovy:groovy:5.0.3" + implementation "org.jetbrains:annotations:26.0.2-1" - if(enableGraalNative == 'true') { + if (enableGraalNative == 'true') { implementation "io.github.berstanio:gdx-svmhelper-annotations:$graalHelperVersion" } } + +tasks.register('exportModSDK', Copy) { + group = "modding" + description = "Copies all API JARs needed for modding into the assets folder." + + into "$rootProject.projectDir/assets/sdk/api" + + from(tasks.named('jar')) { + rename { "funkin-api.jar" } + } + + // Include every external dependency. + from(configurations.runtimeClasspath) { + // Exclude native files, since modders only need the Java interfaces. + exclude "**/*.dll", "**/*.so", "**/*.dylib", "**/*.jnilib" + } +} + +// Make sure the assets are ready before the game runs. +if (project.name == 'lwjgl3') { + tasks.named('run') { + dependsOn(rootProject.tasks.named('processAssets')) + } +} diff --git a/lwjgl3/build.gradle b/lwjgl3/build.gradle index 3e513cd..aedb396 100644 --- a/lwjgl3/build.gradle +++ b/lwjgl3/build.gradle @@ -4,7 +4,7 @@ buildscript { } dependencies { classpath "io.github.fourlastor:construo:1.7.1" - if(enableGraalNative == 'true') { + if (enableGraalNative == 'true') { classpath "org.graalvm.buildtools.native:org.graalvm.buildtools.native.gradle.plugin:0.9.28" } } @@ -14,17 +14,14 @@ plugins { } apply plugin: 'io.github.fourlastor.construo' - -import io.github.fourlastor.construo.Target - -sourceSets.main.resources.srcDirs += [ rootProject.file('assets').path ] +sourceSets.main.resources.srcDirs += [rootProject.file('assets').path] mainClassName = 'me.stringdotjar.funkin.lwjgl3.Lwjgl3Launcher' application.setMainClass(mainClassName) eclipse.project.name = appName + '-lwjgl3' java.sourceCompatibility = 17 java.targetCompatibility = 17 if (JavaVersion.current().isJava9Compatible()) { - compileJava.options.release.set(17) + compileJava.options.release.set(17) } dependencies { @@ -34,7 +31,7 @@ dependencies { implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" implementation project(':core') - if(enableGraalNative == 'true') { + if (enableGraalNative == 'true') { implementation "io.github.berstanio:gdx-svmhelper-backend-lwjgl3:$graalHelperVersion" } } @@ -113,47 +110,6 @@ tasks.register("jarWin") { } } -construo { - // name of the executable - name.set(appName) - // human-readable name, used for example in the `.app` name for macOS - humanName.set(appName) - // Optional, defaults to project version property - version.set("$projectVersion") - - targets.configure { - register("linuxX64", Target.Linux) { - architecture.set(Target.Architecture.X86_64) - jdkUrl.set("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jdk_x64_linux_hotspot_17.0.15_6.tar.gz") - // Linux does not currently have a way to set the icon on the executable - } - register("macM1", Target.MacOs) { - architecture.set(Target.Architecture.AARCH64) - jdkUrl.set("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jdk_aarch64_mac_hotspot_17.0.15_6.tar.gz") - // macOS needs an identifier - identifier.set("me.stringdotjar.funkin." + appName) - // Optional: icon for macOS, as an ICNS file - macIcon.set(project.file("icons/logo.icns")) - } - register("macX64", Target.MacOs) { - architecture.set(Target.Architecture.X86_64) - jdkUrl.set("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jdk_x64_mac_hotspot_17.0.15_6.tar.gz") - // macOS needs an identifier - identifier.set("me.stringdotjar.funkin." + appName) - // Optional: icon for macOS, as an ICNS file - macIcon.set(project.file("icons/logo.icns")) - } - register("winX64", Target.Windows) { - architecture.set(Target.Architecture.X86_64) - // Optional: icon for Windows, as a PNG - icon.set(project.file("icons/logo.png")) - jdkUrl.set("https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jdk_x64_windows_hotspot_17.0.15_6.zip") - // Uncomment the next line to show a console when the game runs, to print messages. - //useConsole.set(true) - } - } -} - // Equivalent to the jar task; here for compatibility with gdx-setup. tasks.register('dist') { dependsOn 'jar' @@ -176,6 +132,6 @@ distributions { startScripts.dependsOn(':lwjgl3:jar') startScripts.classpath = project.tasks.jar.outputs.files -if(enableGraalNative == 'true') { +if (enableGraalNative == 'true') { apply from: file("nativeimage.gradle") }