Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/test-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ jobs:

- name: Build
run: ./gradlew --info -s -x assemble -Ptraining-wheels.gradle-version=${{ env.GRADLE_VERSION }}

test:
name: "${{ matrix.test.displayName }} (${{ matrix.os }})"
runs-on: "${{ matrix.os }}-latest"
Expand All @@ -99,6 +98,7 @@ jobs:
os: [ubuntu, windows, macos]
env:
GRADLE_VERSION: ${{ needs.set-gradle-version.outputs.gradle-version }}
CI: false
steps:
- name: Checkout repository
uses: neoforged/actions/checkout@main
Expand Down Expand Up @@ -175,7 +175,6 @@ jobs:
name: test-results-${{ steps.format-artifact-name-windows.outputs.artifact-name }}
path: junit.xml
retention-days: 1

process-test-data:
name: Process Test Data
runs-on: ubuntu-latest
Expand All @@ -192,10 +191,11 @@ jobs:
path: downloaded_artifacts

- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
uses: mikepenz/action-junit-report@v6
if: always() # always run even if the previous step fails
with:
report_paths: '**/*.xml'
update_check: 'true'

- name: Merge Test Reports
if: always()
Expand Down
5 changes: 0 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ subprojects.forEach { Project subProject ->
subProject.java.toolchain.languageVersion = JavaLanguageVersion.of(project.java_version)
subProject.java.withSourcesJar()

//We exclude ASM from all subprojects, it is handled by Gradle itself.
subProject.configurations.configureEach { Configuration configuration ->
configuration.exclude group: 'org.ow2.asm'
}

['apiElements', 'runtimeElements'].each {
subProject.configurations.named(it).configure {
attributes {
Expand Down
4 changes: 4 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ dependencies {
api "net.neoforged:JarJarMetadata:${project.jarjar_version}"
api "net.neoforged:JarJarSelector:${project.jarjar_version}"

api "org.ow2.asm:asm:${project.asm_version}"
api "org.ow2.asm:asm-commons:${project.asm_version}"
api "org.ow2.asm:asm-tree:${project.asm_version}"

// IDE support
api "gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:${project.gradle_idea_extension_version}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ protected Provider<Boolean> getBooleanProperty(String propertyName, boolean defa
);
}

@Override
protected Provider<Boolean> getBooleanProperty(final String propertyName)
{
return getIsEnabled().zip(
getBooleanLocalProperty(propertyName),
(enabled, value) -> enabled ? value : null
);
}

@Override
protected Provider<List<String>> getSpaceSeparatedListProperty(String propertyName, List<String> defaultValue)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ protected Provider<Boolean> getBooleanLocalProperty(String propertyName, boolean
return super.getBooleanProperty(String.format("%s.%s", prefix, propertyName), defaultValue, false);
}

protected Provider<Boolean> getBooleanLocalProperty(String propertyName)
{
return super.getBooleanProperty(String.format("%s.%s", prefix, propertyName));
}

protected Provider<List<String>> getSpaceSeparatedListLocalProperty(String propertyName, List<String> defaultValue)
{
return super.getSpaceSeparatedListProperty(String.format("%s.%s", prefix, propertyName), defaultValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,25 @@ protected Provider<Directory> getDirectoryProperty(String propertyName, Provider
protected Provider<Boolean> getBooleanProperty(String propertyName, boolean defaultValue, boolean disabledValue) {
String fullPropertyName = SUBSYSTEM_PROPERTY_PREFIX + propertyName;
return this.project.getProviders().gradleProperty(fullPropertyName)
.map(value -> {
try {
return Boolean.valueOf(value);
} catch (Exception e) {
throw new GradleException("Gradle Property " + fullPropertyName + " is not set to a boolean value: '" + value + "'");
}
})
.orElse(defaultValue);
.map(value -> {
try {
return Boolean.valueOf(value);
} catch (Exception e) {
throw new GradleException("Gradle Property " + fullPropertyName + " is not set to a boolean value: '" + value + "'");
}
}).orElse(defaultValue);
}

protected Provider<Boolean> getBooleanProperty(String propertyName) {
String fullPropertyName = SUBSYSTEM_PROPERTY_PREFIX + propertyName;
return this.project.getProviders().gradleProperty(fullPropertyName)
.map(value -> {
try {
return Boolean.valueOf(value);
} catch (Exception e) {
throw new GradleException("Gradle Property " + fullPropertyName + " is not set to a boolean value: '" + value + "'");
}
});
}

protected Provider<List<String>> getSpaceSeparatedListProperty(String propertyName, List<String> defaultValue) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package net.neoforged.gradle.common.extensions.subsystems;

import groovy.lang.Closure;
import groovy.transform.Internal;
import net.neoforged.gdi.ConfigurableDSLElement;
import net.neoforged.gradle.common.extensions.base.WithEnabledProperty;
import net.neoforged.gradle.common.extensions.base.WithLocalProperties;
import net.neoforged.gradle.common.extensions.base.WithPropertyLookup;
import net.neoforged.gradle.dsl.common.extensions.subsystems.*;
Expand All @@ -21,16 +19,17 @@

import static net.neoforged.gradle.dsl.common.util.Constants.*;

public abstract class SubsystemsExtension extends WithPropertyLookup implements ConfigurableDSLElement<Subsystems>, Subsystems {
public abstract class SubsystemsExtension extends WithPropertyLookup implements ConfigurableDSLElement<Subsystems>, Subsystems
{

private final Conventions conventions;
private final Parchment parchment;
private final Tools tools;
private final Parchment parchment;
private final Tools tools;
private final Integration integration;


@Inject
public SubsystemsExtension(Project project) {
public SubsystemsExtension(Project project)
{
super(project);

this.integration = project.getObjects().newInstance(IntegrationExtensions.class, project);
Expand All @@ -46,77 +45,95 @@ public SubsystemsExtension(Project project) {
configureRenderDocDefaults();
}

private void configureRenderDocDefaults() {
private void configureRenderDocDefaults()
{
RenderDoc devLogin = getRenderDoc();
devLogin.getConfigurationSuffix().convention(
getStringProperty("renderDoc.configurationSuffix", "RenderDocLocalOnly")
getStringProperty("renderDoc.configurationSuffix", "RenderDocLocalOnly")
);
}

private void configureDevLoginDefaults() {
private void configureDevLoginDefaults()
{
DevLogin devLogin = getDevLogin();
devLogin.getMainClass().convention(
getStringProperty("devLogin.mainClass", DEVLOGIN_MAIN_CLASS)
getStringProperty("devLogin.mainClass", DEVLOGIN_MAIN_CLASS)
);
devLogin.getConfigurationSuffix().convention(
getStringProperty("devLogin.configurationSuffix", "DevLoginLocalOnly")
getStringProperty("devLogin.configurationSuffix", "DevLoginLocalOnly")
);
}

private void configureToolsDefaults() {
private void configureToolsDefaults()
{
Tools tools = getTools();
tools.getJST().convention(
getStringProperty("tools.jst", JST_TOOL_ARTIFACT)
getStringProperty("tools.jst", JST_TOOL_ARTIFACT)
);
tools.getDevLogin().convention(
getStringProperty("tools.devLogin", DEVLOGIN_TOOL_ARTIFACT)
getStringProperty("tools.devLogin", DEVLOGIN_TOOL_ARTIFACT)
);
tools.getBinaryPatcher().convention(
getStringProperty("tools.binaryPatcher", BINPARCHER_TOOL_ARTIFACT)
getStringProperty("tools.binaryPatcher", BINPARCHER_TOOL_ARTIFACT)
);
tools.getAccessTransformer().convention(
getStringProperty("tools.accessTransformer", ACCESSTRANSFORMER_TOOL_ARTIFACT)
getStringProperty("tools.accessTransformer", ACCESSTRANSFORMER_TOOL_ARTIFACT)
);
tools.getAutoRenamingTool().convention(
getStringProperty("tools.autoRenamingTool", FART_TOOL_ARTIFACT)
getStringProperty("tools.autoRenamingTool", FART_TOOL_ARTIFACT)
);
tools.getInstallerTools().convention(
getStringProperty("tools.installerTools", INSTALLERTOOLS_TOOL_ARTIFACT)
getStringProperty("tools.installerTools", INSTALLERTOOLS_TOOL_ARTIFACT)
);
tools.getJarSplitter().convention(
getStringProperty("tools.jarSplitter", JARSPLITTER_TOOL_ARTIFACT)
getStringProperty("tools.jarSplitter", JARSPLITTER_TOOL_ARTIFACT)
);
tools.getDecompiler().convention(
getStringProperty("tools.decompiler", DECOMPILER_TOOL_ARTIFACT)
getStringProperty("tools.decompiler", DECOMPILER_TOOL_ARTIFACT)
);

RenderDocTools renderDocTools = tools.getRenderDoc();
renderDocTools.getRenderDocPath().convention(
getDirectoryProperty("tools.renderDoc.path", getProject().getLayout().getBuildDirectory().dir("renderdoc"))
getDirectoryProperty("tools.renderDoc.path", getProject().getLayout().getBuildDirectory().dir("renderdoc"))
);
renderDocTools.getRenderDocVersion().convention(
getStringProperty("tools.renderDoc.version", "1.33")
getStringProperty("tools.renderDoc.version", "1.33")
);
renderDocTools.getRenderNurse().convention(
getStringProperty("tools.renderDoc.renderNurse", RENDERNURSE_TOOL_ARTIFACT)
getStringProperty("tools.renderDoc.renderNurse", RENDERNURSE_TOOL_ARTIFACT)
);
}

private void configureDecompilerDefaults() {
private void configureDecompilerDefaults()
{
Decompiler decompiler = getDecompiler();
decompiler.getMaxMemory().convention(getStringProperty("decompiler.maxMemory", "4g"));
decompiler.getMaxThreads().convention(getStringProperty("decompiler.maxThreads", "0").map(Integer::parseUnsignedInt));
decompiler.getLogLevel().convention(getStringProperty("decompiler.logLevel", "ERROR").map(s -> {
try {
try
{
return DecompilerLogLevel.valueOf(s.toUpperCase(Locale.ROOT));
} catch (Exception e) {
}
catch (Exception e)
{
throw new GradleException("Unknown DecompilerLogLevel: " + s + ". Available options: " + Arrays.toString(DecompilerLogLevel.values()));
}
}));
decompiler.getJvmArgs().convention(getSpaceSeparatedListProperty("decompiler.jvmArgs", Collections.emptyList()));
decompiler.getIsDisabled().convention(
getBooleanProperty("decompiler.enabled")
.map(prop -> !prop)
.orElse(
this.project.getProviders()
.environmentVariable("CI")
.map(ciMode -> ciMode.toLowerCase(Locale.ROOT).trim().equals("true") || ciMode.toLowerCase(Locale.ROOT).trim().equals("1"))
)
.orElse(false)
);
}

private void configureRecompilerDefaults() {
private void configureRecompilerDefaults()
{
Recompiler recompiler = getRecompiler();
recompiler.getArgs().convention(getSpaceSeparatedListProperty("recompiler.args", Collections.emptyList()));
recompiler.getJvmArgs().convention(getSpaceSeparatedListProperty("recompiler.jvmArgs", Collections.emptyList()));
Expand All @@ -125,7 +142,8 @@ private void configureRecompilerDefaults() {
recompiler.getType().convention(getStringProperty("recompiler.type", RecompilerType.getDefaultCompilerType().name()).map(RecompilerType::valueOf));
}

private void configureParchmentDefaults() {
private void configureParchmentDefaults()
{
Parchment parchment = getParchment();
project.afterEvaluate(p -> {
MavenArtifactRepository repo = p.getRepositories().maven(m -> {
Expand All @@ -140,48 +158,55 @@ private void configureParchmentDefaults() {
}

@Override
public Integration getIntegration() {
public Integration getIntegration()
{
return integration;
}

@Override
public Conventions getConventions() {
public Conventions getConventions()
{
return conventions;
}

@Override
public Parchment getParchment() {
public Parchment getParchment()
{
return parchment;
}

@Override
public Tools getTools() {
public Tools getTools()
{
return tools;
}

public static abstract class ParchmentExtensions extends WithLocalProperties implements Parchment {
public static abstract class ParchmentExtensions extends WithLocalProperties implements Parchment
{

@Inject
public ParchmentExtensions(Project project) {
public ParchmentExtensions(Project project)
{
super(project, "parchment");

getParchmentArtifact().convention(
getStringLocalProperty("parchmentArtifact", null)
getStringLocalProperty("parchmentArtifact", null)
);
getConflictPrefix().convention("p_");
getMinecraftVersion().convention(
getStringLocalProperty("minecraftVersion", null)
getStringLocalProperty("minecraftVersion", null)
);
getMappingsVersion().convention(
getStringLocalProperty("mappingsVersion", null)
getStringLocalProperty("mappingsVersion", null)
);
getAddRepository().convention(
getBooleanLocalProperty("addRepository", true)
getBooleanLocalProperty("addRepository", true)
);
}

@Internal
public Provider<String> getSelectedParchmentArtifact(String artifactMinecraftVersion) {
public Provider<String> getSelectedParchmentArtifact(String artifactMinecraftVersion)
{
return getParchmentArtifact().orElse(getMinecraftVersion().orElse(artifactMinecraftVersion)
.zip(getMappingsVersion(), (minecraftVersion, mappingVersion) -> {
return DEFAULT_PARCHMENT_GROUP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public abstract class DefaultRuntime extends JavaRuntimeTask implements Runtime
public DefaultRuntime() {
super();

arguments = getObjectFactory().newInstance(RuntimeArgumentsImpl.class, getProviderFactory());
arguments = getObjectFactory().newInstance(RuntimeArgumentsImpl.class);
multiArguments = getObjectFactory().newInstance(RuntimeMultiArgumentsImpl.class, getProviderFactory());

//All of these taskOutputs belong to the MCP group
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public abstract class RecompileSourceJar extends JavaCompile implements Runtime
public RecompileSourceJar() {
super();

arguments = getObjectFactory().newInstance(RuntimeArgumentsImpl.class, getProviderFactory());
arguments = getObjectFactory().newInstance(RuntimeArgumentsImpl.class);
multiArguments = getObjectFactory().newInstance(RuntimeMultiArgumentsImpl.class, getProviderFactory());

this.javaVersion = getProject().getObjects().property(JavaLanguageVersion.class);
Expand Down
Loading
Loading