🦀 proguard is dead, clean up build.gradle
This commit is contained in:
+34
-180
@@ -1,18 +1,3 @@
|
|||||||
import java.nio.charset.StandardCharsets
|
|
||||||
|
|
||||||
// this build.gradle is tweaked from CCA: https://github.com/OnyxStudios/Cardinal-Components-API/blob/master/build.gradle
|
|
||||||
|
|
||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
google()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.guardsquare:proguard-gradle:7.1.0-beta4'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "fabric-loom" version "0.10-SNAPSHOT"
|
id "fabric-loom" version "0.10-SNAPSHOT"
|
||||||
id "maven-publish"
|
id "maven-publish"
|
||||||
@@ -25,119 +10,30 @@ archivesBaseName = "omega-config"
|
|||||||
subprojects {
|
subprojects {
|
||||||
apply plugin: 'fabric-loom'
|
apply plugin: 'fabric-loom'
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
apply plugin: 'java-library'
|
|
||||||
|
|
||||||
archivesBaseName = project.name
|
archivesBaseName = project.name
|
||||||
group = "draylar.${project.group}"
|
group = "draylar.${project.group}"
|
||||||
|
|
||||||
// import utility functions
|
// Only publish for submodules (not the root project) - add standard jar, + sources & development jar
|
||||||
apply from: "https://raw.githubusercontent.com/NerdHubMC/Gradle-Scripts/master/scripts/utilities.gradle"
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
compileJava {
|
|
||||||
options.encoding = StandardCharsets.UTF_8.name()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (JavaVersion.current().isJava8Compatible()) {
|
|
||||||
allprojects {
|
|
||||||
tasks.withType(Javadoc) {
|
|
||||||
options.addStringOption("Xdoclint:none", "-quiet")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
from "LICENSE.md"
|
|
||||||
from "LICENSE"
|
|
||||||
manifest.mainAttributes(
|
|
||||||
"Implementation-Title": project.archivesBaseName,
|
|
||||||
"Implementation-Version": mod_version,
|
|
||||||
"Maven-Artifact": "${project.group}:${project.name}:${mod_version}".toLowerCase(Locale.ROOT),
|
|
||||||
"Built-On-Minecraft": "${project.minecraft_version}",
|
|
||||||
"Built-On-Java": "${System.getProperty("java.vm.version")} (${System.getProperty("java.vm.vendor")})"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
||||||
from sourceSets.main.allSource
|
|
||||||
classifier = "sources"
|
|
||||||
}
|
|
||||||
|
|
||||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
||||||
from javadoc.destinationDir
|
|
||||||
classifier = "javadoc"
|
|
||||||
}
|
|
||||||
tasks.build.dependsOn javadocJar
|
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
artifact(remapJar) {
|
from components.java
|
||||||
builtBy remapJar
|
|
||||||
}
|
|
||||||
|
|
||||||
artifact(sourcesJar) {
|
|
||||||
builtBy remapSourcesJar
|
|
||||||
}
|
|
||||||
|
|
||||||
artifact(file("${project.buildDir}/libs/${archivesBaseName}-${project.mod_version}-min.jar")) {
|
|
||||||
builtBy(remapJar)
|
|
||||||
classifier = 'min'
|
|
||||||
}
|
|
||||||
|
|
||||||
pom.withXml {
|
|
||||||
def depsNode = asNode().appendNode("dependencies")
|
|
||||||
subprojects.each {
|
|
||||||
def depNode = depsNode.appendNode("dependency")
|
|
||||||
depNode.appendNode("groupId", it.group)
|
|
||||||
depNode.appendNode("artifactId", it.name)
|
|
||||||
depNode.appendNode("version", it.version)
|
|
||||||
depNode.appendNode("scope", "compile")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.publish.dependsOn build //stupid fix for maven/loom not publishing the main artifact
|
// Add sources & javadoc artifacts
|
||||||
|
java {
|
||||||
task('proguard', type: proguard.gradle.ProGuardTask) {
|
withSourcesJar()
|
||||||
configuration './proguard.conf'
|
withJavadocJar()
|
||||||
verbose
|
|
||||||
injars project.buildDir.toString() + '/libs/' + archivesBaseName + "-" + project.mod_version + ".jar"
|
|
||||||
outjars project.buildDir.toString() + '/libs/' + archivesBaseName + "-" + project.mod_version + "-min.jar"
|
|
||||||
printmapping 'out.map'
|
|
||||||
keepparameternames
|
|
||||||
renamesourcefileattribute 'SourceFile'
|
|
||||||
keepattributes 'Signature,Exceptions,InnerClasses,PermittedSubclasses,EnclosingMethod,Deprecated,SourceFile,LineNumberTable'
|
|
||||||
keepattributes '*Annotation*'
|
|
||||||
|
|
||||||
keep 'public class * { \
|
|
||||||
public protected *; \
|
|
||||||
}'
|
|
||||||
keepclassmembernames 'class * { \
|
|
||||||
java.lang.Class class$(java.lang.String); \
|
|
||||||
java.lang.Class class$(java.lang.String, boolean); \
|
|
||||||
}'
|
|
||||||
|
|
||||||
keepclassmembers 'class draylar.omegaconfig.mixin.* {\
|
|
||||||
<fields>;\
|
|
||||||
<init>();\
|
|
||||||
<methods>;\
|
|
||||||
}'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
remapJar.finalizedBy proguard
|
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
apply plugin: "fabric-loom"
|
apply plugin: "fabric-loom"
|
||||||
|
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
|
||||||
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_16
|
version = project.mod_version
|
||||||
version = System.getenv("TRAVIS_TAG") ?: project.mod_version
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
@@ -145,98 +41,56 @@ allprojects {
|
|||||||
url = "https://maven.fabricmc.net"
|
url = "https://maven.fabricmc.net"
|
||||||
}
|
}
|
||||||
|
|
||||||
maven { url = "https://maven.terraformersmc.com/releases/" }
|
maven {
|
||||||
|
name = "TerraformersMC"
|
||||||
|
url = "https://maven.terraformersmc.com/releases/"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
//to change the versions see the gradle.properties file
|
|
||||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
|
|
||||||
modRuntimeOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
|
|
||||||
modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
from(rootProject.file("LICENSE.md")) {
|
|
||||||
rename { "LICENSE_${project.archivesBaseName.replace('-', '_')}" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
afterEvaluate {
|
|
||||||
processResources {
|
processResources {
|
||||||
// this will ensure that this task is redone when there"s a change
|
inputs.property "version", project.version
|
||||||
inputs.property "version", mod_version
|
|
||||||
|
|
||||||
// replace stuff in fabric.mod.json, nothing else
|
filesMatching("fabric.mod.json") {
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
expand "version": project.version
|
||||||
include "fabric.mod.json"
|
|
||||||
|
|
||||||
// add mod metadata
|
|
||||||
expand "version": mod_version
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// copy everything else, that"s not the fabric.mod.json
|
tasks.withType(JavaCompile) {
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
|
||||||
exclude "fabric.mod.json"
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
from(rootProject.file("LICENSE")) {
|
||||||
|
rename { "LICENSE_${project.archivesBaseName.replace('-', '_')}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Main project depends on the base & gui module for testing
|
||||||
|
dependencies {
|
||||||
|
implementation project(path: ":omega-config-base", configuration: "namedElements")
|
||||||
|
implementation project(path: ":omega-config-gui", configuration: "namedElements")
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
testmodImplementation sourceSets.main.output
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
testmod {
|
testmod {
|
||||||
compileClasspath += main.compileClasspath
|
compileClasspath += main.compileClasspath
|
||||||
runtimeClasspath += main.runtimeClasspath
|
runtimeClasspath += main.runtimeClasspath
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
compileClasspath += main.compileClasspath
|
compileClasspath += main.compileClasspath
|
||||||
runtimeClasspath += main.runtimeClasspath
|
runtimeClasspath += main.runtimeClasspath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task licenseFormatAll
|
|
||||||
subprojects { p -> licenseFormatAll.dependsOn("${p.path}:licenseFormat") }
|
|
||||||
subprojects.each { remapJar.dependsOn("${it.path}:remapJar") }
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
name = "JitPack"
|
|
||||||
url = "https://jitpack.io"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation project(path: ":omega-config-base", configuration: "namedElements")
|
|
||||||
implementation project(path: ":omega-config-gui", configuration: "namedElements")
|
|
||||||
modRuntimeOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
|
|
||||||
modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
|
|
||||||
|
|
||||||
afterEvaluate {
|
|
||||||
testmodImplementation sourceSets.main.output
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
mavenJava(MavenPublication) {
|
|
||||||
from components.java
|
|
||||||
|
|
||||||
pom.withXml {
|
|
||||||
def depsNode = asNode().appendNode("dependencies")
|
|
||||||
subprojects.each {
|
|
||||||
def depNode = depsNode.appendNode("dependency")
|
|
||||||
depNode.appendNode("groupId", it.group)
|
|
||||||
depNode.appendNode("artifactId", it.name)
|
|
||||||
depNode.appendNode("version", it.version)
|
|
||||||
depNode.appendNode("scope", "compile")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.publish.dependsOn build //stupid fix for maven/loom not publishing the main artifact
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
-ignorewarnings
|
|
||||||
|
|
||||||
-keep class net.fabricmc.api.** { *; }
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
-ignorewarnings
|
|
||||||
|
|
||||||
-keep class net.fabricmc.api.** { *; }
|
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
package draylar.omegaconfiggui;
|
package draylar.omegaconfiggui;
|
||||||
|
|
||||||
import draylar.omegaconfig.api.Config;
|
import draylar.omegaconfig.api.Config;
|
||||||
import draylar.omegaconfiggui.api.screen.ModMenuHelper;
|
|
||||||
import draylar.omegaconfiggui.api.screen.OmegaConfigScreen;
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
@@ -17,8 +15,8 @@ public class OmegaConfigGui {
|
|||||||
* @param <T> config type
|
* @param <T> config type
|
||||||
*/
|
*/
|
||||||
public static <T extends Config> void registerConfigScreen(T config) {
|
public static <T extends Config> void registerConfigScreen(T config) {
|
||||||
if (FabricLoader.getInstance().isModLoaded("modmenu")) {
|
if(FabricLoader.getInstance().isModLoaded("modmenu")) {
|
||||||
ModMenuHelper.injectScreen(config, parent -> new OmegaConfigScreen<>(config, parent));
|
// ModMenuHelper.injectScreen(config, parent -> new OmegaConfigScreen<>(config, parent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-12
@@ -1,21 +1,10 @@
|
|||||||
package draylar.omegaconfiggui.api.screen;
|
package draylar.omegaconfiggui.api.screen;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
|
||||||
import draylar.omegaconfig.api.Config;
|
|
||||||
import draylar.omegaconfiggui.mixin.ModMenuAccessor;
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
public class ModMenuHelper {
|
public class ModMenuHelper {
|
||||||
|
|
||||||
public static <T extends Config> void injectScreen(T config, OmegaConfigScreenSupplier<T> factory) {
|
|
||||||
// they will suspect nothing
|
|
||||||
ModMenuAccessor.setConfigScreenFactories(
|
|
||||||
new ImmutableMap.Builder<String, ConfigScreenFactory<?>>()
|
|
||||||
.putAll(ModMenuAccessor.getConfigScreenFactories())
|
|
||||||
.put(config.getModid(), factory::get)
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
package draylar.omegaconfiggui.mixin;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.terraformersmc.modmenu.ModMenu;
|
|
||||||
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
|
||||||
|
|
||||||
@Mixin(ModMenu.class)
|
|
||||||
public interface ModMenuAccessor {
|
|
||||||
@Accessor
|
|
||||||
static ImmutableMap<String, ConfigScreenFactory<?>> getConfigScreenFactories() {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Accessor
|
|
||||||
static void setConfigScreenFactories(ImmutableMap<String, ConfigScreenFactory<?>> configScreenFactories) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,8 +4,7 @@
|
|||||||
"package": "draylar.omegaconfiggui.mixin",
|
"package": "draylar.omegaconfiggui.mixin",
|
||||||
"compatibilityLevel": "JAVA_16",
|
"compatibilityLevel": "JAVA_16",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"ClickableWidgetInvoker",
|
"ClickableWidgetInvoker"
|
||||||
"ModMenuAccessor"
|
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
-ignorewarnings
|
|
||||||
|
|
||||||
-keep class net.fabricmc.api.** { *; }
|
|
||||||
Reference in New Issue
Block a user