Skip to content

Commit 2ed7557

Browse files
committed
Add net.minecraftforge.gradle.repo.source.force flag, which will force decompile even if the sources artifact is not requested.
1 parent bf61f2e commit 2ed7557

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/common/java/net/minecraftforge/gradle/common/util/EnvironmentChecks.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class EnvironmentChecks {
3434
private static final String INVALIDATE_CACHE_VARIABLE = "net.minecraftforge.gradle.invalidate.cache";
3535
private static final String DEBUG_REPOS_VARIABLE = "net.minecraftforge.gradle.repo.debug";
3636
private static final String ENABLE_SOURCES_VARIABLE = "net.minecraftforge.gradle.repo.sources";
37+
private static final String FORCE_SOURCES_VARIABLE = "net.minecraftforge.gradle.repo.sources.force";
3738
private static final String ENABLE_RECOMPILE_VARIABLE = "net.minecraftforge.gradle.repo.recompile";
3839
private static final String RECOMPILE_ARGS_VARIABLE = "net.minecraftforge.gradle.repo.recompile.args";
3940
private static final String ENABLE_RECOMPILE_FORK_VARIABLE = "net.minecraftforge.gradle.repo.recompile.fork";
@@ -81,6 +82,15 @@ public class EnvironmentChecks {
8182
*/
8283
public static final EnvironmentFlag ENABLE_SOURCES = new EnvironmentFlag(ENABLE_SOURCES_VARIABLE, true);
8384

85+
/**
86+
* Force decompilation when the raw minecraft library is requested. Typically the source is only generated
87+
* when the source artifact is requested. This is useful for dev environments like IDEA who hate to ask for
88+
* the sources.
89+
* <p>
90+
* Environment Flag: {@value #FORCE_SOURCES_VARIABLE}
91+
*/
92+
public static final EnvironmentFlag FORCE_SOURCES = new EnvironmentFlag(FORCE_SOURCES_VARIABLE, false);
93+
8494
/**
8595
* Enables recompiling Minecraft's source into a jar and serving it from the User Repo after the source
8696
* has been requested. You can disable this if you don't care about line numbers matching between source

src/userdev/java/net/minecraftforge/gradle/userdev/MinecraftUserRepo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ private File findRaw(@Nullable String mapping) throws IOException {
574574
return null;
575575
}
576576

577-
File recomp = findRecomp(mapping, false);
577+
File recomp = findRecomp(mapping, EnvironmentChecks.FORCE_SOURCES.isEnabled());
578578
if (recomp != null) {
579579
debug(" Finding Raw: Returning Recomp: " + recomp);
580580
return recomp;

0 commit comments

Comments
 (0)