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:
modmuss50
2020-06-08 15:19:11 +01:00
committed by GitHub
parent fdbdcc4bbf
commit b1ae5dee5d
9 changed files with 57 additions and 42 deletions

View File

@@ -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);
}

View File

@@ -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);
}
}