Skip to content

Commit

Permalink
Added UNSUPPORTED operating system and architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
cowwoc committed Nov 4, 2023
1 parent 1165ff9 commit cba370a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 42 deletions.
4 changes: 2 additions & 2 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.0/apache-maven-3.9.0-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ public String getClassifier()
}

/**
* Returns the fully-qualified path of the executable.
* Returns the fully qualified path of the executable.
*
* @param filename the filename of a binary
* @param path the {@code PATH} environment variable
* @return the fully-qualified path of the executable
* @return the fully qualified path of the executable
* @throws NullPointerException if any of the arguments are null
* @throws FileNotFoundException if the binary could not be found
*/
Expand All @@ -98,7 +98,7 @@ public Path getExecutableOnPath(String filename, String path) throws FileNotFoun
throw new NullPointerException("filename may not be null");
if (path == null)
throw new NullPointerException("path may not be null");
// Per https://stackoverflow.com/a/34061154/14731 it's easier to invoke a fully-qualified path
// Per https://stackoverflow.com/a/34061154/14731 it's easier to invoke a fully qualified path
// than trying to quote command-line arguments properly.
// https://stackoverflow.com/a/32827512/14731 shows how this can be done.
String suffix = getExecutableSuffix();
Expand Down Expand Up @@ -292,7 +292,11 @@ public enum Architecture
/**
* ARM, 64-bit.
*/
ARM_64;
ARM_64,
/**
* Unsupported architecture.
*/
UNSUPPORTED;

private static final Reference<Architecture> DETECTED = ConcurrentLazyReference.create(() ->
{
Expand All @@ -318,12 +322,10 @@ public enum Architecture
case "arm":
case "arm32":
return ARM_32;
case "arm64":
case "aarch64":
return ARM_64;
default:
throw new AssertionError("Unsupported architecture: " + osArch + "\n" +
"properties: " + System.getProperties());
return UNSUPPORTED;
}
});

Expand Down Expand Up @@ -361,25 +363,15 @@ String getEnvironmentCanonicalName(Map<String, String> environment, String name)
/**
* Linux.
*/
LINUX
{
@Override
String getEnvironmentCanonicalName(Map<String, String> environment, String name)
{
return name;
}
},
LINUX,
/**
* macOS.
*/
MAC
{
@Override
String getEnvironmentCanonicalName(Map<String, String> environment, String name)
{
return name;
}
};
MAC,
/**
* Unsupported operating system.
*/
UNSUPPORTED;

private static final Reference<Type> DETECTED = ConcurrentLazyReference.create(() ->
{
Expand All @@ -390,8 +382,7 @@ String getEnvironmentCanonicalName(Map<String, String> environment, String name)
return LINUX;
if (startsWithIgnoreCase(osName, "mac"))
return MAC;
throw new AssertionError("Unsupported operating system: " + osName + "\n" +
"properties: " + System.getProperties());
return UNSUPPORTED;
});

/**
Expand Down Expand Up @@ -420,6 +411,9 @@ private static boolean startsWithIgnoreCase(String str, String prefix)
* @param name an environment variable
* @return the case-sensitive form of the variable
*/
abstract String getEnvironmentCanonicalName(Map<String, String> environment, String name);
String getEnvironmentCanonicalName(Map<String, String> environment, String name)
{
return name;
}
}
}
}
26 changes: 13 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.version>3.9.0</maven.version>
<maven.version>3.9.5</maven.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.core.version>3.9.0</maven.core.version>
<maven.core.version>3.9.5</maven.core.version>
</properties>

<distributionManagement>
Expand All @@ -61,12 +61,12 @@
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.9.0</version>
<version>3.10.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.23.0</version>
<version>1.24.0</version>
</dependency>
<dependency>
<groupId>com.github.cowwoc.pouch</groupId>
Expand All @@ -86,7 +86,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.2-jre</version>
<version>32.1.3-jre</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand All @@ -96,7 +96,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.3.0</version>
<version>3.4.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -111,7 +111,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.5.0</version>
<version>3.6.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -121,7 +121,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.9.0</version>
<version>3.10.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -131,7 +131,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.0</version>
<version>3.6.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -141,7 +141,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.3.1</version>
<version>3.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -156,7 +156,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>4.0.0-M9</version>
<version>4.0.0-M11</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -179,7 +179,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.3.0</version>
<version>3.4.1</version>
<executions>
<execution>
<id>enforce-maven</id>
Expand Down Expand Up @@ -433,7 +433,7 @@
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.5.0</version>
<version>3.6.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down

0 comments on commit cba370a

Please sign in to comment.