mirror of https://github.com/grpc/grpc-java.git
Merge 44786b477e
into d352540a02
This commit is contained in:
commit
caa09b5059
|
@ -47,21 +47,11 @@ dependencies {
|
|||
classifier = "linux-aarch_64"
|
||||
}
|
||||
}
|
||||
testRuntimeOnly (libraries.netty.tcnative) {
|
||||
artifact {
|
||||
classifier = "osx-x86_64"
|
||||
}
|
||||
}
|
||||
testRuntimeOnly (libraries.netty.tcnative) {
|
||||
artifact {
|
||||
classifier = "osx-aarch_64"
|
||||
}
|
||||
}
|
||||
testRuntimeOnly (libraries.netty.tcnative) {
|
||||
artifact {
|
||||
classifier = "windows-x86_64"
|
||||
}
|
||||
}
|
||||
|
||||
signature (libraries.signature.java) {
|
||||
artifact {
|
||||
|
|
|
@ -18,6 +18,7 @@ package io.grpc.s2a;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static com.google.common.base.Strings.isNullOrEmpty;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
@ -52,6 +53,7 @@ public final class S2AChannelCredentials {
|
|||
public static Builder newBuilder(String s2aAddress, ChannelCredentials s2aChannelCredentials) {
|
||||
checkArgument(!isNullOrEmpty(s2aAddress), "S2A address must not be null or empty.");
|
||||
checkNotNull(s2aChannelCredentials, "S2A channel credentials must not be null");
|
||||
checkState(isPlatformSupported(), "S2A is not suported on Windows or MacOS Intel");
|
||||
return new Builder(s2aAddress, s2aChannelCredentials);
|
||||
}
|
||||
|
||||
|
@ -131,5 +133,20 @@ public final class S2AChannelCredentials {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* S2A has a runtime dependency on netty-tcnative. This function returns true
|
||||
* if netty-tcnative is supported on the current platform.
|
||||
*
|
||||
* @return whether S2A is supported on current platform
|
||||
*/
|
||||
private static boolean isPlatformSupported() {
|
||||
if (System.getProperty("os.name").contains("Windows")
|
||||
|| (System.getProperty("os.name").contains("OS X")
|
||||
&& System.getProperty("os.arch").contains("x86_64"))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private S2AChannelCredentials() {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue