mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
Merge commit '48f7aa66' into dev/1.14
# Conflicts: # build.gradle # src/main/java/net/fabricmc/loom/extension/LoomGradleExtensionImpl.java
This commit is contained in:
@@ -23,7 +23,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
|
||||
}
|
||||
|
||||
group = "dev.architectury"
|
||||
def baseVersion = '1.13'
|
||||
def baseVersion = '1.14'
|
||||
|
||||
def ENV = System.getenv()
|
||||
def runNumber = ENV.GITHUB_RUN_NUMBER ?: "9999"
|
||||
@@ -278,6 +278,10 @@ gradlePlugin {
|
||||
id = 'dev.architectury.loom-companion'
|
||||
implementationClass = 'net.fabricmc.loom.LoomCompanionGradlePlugin'
|
||||
}
|
||||
fabricLoomNoRemap {
|
||||
id = 'net.fabricmc.fabric-loom-no-remap-experimental'
|
||||
implementationClass = 'net.fabricmc.loom.LoomNoRemapGradlePlugin'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
44
src/main/java/net/fabricmc/loom/LoomNoRemapGradlePlugin.java
Normal file
44
src/main/java/net/fabricmc/loom/LoomNoRemapGradlePlugin.java
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2025 FabricMC
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.fabricmc.loom;
|
||||
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
|
||||
/**
|
||||
* A marker plugin to indicate to the main loom plugin not to setup for remapping.
|
||||
*/
|
||||
public class LoomNoRemapGradlePlugin implements Plugin<Project> {
|
||||
public static final String NAME = "net.fabricmc.fabric-loom-no-remap-experimental";
|
||||
|
||||
@Override
|
||||
public void apply(Project target) {
|
||||
if (target.getPluginManager().hasPlugin(LoomGradlePlugin.NAME)) {
|
||||
throw new IllegalStateException(NAME + " must be applied before " + LoomGradlePlugin.NAME);
|
||||
}
|
||||
|
||||
target.getPlugins().apply(LoomGradlePlugin.NAME);
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,7 @@ import org.gradle.api.provider.ListProperty;
|
||||
import org.gradle.api.provider.Property;
|
||||
|
||||
import net.fabricmc.loom.LoomGradleExtension;
|
||||
import net.fabricmc.loom.LoomNoRemapGradlePlugin;
|
||||
import net.fabricmc.loom.api.ForgeExtensionAPI;
|
||||
import net.fabricmc.loom.api.NeoForgeExtensionAPI;
|
||||
import net.fabricmc.loom.api.mappings.intermediate.IntermediateMappingsProvider;
|
||||
@@ -137,8 +138,13 @@ public abstract class LoomGradleExtensionImpl extends LoomGradleExtensionApiImpl
|
||||
disableObfuscation = project.getObjects().property(Boolean.class);
|
||||
dontRemap = project.getObjects().property(Boolean.class);
|
||||
|
||||
disableObfuscation.set(project.provider(() -> GradleUtils.getBooleanProperty(getProject(), Constants.Properties.DISABLE_OBFUSCATION)));
|
||||
disableObfuscation.finalizeValueOnRead();
|
||||
if (project.getPluginManager().hasPlugin(LoomNoRemapGradlePlugin.NAME)) {
|
||||
disableObfuscation.set(true);
|
||||
disableObfuscation.finalizeValue();
|
||||
} else {
|
||||
disableObfuscation.set(project.provider(() -> GradleUtils.getBooleanProperty(getProject(), Constants.Properties.DISABLE_OBFUSCATION)));
|
||||
disableObfuscation.finalizeValueOnRead();
|
||||
}
|
||||
|
||||
dontRemap.set(disableObfuscation.map(notObfuscated -> notObfuscated || GradleUtils.getBooleanProperty(getProject(), Constants.Properties.DONT_REMAP)));
|
||||
dontRemap.finalizeValueOnRead();
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
package net.fabricmc.loom.test.integration
|
||||
|
||||
import org.intellij.lang.annotations.Language
|
||||
import spock.lang.Specification
|
||||
import spock.lang.Unroll
|
||||
|
||||
@@ -36,14 +37,26 @@ class NotObfuscatedTest extends Specification implements GradleProjectTestTrait
|
||||
@Unroll
|
||||
def "Not Obfuscated"() {
|
||||
setup:
|
||||
def gradle = gradleProject(project: "minimalBase", version: PRE_RELEASE_GRADLE)
|
||||
def gradle = gradleProject(project: "minimalBaseNoRemap", version: PRE_RELEASE_GRADLE)
|
||||
gradle.buildGradle << '''
|
||||
dependencies {
|
||||
minecraft 'com.mojang:minecraft:1.21.10'
|
||||
api "net.fabricmc.fabric-api:fabric-api:0.134.1+1.21.10"
|
||||
minecraft 'com.mojang:minecraft:25w45a_unobfuscated'
|
||||
}
|
||||
'''
|
||||
gradle.getGradleProperties() << "fabric.loom.disableObfuscation=true"
|
||||
def sourceFile = new File(gradle.projectDir, "src/main/java/example/Test.java")
|
||||
sourceFile.parentFile.mkdirs()
|
||||
@Language("JAVA") String src = """
|
||||
package example;
|
||||
|
||||
import net.minecraft.resources.Identifier;
|
||||
|
||||
public class Test {
|
||||
public static void main(String[] args) {
|
||||
Identifier id = Identifier.fromNamespaceAndPath("loom", "test");
|
||||
}
|
||||
}
|
||||
"""
|
||||
sourceFile.text = src
|
||||
|
||||
when:
|
||||
def result = gradle.run(task: "build")
|
||||
|
||||
13
src/test/resources/projects/minimalBaseNoRemap/build.gradle
Normal file
13
src/test/resources/projects/minimalBaseNoRemap/build.gradle
Normal file
@@ -0,0 +1,13 @@
|
||||
// This is used by a range of tests that append to this file before running the gradle tasks.
|
||||
// Can be used for tests that require minimal custom setup
|
||||
plugins {
|
||||
id 'net.fabricmc.fabric-loom-no-remap-experimental'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
version = "1.0.0"
|
||||
group = "com.example"
|
||||
|
||||
base {
|
||||
archivesName = "fabric-example-mod"
|
||||
}
|
||||
Reference in New Issue
Block a user