aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authormodmuss50 <modmuss50@gmail.com>2020-06-08 15:19:11 +0100
committerGitHub <noreply@github.com>2020-06-08 15:19:11 +0100
commitb1ae5dee5d12de6e795bedce345aa0477d620acc (patch)
treea560d76f3f26c445e45412158edfd35893ece6e4 /src/main
parentfdbdcc4bbfd0282191b3e82dd8042a06a9a85a72 (diff)
downloadarchitectury-loom-b1ae5dee5d12de6e795bedce345aa0477d620acc.tar.gz
architectury-loom-b1ae5dee5d12de6e795bedce345aa0477d620acc.tar.bz2
architectury-loom-b1ae5dee5d12de6e795bedce345aa0477d620acc.zip
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.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/net/fabricmc/loom/task/AbstractLoomTask.java2
-rw-r--r--src/main/java/net/fabricmc/loom/util/GradleSupport.java25
2 files changed, 17 insertions, 10 deletions
diff --git a/src/main/java/net/fabricmc/loom/task/AbstractLoomTask.java b/src/main/java/net/fabricmc/loom/task/AbstractLoomTask.java
index e62173d1..9dada304 100644
--- a/src/main/java/net/fabricmc/loom/task/AbstractLoomTask.java
+++ b/src/main/java/net/fabricmc/loom/task/AbstractLoomTask.java
@@ -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);
}
diff --git a/src/main/java/net/fabricmc/loom/util/GradleSupport.java b/src/main/java/net/fabricmc/loom/util/GradleSupport.java
index f205209d..caf35cef 100644
--- a/src/main/java/net/fabricmc/loom/util/GradleSupport.java
+++ b/src/main/java/net/fabricmc/loom/util/GradleSupport.java
@@ -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");
- method.setAccessible(true);
- return (RegularFileProperty) method.invoke(objectFactory);
+ private static RegularFileProperty getfilePropertyModern(Project project) throws Exception {
+ return getfilePropertyLegacyFromObject(project.getObjects());
}
- private static RegularFileProperty getfilePropertyLegacy(Project project) {
- return project.getLayout().fileProperty();
+ 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(object);
}
}