Skip to content

Commit

Permalink
Fix gradle properties not being read from sub projects correctly. (#941)
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 authored Aug 10, 2023
1 parent cfe72b9 commit ffc786d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/main/java/net/fabricmc/loom/util/gradle/GradleUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,17 @@ public static boolean isLoomProject(Project project) {
}

public static Provider<Boolean> getBooleanPropertyProvider(Project project, String key) {
return project.getProviders().gradleProperty(key).map(string -> {
try {
return Boolean.parseBoolean(string);
} catch (final IllegalArgumentException ex) {
// Works around https://github.com/gradle/gradle/issues/23572
return project.provider(() -> {
final Object value = project.findProperty(key);

if (value instanceof String str) {
try {
return Boolean.parseBoolean(str);
} catch (final IllegalArgumentException ex) {
return false;
}
} else {
return false;
}
});
Expand Down

0 comments on commit ffc786d

Please sign in to comment.