mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-03 05:57:42 -05:00
Test across java and gradle versions with github actions. (#218)
* Experiment with github actions * Fix? * another fix * Fix? * Change github actions run args * Tried and tested is better right? * spaces spaces spaces * revert * info * Just 4.9 * Fixes to support building on newer gradle versions * Forward log output and run tests on runtime gradle version * Remove travis * De-duplicate * Remove daily action, doesnt seem to work so well.
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
package net.fabricmc.loom.task;
|
||||
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.tasks.Internal;
|
||||
|
||||
import net.fabricmc.loom.LoomGradleExtension;
|
||||
|
||||
@@ -33,6 +34,7 @@ public abstract class AbstractLoomTask extends DefaultTask {
|
||||
setGroup("fabric");
|
||||
}
|
||||
|
||||
@Internal
|
||||
protected LoomGradleExtension getExtension() {
|
||||
return getProject().getExtensions().getByType(LoomGradleExtension.class);
|
||||
}
|
||||
|
||||
@@ -24,12 +24,10 @@
|
||||
|
||||
package net.fabricmc.loom.util;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.file.RegularFileProperty;
|
||||
import org.gradle.api.model.ObjectFactory;
|
||||
|
||||
//This is used to bridge the gap over large gradle api changes.
|
||||
public class GradleSupport {
|
||||
@@ -41,17 +39,24 @@ public class GradleSupport {
|
||||
//Nope
|
||||
}
|
||||
|
||||
return getfilePropertyLegacy(project);
|
||||
try {
|
||||
return getfilePropertyLegacy(project);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to find file property", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static RegularFileProperty getfilePropertyModern(Project project) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
||||
ObjectFactory objectFactory = project.getObjects();
|
||||
Method method = objectFactory.getClass().getDeclaredMethod("fileProperty");
|
||||
private static RegularFileProperty getfilePropertyModern(Project project) throws Exception {
|
||||
return getfilePropertyLegacyFromObject(project.getObjects());
|
||||
}
|
||||
|
||||
private static RegularFileProperty getfilePropertyLegacy(Project project) throws Exception {
|
||||
return getfilePropertyLegacyFromObject(project.getLayout());
|
||||
}
|
||||
|
||||
private static RegularFileProperty getfilePropertyLegacyFromObject(Object object) throws Exception {
|
||||
Method method = object.getClass().getDeclaredMethod("fileProperty");
|
||||
method.setAccessible(true);
|
||||
return (RegularFileProperty) method.invoke(objectFactory);
|
||||
}
|
||||
|
||||
private static RegularFileProperty getfilePropertyLegacy(Project project) {
|
||||
return project.getLayout().fileProperty();
|
||||
return (RegularFileProperty) method.invoke(object);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user