feat: Logging architecture of the users OS.
@@ -9,12 +9,14 @@ package com.synopsys.integration.detect.configuration;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
-import java.util.regex.Pattern;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.synopsys.integration.common.util.Bds;
import com.synopsys.integration.util.OperatingSystemType;
import com.synopsys.integration.util.ResourceUtil;
@@ -27,12 +29,20 @@ public class DetectInfoUtility {
public DetectInfo createDetectInfo() {
String versionText = findDetectVersionFromResources();
- int majorVersion = parseMajorVersion(versionText);
OperatingSystemType os = findOperatingSystemType();
logger.debug(String.format("You seem to be running in a %s operating system.", os));
+ logger.debug(String.format("You seem to be using %s architecture.", StringUtils.join(findArchitectures(), ", ")));
return new DetectInfo(versionText, os);
}
+ public List<String> findArchitectures() {
+ String primaryArchitectureProperty = System.getenv("PROCESSOR_ARCHITECTURE");
+ String secondaryArchitectureProperty = System.getenv("PROCESSOR_ARCHITEW6432");
+ return Bds.of(primaryArchitectureProperty, secondaryArchitectureProperty)
+ .filter(StringUtils::isNotBlank)
+ .toList();
+ }
+
public String findDetectVersionFromResources() {
try {
return ResourceUtil.getResourceAsString(this.getClass(), "/version.txt", StandardCharsets.UTF_8.toString());
@@ -53,8 +63,4 @@ public class DetectInfoUtility {
logger.warn("Your operating system is not supported. Linux will be assumed.");
return OperatingSystemType.LINUX;
}
-
- public int parseMajorVersion(String detectVersionText) {
- return Integer.parseInt(detectVersionText.split(Pattern.quote("."))[0]);
- }
}
