aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/net/fabricmc/loom
diff options
context:
space:
mode:
authormodmuss50 <modmuss50@gmail.com>2020-12-02 20:18:12 +0000
committermodmuss50 <modmuss50@gmail.com>2020-12-02 20:18:12 +0000
commitdd68c84226443013d3a6a2c62a438304f92b15d4 (patch)
treed554a75b95b25215768e2fcc1981af0fc68f6aac /src/main/java/net/fabricmc/loom
parent98725f9400e1b63f981bff0b3414a6003f34a7e1 (diff)
downloadarchitectury-loom-dd68c84226443013d3a6a2c62a438304f92b15d4.tar.gz
architectury-loom-dd68c84226443013d3a6a2c62a438304f92b15d4.tar.bz2
architectury-loom-dd68c84226443013d3a6a2c62a438304f92b15d4.zip
Allow specifying natives directory with the `fabric.loom.natives.dir` gradle property.
Note this is designed to allow easy usage of custom natives, thus will not populate the directory with the default natives.
Diffstat (limited to 'src/main/java/net/fabricmc/loom')
-rw-r--r--src/main/java/net/fabricmc/loom/LoomGradleExtension.java10
-rw-r--r--src/main/java/net/fabricmc/loom/providers/MinecraftNativesProvider.java8
2 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/net/fabricmc/loom/LoomGradleExtension.java b/src/main/java/net/fabricmc/loom/LoomGradleExtension.java
index 7c086f72..74fa23a8 100644
--- a/src/main/java/net/fabricmc/loom/LoomGradleExtension.java
+++ b/src/main/java/net/fabricmc/loom/LoomGradleExtension.java
@@ -236,6 +236,12 @@ public class LoomGradleExtension {
}
public File getNativesDirectory() {
+ Object customNativesDir = project.getProperties().get("fabric.loom.natives.dir");
+
+ if (customNativesDir != null) {
+ return new File((String) customNativesDir);
+ }
+
File natives = new File(getUserCache(), "natives/" + getMinecraftProvider().getMinecraftVersion());
if (!natives.exists()) {
@@ -245,6 +251,10 @@ public class LoomGradleExtension {
return natives;
}
+ public boolean hasCustomNatives() {
+ return project.getProperties().get("fabric.loom.natives.dir") != null;
+ }
+
public File getDevLauncherConfig() {
return new File(getProjectPersistentCache(), "launch.cfg");
}
diff --git a/src/main/java/net/fabricmc/loom/providers/MinecraftNativesProvider.java b/src/main/java/net/fabricmc/loom/providers/MinecraftNativesProvider.java
index 0a63d2a7..0bec8f9f 100644
--- a/src/main/java/net/fabricmc/loom/providers/MinecraftNativesProvider.java
+++ b/src/main/java/net/fabricmc/loom/providers/MinecraftNativesProvider.java
@@ -45,6 +45,14 @@ public class MinecraftNativesProvider {
File nativesDir = extension.getNativesDirectory();
File jarStore = extension.getNativesJarStore();
+ if (extension.hasCustomNatives()) {
+ if (!nativesDir.exists()) {
+ throw new RuntimeException("Could no find custom natives directory at " + nativesDir.getAbsolutePath());
+ }
+
+ return;
+ }
+
for (MinecraftVersionInfo.Library library : versionInfo.libraries) {
File libJarFile = library.getFile(jarStore);