-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix]: Feature/primary sourceset selector (#216)
- Loading branch information
1 parent
465aaa4
commit 4c76373
Showing
10 changed files
with
181 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 0 additions & 55 deletions
55
common/src/main/java/net/neoforged/gradle/common/runs/tasks/RunExec.java
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
common/src/main/java/net/neoforged/gradle/common/util/ClasspathUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package net.neoforged.gradle.common.util; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.zip.ZipFile; | ||
|
||
/** | ||
* Utility class for dealing with classpaths and their entries. | ||
*/ | ||
public class ClasspathUtils { | ||
|
||
private ClasspathUtils() { | ||
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated."); | ||
} | ||
|
||
public static boolean isClasspathEntry(File entry) { | ||
return entry.getName().endsWith(".jar") || entry.getName().endsWith(".zip"); | ||
} | ||
|
||
public static boolean isMinecraftClasspathEntry(File entry) { | ||
if (!isClasspathEntry(entry)) { | ||
return false; | ||
} | ||
|
||
//Check if the file contains the class: | ||
//net.minecraft.client.Minecraft | ||
//This is a class that is always present in the Minecraft jar. | ||
//This same heuristic is used by FML: https://github.com/neoforged/FancyModLoader/blob/89a32f970ba9137cb74e681af9cdaed0fc3e2085/loader/src/main/java/net/neoforged/fml/loading/targets/CommonUserdevLaunchHandler.java#L24 | ||
try(final ZipFile zipFile = new ZipFile(entry)) { | ||
return zipFile.getEntry("net/minecraft/client/Minecraft.class") != null; | ||
} catch (IOException ignored) { | ||
return false; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.