Skip to content

Commit 53e5ba4

Browse files
committed
normalized arch name (matching arch for for ci)
1 parent 9067271 commit 53e5ba4

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

lib-extra/src/main/java/com/diffplug/spotless/extra/npm/NpmFormatterStepStateBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected File nodeModulePath() {
9292
}
9393

9494
private String j2v8MavenCoordinate() {
95-
return "com.eclipsesource.j2v8:j2v8_" + PlatformInfo.normalizedOSName() + "_" + PlatformInfo.archName() + ":4.6.0";
95+
return "com.eclipsesource.j2v8:j2v8_" + PlatformInfo.normalizedOSName() + "_" + PlatformInfo.normalizedArchName() + ":4.6.0";
9696
}
9797

9898
protected static String readFileFromClasspath(Class<?> clazz, String name) {

lib-extra/src/main/java/com/diffplug/spotless/extra/npm/PlatformInfo.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,19 @@ static String normalizedOSName() {
4343
throw new RuntimeException("Cannot handle os " + osNameProperty);
4444
}
4545

46-
static String archName() {
47-
return Optional.ofNullable(StandardSystemProperty.OS_ARCH.value())
48-
.orElseThrow(() -> new RuntimeException("Arch not detectable."));
46+
static String normalizedArchName() {
47+
final String osArchProperty = StandardSystemProperty.OS_ARCH.value();
48+
if (osArchProperty == null) {
49+
throw new RuntimeException("No info about ARCH available, cannot decide which implementation of j2v8 to use");
50+
}
51+
final String normalizedOsArch = osArchProperty.toLowerCase(Locale.ENGLISH);
52+
53+
if (normalizedOsArch.contains("64")) {
54+
return "x86_64";
55+
}
56+
if (normalizedOsArch.contains("x86") || normalizedOsArch.contains("32")) {
57+
return "x86";
58+
}
59+
throw new RuntimeException("Cannot handle arch " + osArchProperty);
4960
}
5061
}

0 commit comments

Comments
 (0)