alts: Remove dependency on Apache commons lang

This commit is contained in:
Elliotte Rusty Harold 2021-01-06 18:05:44 +00:00 committed by GitHub
parent edfc0d4d02
commit 43d2e53a2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 8 deletions

View File

@ -47,7 +47,6 @@ java_library(
"@io_netty_netty_common//jar", "@io_netty_netty_common//jar",
"@io_netty_netty_handler//jar", "@io_netty_netty_handler//jar",
"@io_netty_netty_transport//jar", "@io_netty_netty_transport//jar",
"@org_apache_commons_commons_lang3//jar",
], ],
) )

View File

@ -18,7 +18,6 @@ dependencies {
project(':grpc-grpclb'), project(':grpc-grpclb'),
project(':grpc-protobuf'), project(':grpc-protobuf'),
project(':grpc-stub'), project(':grpc-stub'),
libraries.lang,
libraries.protobuf, libraries.protobuf,
libraries.conscrypt libraries.conscrypt
def nettyDependency = implementation project(':grpc-netty') def nettyDependency = implementation project(':grpc-netty')

View File

@ -24,9 +24,9 @@ import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Locale;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.apache.commons.lang3.SystemUtils;
/** Class for checking if the system is running on Google Cloud Platform (GCP). */ /** Class for checking if the system is running on Google Cloud Platform (GCP). */
final class CheckGcpEnvironment { final class CheckGcpEnvironment {
@ -63,13 +63,14 @@ final class CheckGcpEnvironment {
} }
return false; return false;
} }
private static boolean isRunningOnGcp() { private static boolean isRunningOnGcp() {
String osName = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
try { try {
if (SystemUtils.IS_OS_LINUX) { if (osName.startsWith("linux")) {
// Checks GCE residency on Linux platform. // Checks GCE residency on Linux platform.
return checkProductNameOnLinux(Files.newBufferedReader(Paths.get(DMI_PRODUCT_NAME), UTF_8)); return checkProductNameOnLinux(Files.newBufferedReader(Paths.get(DMI_PRODUCT_NAME), UTF_8));
} else if (SystemUtils.IS_OS_WINDOWS) { } else if (osName.startsWith("windows")) {
// Checks GCE residency on Windows platform. // Checks GCE residency on Windows platform.
Process p = Process p =
new ProcessBuilder() new ProcessBuilder()

View File

@ -164,7 +164,6 @@ subprojects {
protobuf: "com.google.protobuf:protobuf-java:${protobufVersion}", protobuf: "com.google.protobuf:protobuf-java:${protobufVersion}",
protobuf_lite: "com.google.protobuf:protobuf-javalite:${protobufVersion}", protobuf_lite: "com.google.protobuf:protobuf-javalite:${protobufVersion}",
protobuf_util: "com.google.protobuf:protobuf-java-util:${protobufVersion}", protobuf_util: "com.google.protobuf:protobuf-java-util:${protobufVersion}",
lang: "org.apache.commons:commons-lang3:3.11",
netty: "io.netty:netty-codec-http2:[${nettyVersion}]", netty: "io.netty:netty-codec-http2:[${nettyVersion}]",
netty_epoll: "io.netty:netty-transport-native-epoll:${nettyVersion}:linux-x86_64", netty_epoll: "io.netty:netty-transport-native-epoll:${nettyVersion}:linux-x86_64",

View File

@ -39,7 +39,6 @@ IO_GRPC_GRPC_JAVA_ARTIFACTS = [
"io.opencensus:opencensus-contrib-grpc-metrics:0.24.0", "io.opencensus:opencensus-contrib-grpc-metrics:0.24.0",
"io.perfmark:perfmark-api:0.23.0", "io.perfmark:perfmark-api:0.23.0",
"junit:junit:4.12", "junit:junit:4.12",
"org.apache.commons:commons-lang3:3.11",
"org.apache.tomcat:annotations-api:6.0.53", "org.apache.tomcat:annotations-api:6.0.53",
"org.codehaus.mojo:animal-sniffer-annotations:1.19", "org.codehaus.mojo:animal-sniffer-annotations:1.19",
] ]