Skip to content

Commit

Permalink
#13 improved detection of host os and fixed MAC name for Timurin JDK …
Browse files Browse the repository at this point in the history
…provider
  • Loading branch information
raydac committed Jun 22, 2024
1 parent a94a4c0 commit 5e6e985
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ public Path getPathToJdk(
final String gitRepositoryName =
config.getOrDefault("repositoryName", "temurin" + getRawVersion(jdkVersion) + "-binaries");
final String build = config.get("build");
final String jdkOs = GetUtils.ensureNonNull(config.get("os"), defaultOs.getId());
final String jdkOs =
GetUtils.ensureNonNull(config.get("os"), defaultOs.isMac() ? "mac" : defaultOs.getId());
final String jdkArch = config.get("arch");
final String jdkType = config.get("type");
final String jdkImpl = config.get("impl");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ public String getId() {
public static HostOs findForId(@Nonnull final String id) {
final String normalized = id.toLowerCase(Locale.ENGLISH).trim();
return VALUES.stream().filter(x -> x != UNKNOWN).filter(x -> x.getId().equals(normalized))
.findFirst().orElse(UNKNOWN);
.reduce((a, b) -> b).orElse(UNKNOWN);
}

@Nonnull
public static String makeAllIdAsString() {
return VALUES.stream().filter(x -> x != UNKNOWN).map(x -> x.getId())
return VALUES.stream().filter(x -> x != UNKNOWN).map(HostOs::getId)
.collect(Collectors.joining(","));
}

Expand All @@ -152,4 +152,8 @@ public String getDefaultExtension() {
public boolean isHostOs() {
return this.hostChecker.get();
}

public boolean isMac() {
return this == MAC || this == MAC_OSX;
}
}

0 comments on commit 5e6e985

Please sign in to comment.