* Added global access widener support. * Adapt loom to changed API of latest AW PR. * Fix expected access widener to fix the test. Since the access widener is now streamed directly into the writer, the expanded rules (i.e. accessible field makes the owning class also accessible) are no longer found in the remapped file. * Add basic transitive accesswidener test * Extracted applying transitive access wideners into their own jar processor since they also need to be applied if there is no AW in the mod itself. * Misc assortment of fixes * Set up the processor lazily to allow for adding the intermediary MC jar, which is needed to correctly remap intermediary AWs to named. * Rework to setup the tiny remapper classpath with the mc jar Add an extension prop to disable * Add TransitiveDetectorVisitor * Minor refactoring. * Use release-version of access-widener. Co-authored-by: modmuss50 <modmuss50@gmail.com>
159 lines
4.6 KiB
Java
159 lines
4.6 KiB
Java
/*
|
|
* This file is part of fabric-loom, licensed under the MIT License (MIT).
|
|
*
|
|
* Copyright (c) 2021 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.extension;
|
|
|
|
import org.gradle.api.Action;
|
|
import org.gradle.api.NamedDomainObjectContainer;
|
|
import org.gradle.api.artifacts.Dependency;
|
|
import org.gradle.api.file.ConfigurableFileCollection;
|
|
import org.gradle.api.file.RegularFileProperty;
|
|
import org.gradle.api.provider.ListProperty;
|
|
import org.gradle.api.provider.Property;
|
|
import org.gradle.api.publish.maven.MavenPublication;
|
|
|
|
import net.fabricmc.loom.api.LoomGradleExtensionAPI;
|
|
import net.fabricmc.loom.api.MixinExtensionAPI;
|
|
import net.fabricmc.loom.api.decompilers.LoomDecompiler;
|
|
import net.fabricmc.loom.api.mappings.layered.spec.LayeredMappingSpecBuilder;
|
|
import net.fabricmc.loom.configuration.ide.RunConfigSettings;
|
|
import net.fabricmc.loom.configuration.processors.JarProcessor;
|
|
import net.fabricmc.loom.util.DeprecationHelper;
|
|
|
|
public class MinecraftGradleExtension implements LoomGradleExtensionAPI {
|
|
private final LoomGradleExtensionAPI parent;
|
|
private boolean deprecationReported = false;
|
|
|
|
public MinecraftGradleExtension(LoomGradleExtensionAPI parent) {
|
|
this.parent = parent;
|
|
}
|
|
|
|
private void reportDeprecation() {
|
|
if (!deprecationReported) {
|
|
getDeprecationHelper().replaceWithInLoom0_11("minecraft", "loom");
|
|
deprecationReported = true;
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public DeprecationHelper getDeprecationHelper() {
|
|
return parent.getDeprecationHelper();
|
|
}
|
|
|
|
@Override
|
|
public RegularFileProperty getAccessWidenerPath() {
|
|
reportDeprecation();
|
|
return parent.getAccessWidenerPath();
|
|
}
|
|
|
|
@Override
|
|
public Property<Boolean> getShareRemapCaches() {
|
|
reportDeprecation();
|
|
return parent.getShareRemapCaches();
|
|
}
|
|
|
|
@Override
|
|
public ListProperty<LoomDecompiler> getGameDecompilers() {
|
|
reportDeprecation();
|
|
return parent.getGameDecompilers();
|
|
}
|
|
|
|
@Override
|
|
public ListProperty<JarProcessor> getGameJarProcessors() {
|
|
reportDeprecation();
|
|
return parent.getGameJarProcessors();
|
|
}
|
|
|
|
@Override
|
|
public ConfigurableFileCollection getLog4jConfigs() {
|
|
reportDeprecation();
|
|
return parent.getLog4jConfigs();
|
|
}
|
|
|
|
@Override
|
|
public Dependency layered(Action<LayeredMappingSpecBuilder> action) {
|
|
reportDeprecation();
|
|
return parent.layered(action);
|
|
}
|
|
|
|
@Override
|
|
public Property<Boolean> getRemapArchives() {
|
|
reportDeprecation();
|
|
return parent.getRemapArchives();
|
|
}
|
|
|
|
@Override
|
|
public void runs(Action<NamedDomainObjectContainer<RunConfigSettings>> action) {
|
|
reportDeprecation();
|
|
parent.runs(action);
|
|
}
|
|
|
|
@Override
|
|
public NamedDomainObjectContainer<RunConfigSettings> getRunConfigs() {
|
|
reportDeprecation();
|
|
return parent.getRunConfigs();
|
|
}
|
|
|
|
@Override
|
|
public void mixin(Action<MixinExtensionAPI> action) {
|
|
reportDeprecation();
|
|
parent.mixin(action);
|
|
}
|
|
|
|
@Override
|
|
public MixinExtensionAPI getMixin() {
|
|
reportDeprecation();
|
|
return parent.getMixin();
|
|
}
|
|
|
|
@Override
|
|
public Property<String> getCustomMinecraftManifest() {
|
|
reportDeprecation();
|
|
return parent.getCustomMinecraftManifest();
|
|
}
|
|
|
|
@Override
|
|
public Property<Boolean> getSetupRemappedVariants() {
|
|
reportDeprecation();
|
|
return parent.getSetupRemappedVariants();
|
|
}
|
|
|
|
@Override
|
|
public void disableDeprecatedPomGeneration(MavenPublication publication) {
|
|
reportDeprecation();
|
|
parent.disableDeprecatedPomGeneration(publication);
|
|
}
|
|
|
|
@Override
|
|
public String getModVersion() {
|
|
reportDeprecation();
|
|
throw new UnsupportedOperationException("Use loom extension");
|
|
}
|
|
|
|
@Override
|
|
public Property<Boolean> getEnableTransitiveAccessWideners() {
|
|
reportDeprecation();
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
}
|