Dont remap dependency sources when building on CI services.

Use `-Dfabric.loom.ci=false` to force disable
dev/0.11
modmuss50 2021-01-19 22:15:23 +00:00
parent 58e94f2db3
commit b622544cbe
3 changed files with 17 additions and 3 deletions

View File

@ -51,6 +51,7 @@ import net.fabricmc.loom.configuration.mods.ModProcessor;
import net.fabricmc.loom.configuration.processors.dependency.ModDependencyInfo;
import net.fabricmc.loom.configuration.processors.dependency.RemapData;
import net.fabricmc.loom.util.Constants;
import net.fabricmc.loom.util.OperatingSystem;
import net.fabricmc.loom.util.SourceRemapper;
@SuppressWarnings("UnstableApiUsage")
@ -96,7 +97,7 @@ public class ModCompileRemapper {
File remappedSources = info.getRemappedOutput("sources");
if (!remappedSources.exists() || refreshDeps) {
if ((!remappedSources.exists() || refreshDeps) && !OperatingSystem.isCIBuild()) {
File sources = findSources(dependencies, artifact);
if (sources != null) {

View File

@ -48,4 +48,15 @@ public class OperatingSystem {
public static boolean is64Bit() {
return System.getProperty("sun.arch.data.model").contains("64");
}
public static boolean isCIBuild() {
String loomProperty = System.getProperty("fabric.loom.ci");
if (loomProperty != null) {
return loomProperty.equalsIgnoreCase("true");
}
// CI seems to be set by most popular CI services
return System.getenv("CI") != null;
}
}

View File

@ -91,10 +91,12 @@ public class SourceRemapper {
}
public void remapAll() {
if (!remapTasks.isEmpty()) {
project.getLogger().lifecycle(":remapping sources");
if (remapTasks.isEmpty()) {
return;
}
project.getLogger().lifecycle(":remapping sources");
ProgressLogger progressLogger = ProgressLogger.getProgressFactory(project, SourceRemapper.class.getName());
progressLogger.start("Remapping dependency sources", "sources");