2023-03-29 03:54:52 -07:00
|
|
|
import java.text.SimpleDateFormat
|
|
|
|
|
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
maven {
|
|
|
|
url 'https://jitpack.io'
|
|
|
|
content {
|
|
|
|
includeGroup "com.github.RyanTheAllmighty.gettext"
|
2023-07-06 15:41:12 -07:00
|
|
|
includeGroup "com.github.ATLauncher.gradle-macappbundle"
|
2023-03-29 03:54:52 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dependencies {
|
|
|
|
classpath 'com.github.RyanTheAllmighty.gettext:gettext-gradle-plugin:aab5c30bf8'
|
2023-07-06 15:41:12 -07:00
|
|
|
classpath 'com.github.ATLauncher.gradle-macappbundle:edu.sc.seis.macAppBundle.gradle.plugin:d22f8cdb94'
|
2023-03-29 03:54:52 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
id 'java'
|
|
|
|
id 'application'
|
|
|
|
|
|
|
|
id 'org.cadixdev.licenser' version '0.6.1'
|
|
|
|
id 'com.adarshr.test-logger' version '3.2.0'
|
|
|
|
id 'edu.sc.seis.macAppBundle' version '2.3.0'
|
2023-07-06 15:41:12 -07:00
|
|
|
id 'edu.sc.seis.launch4j' version '3.0.3'
|
|
|
|
id 'de.undercouch.download' version '5.4.0'
|
|
|
|
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
|
|
|
id 'com.github.ben-manes.versions' version '0.47.0'
|
2023-03-29 03:54:52 -07:00
|
|
|
id 'com.apollographql.apollo' version '2.5.14'
|
|
|
|
}
|
|
|
|
|
|
|
|
apply plugin: 'org.mini2Dx.gettext'
|
|
|
|
|
|
|
|
sourceCompatibility = '1.8'
|
|
|
|
targetCompatibility = '1.8'
|
|
|
|
|
2024-03-15 16:31:06 -07:00
|
|
|
group = 'com.aclauncher'
|
2023-03-29 03:54:52 -07:00
|
|
|
version = rootProject.file('src/main/resources/version').text.trim().replace('.Beta', '')
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
gradlePluginPortal()
|
|
|
|
maven {
|
|
|
|
url 'https://libraries.minecraft.net'
|
|
|
|
}
|
|
|
|
maven {
|
|
|
|
url 'https://jitpack.io'
|
|
|
|
content {
|
|
|
|
includeGroup "com.github.RyanTheAllmighty.gettext"
|
|
|
|
includeGroup "com.github.Vatuu"
|
2023-05-05 20:29:12 -07:00
|
|
|
includeGroup "com.gitlab.doomsdayrs"
|
2023-06-10 05:15:00 -07:00
|
|
|
includeGroup "com.github.MCRcortex"
|
2023-03-29 03:54:52 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2023-07-06 15:41:12 -07:00
|
|
|
implementation 'net.java.dev.jna:jna:5.13.0'
|
|
|
|
implementation 'net.java.dev.jna:jna-platform:5.13.0'
|
|
|
|
implementation 'com.google.code.gson:gson:2.10.1'
|
|
|
|
implementation 'com.google.guava:guava:32.1.1-jre'
|
2023-03-29 03:54:52 -07:00
|
|
|
implementation 'org.tukaani:xz:1.9'
|
|
|
|
implementation 'com.mojang:authlib:1.5.21'
|
|
|
|
implementation 'net.iharder:base64:2.3.9'
|
|
|
|
implementation 'com.github.Vatuu:discord-rpc:1.6.2'
|
|
|
|
implementation 'net.sf.jopt-simple:jopt-simple:5.0.4'
|
|
|
|
implementation 'org.zeroturnaround:zt-zip:1.15'
|
2023-07-06 15:41:12 -07:00
|
|
|
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
|
|
|
|
implementation 'com.squareup.okhttp3:okhttp-tls:4.11.0'
|
|
|
|
implementation 'io.sentry:sentry:6.25.0'
|
2023-03-29 03:54:52 -07:00
|
|
|
implementation 'com.github.RyanTheAllmighty.gettext:gettext-lib:88ae68d897'
|
2023-07-06 15:41:12 -07:00
|
|
|
implementation 'org.apache.logging.log4j:log4j-api:2.20.0'
|
|
|
|
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'
|
2023-03-29 03:54:52 -07:00
|
|
|
implementation 'com.sangupta:murmur:1.0.0'
|
|
|
|
implementation 'org.apache.commons:commons-lang3:3.12.0'
|
|
|
|
implementation 'org.apache.commons:commons-text:1.10.0'
|
2023-07-06 15:41:12 -07:00
|
|
|
implementation 'org.apache.commons:commons-compress:1.23.0'
|
|
|
|
implementation 'com.formdev:flatlaf:3.1.1'
|
|
|
|
implementation 'com.formdev:flatlaf-extras:3.1.1'
|
|
|
|
implementation 'com.github.oshi:oshi-core:6.4.4'
|
2023-03-29 03:54:52 -07:00
|
|
|
implementation 'net.freeutils:jlhttp:2.6'
|
2023-07-06 15:41:12 -07:00
|
|
|
implementation 'joda-time:joda-time:2.12.5'
|
|
|
|
implementation 'org.commonmark:commonmark:0.21.0'
|
|
|
|
implementation 'com.github.hypfvieh:dbus-java:3.3.2'
|
2023-03-29 03:54:52 -07:00
|
|
|
implementation 'com.apollographql.apollo:apollo-runtime:2.5.14'
|
|
|
|
implementation 'com.apollographql.apollo:apollo-http-cache:2.5.14'
|
2023-05-05 20:29:12 -07:00
|
|
|
implementation 'com.apollographql.apollo:apollo-rx3-support:2.5.14'
|
2023-06-10 05:15:00 -07:00
|
|
|
implementation 'com.github.MCRcortex:nekodetector:Version-1.1-pre'
|
2023-05-05 20:29:12 -07:00
|
|
|
|
|
|
|
// RxJava
|
|
|
|
implementation("io.reactivex.rxjava3:rxjava:3.1.6")
|
|
|
|
implementation("com.gitlab.doomsdayrs:rxswing:a5749ad421") // TODO tag
|
2023-03-29 03:54:52 -07:00
|
|
|
|
|
|
|
testImplementation 'junit:junit:4.13.2'
|
2023-07-06 15:41:12 -07:00
|
|
|
testImplementation 'org.mockito:mockito-core:4.11.0' // Cannot update to 5.x.x as Java 11 min
|
|
|
|
testImplementation 'org.mockito:mockito-inline:4.11.0' // Cannot update to 5.x.x as Java 11 min
|
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.3'
|
2023-03-29 03:54:52 -07:00
|
|
|
testImplementation 'org.assertj:assertj-swing-junit:3.17.1'
|
2023-07-06 15:41:12 -07:00
|
|
|
testImplementation 'org.mock-server:mockserver-netty:5.15.0'
|
|
|
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.3'
|
|
|
|
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.9.3'
|
2023-03-29 03:54:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
application {
|
2024-03-15 16:31:06 -07:00
|
|
|
mainClass = 'com.aclauncher.App'
|
2023-03-29 03:54:52 -07:00
|
|
|
applicationDefaultJvmArgs = [
|
|
|
|
"-Djna.nosys=true",
|
|
|
|
"-Djava.net.preferIPv4Stack=true",
|
|
|
|
"-Dawt.useSystemAAFontSettings=on",
|
|
|
|
"-Dswing.aatext=true"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.named('test') {
|
|
|
|
// Use JUnit Platform for unit tests.
|
|
|
|
useJUnitPlatform()
|
|
|
|
|
|
|
|
testlogger {
|
|
|
|
theme 'mocha'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
jar {
|
|
|
|
manifest {
|
|
|
|
attributes(
|
|
|
|
'SplashScreen-Image': '/assets/image/splash-screen.png',
|
|
|
|
'Implementation-Title': project.name,
|
|
|
|
'Implementation-Version': archiveVersion,
|
2024-03-15 16:31:06 -07:00
|
|
|
'Implementation-Vender': 'ACLauncher',
|
|
|
|
'Main-Class': 'com.aclauncher.App',
|
2023-03-29 03:54:52 -07:00
|
|
|
'Multi-Release': 'true'
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
apollo {
|
|
|
|
customTypeMapping = [
|
|
|
|
"ID" : "java.lang.String",
|
|
|
|
"DateTime" : "java.util.Date"
|
|
|
|
]
|
2024-03-15 16:31:06 -07:00
|
|
|
packageName = "com.aclauncher.graphql"
|
2023-03-29 03:54:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
gettext {
|
|
|
|
translations {
|
|
|
|
srcDir = 'src'
|
2024-03-15 16:31:06 -07:00
|
|
|
include = 'main/java/com/aclauncher/**/*.java'
|
2023-03-29 03:54:52 -07:00
|
|
|
excludes = [
|
2024-03-15 16:31:06 -07:00
|
|
|
'main/java/com/aclauncher/adapter/**/*.java',
|
|
|
|
'main/java/com/aclauncher/annot/**/*.java',
|
|
|
|
'main/java/com/aclauncher/collection/**/*.java',
|
|
|
|
'main/java/com/aclauncher/evnt/**/*.java',
|
|
|
|
'main/java/com/aclauncher/exceptions/**/*.java',
|
|
|
|
'main/java/com/aclauncher/interfaces/**/*.java',
|
|
|
|
'main/java/com/aclauncher/listener/**/*.java',
|
|
|
|
'main/java/com/aclauncher/utils/**/*.java'
|
2023-03-29 03:54:52 -07:00
|
|
|
]
|
|
|
|
commentFormat = ' #. '
|
|
|
|
outputFilename = 'translations.pot'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
license {
|
|
|
|
header = project.file('LICENSEHEADER')
|
|
|
|
include '**/*.java'
|
|
|
|
exclude 'io/github/**/*.java'
|
|
|
|
exclude 'net/minecraft/**/*.java'
|
2024-03-15 16:31:06 -07:00
|
|
|
exclude 'com/aclauncher/graphql/**/*.java'
|
|
|
|
exclude 'com/aclauncher/gui/layouts/WrapLayout.java'
|
2023-03-29 03:54:52 -07:00
|
|
|
newLine = false
|
|
|
|
properties {
|
|
|
|
year = currentYear()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
shadowJar {
|
2023-07-06 15:41:12 -07:00
|
|
|
archiveClassifier.set(null)
|
2023-03-29 03:54:52 -07:00
|
|
|
minimize {
|
|
|
|
exclude(dependency('org.apache.logging.log4j:.*:.*'))
|
|
|
|
exclude(dependency('com.formdev:.*:.*'))
|
|
|
|
exclude(dependency('com.github.jnr:.*:.*'))
|
|
|
|
exclude(dependency('com.github.hypfvieh:.*:.*'))
|
|
|
|
exclude(dependency('org.apache.commons:commons-compress:.*'))
|
|
|
|
}
|
|
|
|
|
|
|
|
// these are included by dbus-java which is only used on Linux
|
|
|
|
exclude("jni/x86_64-Windows/")
|
|
|
|
exclude("jni/x86_64-SunOS/")
|
|
|
|
exclude("jni/x86_64-OpenBSD/")
|
|
|
|
exclude("jni/x86_64-FreeBSD/")
|
|
|
|
exclude("jni/x86_64-DragonFlyBSD/")
|
|
|
|
exclude("jni/sparcv9-SunOS/")
|
|
|
|
exclude("jni/ppc-AIX/")
|
|
|
|
exclude("jni/ppc64-AIX/")
|
|
|
|
exclude("jni/i386-Windows/")
|
|
|
|
exclude("jni/i386-SunOS/")
|
|
|
|
exclude("jni/Darwin/")
|
|
|
|
|
2023-07-06 15:41:12 -07:00
|
|
|
archiveClassifier.set('')
|
2023-03-29 03:54:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
macAppBundle {
|
2024-03-15 16:31:06 -07:00
|
|
|
mainClassName = 'com.aclauncher.App'
|
|
|
|
appName = 'ACLauncher'
|
2023-03-29 03:54:52 -07:00
|
|
|
appStyle = 'universalJavaApplicationStub'
|
|
|
|
runtimeConfigurationName = 'shadow'
|
|
|
|
jarTask = 'shadowJar'
|
|
|
|
icon = 'src/main/resources/assets/image/icon.icns'
|
|
|
|
javaProperties.put('user.dir', '$APP_ROOT/Contents/Java')
|
|
|
|
javaProperties.put('apple.laf.useScreenMenuBar', 'true')
|
|
|
|
javaExtras.put("-Djna.nosys", "true")
|
|
|
|
javaExtras.put("-Djava.net.preferIPv4Stack", "true")
|
|
|
|
javaExtras.put("-Dawt.useSystemAAFontSettings", "on")
|
|
|
|
javaExtras.put("-Dswing.aatext", "true")
|
|
|
|
bundleExtras.put("JVMVersion", project.targetCompatibility.toString() + "+")
|
|
|
|
}
|
|
|
|
|
|
|
|
copyToResourcesJava {
|
2024-03-15 16:31:06 -07:00
|
|
|
rename("ACLauncher-${project.version}.jar", "ACLauncher.jar")
|
2023-03-29 03:54:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
def currentYear() {
|
|
|
|
def df = new SimpleDateFormat("yyyy")
|
|
|
|
df.setTimeZone(TimeZone.getTimeZone("UTC"))
|
|
|
|
return df.format(new Date())
|
|
|
|
}
|
|
|
|
|
|
|
|
launch4j {
|
2024-03-15 16:31:06 -07:00
|
|
|
outfile = "ACLauncher-${project.version}.exe"
|
2023-03-29 03:54:52 -07:00
|
|
|
jreMinVersion = "${project.targetCompatibility.toString()}"
|
2024-03-15 16:31:06 -07:00
|
|
|
mainClassName = 'com.aclauncher.App'
|
2023-03-29 03:54:52 -07:00
|
|
|
icon = "${projectDir}/src/main/resources/assets/image/icon.ico"
|
|
|
|
version = "${project.version}"
|
|
|
|
textVersion = "${project.version}"
|
|
|
|
copyright = "2013-${currentYear()} ${project.name}"
|
|
|
|
companyName = "${project.name}"
|
|
|
|
bundledJrePath = "jre/;%JAVA_HOME%;%PATH%"
|
|
|
|
jvmOptions = [
|
|
|
|
"-Djna.nosys=true",
|
|
|
|
"-Djava.net.preferIPv4Stack=true",
|
|
|
|
"-Dawt.useSystemAAFontSettings=on",
|
|
|
|
"-Dswing.aatext=true"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
artifacts {
|
|
|
|
archives shadowJar
|
|
|
|
archives file(project.tasks.jar.getArchivePath().getPath().replace('.jar', '.exe').replace('libs', 'launch4j'))
|
|
|
|
archives file(project.tasks.jar.getArchivePath().getPath().replace('.jar', '.zip').replace('libs', 'distributions'))
|
|
|
|
}
|
|
|
|
|
|
|
|
test {
|
|
|
|
if (JavaVersion.current().isJava9Compatible()) {
|
|
|
|
jvmArgs '--add-opens=java.base/sun.security.x509=ALL-UNNAMED'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task copyArtifacts(type: Copy) {
|
|
|
|
dependsOn build
|
|
|
|
from shadowJar
|
|
|
|
from file(project.tasks.jar.getArchivePath().getPath().replace('.jar', '.exe').replace('libs', 'launch4j'))
|
|
|
|
from file(project.tasks.jar.getArchivePath().getPath().replace('.jar', '.zip').replace('libs', 'distributions'))
|
|
|
|
into "${projectDir}/dist"
|
|
|
|
}
|
|
|
|
|
|
|
|
task downloadNewerUniversalJavaApplicationStub(type: Download) {
|
|
|
|
description 'Downloads newer universalJavaApplicationStub'
|
2023-07-06 15:41:12 -07:00
|
|
|
src 'https://raw.githubusercontent.com/tofi86/universalJavaApplicationStub/404f5c1b008d6296065de7a93406b387c9f3dce1/src/universalJavaApplicationStub'
|
2023-03-29 03:54:52 -07:00
|
|
|
dest file("$buildDir/macApp/${project.name}.app/Contents/MacOS/universalJavaApplicationStub")
|
|
|
|
overwrite true
|
|
|
|
}
|
|
|
|
|
|
|
|
task createTestLauncherDir {
|
|
|
|
project.file('testLauncher/dev').mkdirs()
|
|
|
|
}
|
|
|
|
|
|
|
|
task createMacApp(type: Zip) {
|
2023-07-06 15:41:12 -07:00
|
|
|
dependsOn createApp, shadowJar, downloadNewerUniversalJavaApplicationStub
|
2023-03-29 03:54:52 -07:00
|
|
|
from("$buildDir/macApp") {
|
|
|
|
include "${project.name}.app/**"
|
|
|
|
exclude "${project.name}.app/Contents/MacOS"
|
|
|
|
}
|
|
|
|
from("$buildDir/macApp") {
|
|
|
|
include "${project.name}.app/Contents/MacOS/**"
|
|
|
|
fileMode 0777
|
|
|
|
}
|
2023-07-06 15:41:12 -07:00
|
|
|
archiveFileName = "${project.name}-${project.version}.zip"
|
2023-03-29 03:54:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
copyArtifacts.finalizedBy {
|
2024-03-15 16:31:06 -07:00
|
|
|
println 'ACLauncher has been built. Distribution files are located in the dist directory.'
|
2023-03-29 03:54:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
clean.doFirst {
|
|
|
|
delete "${projectDir}/dist"
|
|
|
|
}
|
|
|
|
|
|
|
|
project.afterEvaluate {
|
|
|
|
tasks.check {
|
|
|
|
dependsOn -= tasks.find {
|
|
|
|
it.name.equals("checkLicenses")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def shouldIgnoreUpdate = { String version -> return ['ALPHA', 'BETA', 'RC', '-M'].any { it -> version.toUpperCase().contains(it) }}
|
|
|
|
tasks.named("dependencyUpdates").configure {
|
|
|
|
rejectVersionIf {
|
|
|
|
shouldIgnoreUpdate(it.candidate.version)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
build.finalizedBy copyArtifacts
|
|
|
|
shadowJar.dependsOn jar
|
|
|
|
build.dependsOn createExe, createMacApp
|
2023-07-06 15:41:12 -07:00
|
|
|
startScripts.dependsOn shadowJar
|
|
|
|
createExe.dependsOn shadowJar
|
|
|
|
createAppZip.dependsOn downloadNewerUniversalJavaApplicationStub
|
2023-07-14 20:03:48 -07:00
|
|
|
createDmg.dependsOn downloadNewerUniversalJavaApplicationStub
|