org.graalvm.nativeimage
diff --git a/native-image-support/src/main/java/com/google/cloud/nativeimage/features/GoogleJsonClientFeature.java b/native-image-support/src/main/java/com/google/cloud/nativeimage/features/GoogleJsonClientFeature.java
deleted file mode 100644
index 8cc3107f4e..0000000000
--- a/native-image-support/src/main/java/com/google/cloud/nativeimage/features/GoogleJsonClientFeature.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2022 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.cloud.nativeimage.features;
-
-import static com.google.cloud.nativeimage.features.NativeImageUtils.registerClassForReflection;
-
-import com.oracle.svm.core.annotate.AutomaticFeature;
-import com.oracle.svm.core.configure.ResourcesRegistry;
-import org.graalvm.nativeimage.ImageSingletons;
-import org.graalvm.nativeimage.hosted.Feature;
-
-/** Configures Native Image settings for the Google JSON Client. */
-@AutomaticFeature
-final class GoogleJsonClientFeature implements Feature {
-
- private static final String GOOGLE_API_CLIENT_CLASS =
- "com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient";
-
- private static final String GOOGLE_API_CLIENT_REQUEST_CLASS =
- "com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest";
-
- private static final String GENERIC_JSON_CLASS = "com.google.api.client.json.GenericJson";
-
- @Override
- public void beforeAnalysis(BeforeAnalysisAccess access) {
- loadApiClient(access);
- loadHttpClient(access);
- loadMiscClasses(access);
- }
-
- private void loadApiClient(BeforeAnalysisAccess access) {
- // For com.google.api-client:google-api-client
- Class> googleApiClientClass = access.findClassByName(GOOGLE_API_CLIENT_CLASS);
-
- if (googleApiClientClass != null) {
- // All reachable instances of the AbstractGoogleJsonClient must be registered.
- access.registerSubtypeReachabilityHandler(
- (duringAccess, subtype) -> registerClassForReflection(access, subtype.getName()),
- googleApiClientClass);
-
- // All reachable instances of the AbstractGoogleJsonClientRequest must be registered.
- access.registerSubtypeReachabilityHandler(
- (duringAccess, subtype) -> registerClassForReflection(access, subtype.getName()),
- access.findClassByName(GOOGLE_API_CLIENT_REQUEST_CLASS));
-
- // Resources
- ResourcesRegistry resourcesRegistry = ImageSingletons.lookup(ResourcesRegistry.class);
- resourcesRegistry.addResources(
- "\\Qcom/google/api/client/googleapis/google-api-client.properties\\E");
- resourcesRegistry.addResources("\\Qcom/google/api/client/googleapis/google.p12\\E");
- resourcesRegistry.addResources(
- "\\Qcom/google/api/client/http/google-http-client.properties\\E");
- }
- }
-
- private void loadHttpClient(BeforeAnalysisAccess access) {
- // For com.google.http-client:google-http-client
- Class> genericJsonClass = access.findClassByName(GENERIC_JSON_CLASS);
-
- if (genericJsonClass != null) {
- // All reachable instances of GenericJson must be registered.
- access.registerSubtypeReachabilityHandler(
- (duringAccess, subtype) -> registerClassForReflection(access, subtype.getName()),
- genericJsonClass);
-
- registerClassForReflection(access, "com.google.api.client.util.GenericData");
- registerClassForReflection(access, "com.google.api.client.json.webtoken.JsonWebToken");
- registerClassForReflection(access, "com.google.api.client.json.webtoken.JsonWebToken$Header");
- registerClassForReflection(
- access, "com.google.api.client.json.webtoken.JsonWebToken$Payload");
- registerClassForReflection(
- access, "com.google.api.client.json.webtoken.JsonWebSignature$Header");
- registerClassForReflection(access, "com.google.api.client.json.webtoken.JsonWebSignature");
- registerClassForReflection(access, "com.google.api.client.http.UrlEncodedContent");
- registerClassForReflection(access, "com.google.api.client.http.GenericUrl");
- registerClassForReflection(access, "com.google.api.client.http.HttpRequest");
- registerClassForReflection(access, "com.google.api.client.http.HttpHeaders");
- }
- }
-
- private void loadMiscClasses(BeforeAnalysisAccess access) {
- registerClassForReflection(access, "com.google.common.util.concurrent.AbstractFuture");
- registerClassForReflection(access, "com.google.common.util.concurrent.AbstractFuture$Waiter");
- }
-}
diff --git a/native-image-support/src/main/java/com/google/cloud/nativeimage/features/GrpcNettyFeature.java b/native-image-support/src/main/java/com/google/cloud/nativeimage/features/GrpcNettyFeature.java
deleted file mode 100644
index 754f9005e2..0000000000
--- a/native-image-support/src/main/java/com/google/cloud/nativeimage/features/GrpcNettyFeature.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright 2022 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.cloud.nativeimage.features;
-
-import static com.google.cloud.nativeimage.features.NativeImageUtils.registerClassForReflection;
-import static com.google.cloud.nativeimage.features.NativeImageUtils.registerClassHierarchyForReflection;
-import static com.google.cloud.nativeimage.features.NativeImageUtils.registerForReflectiveInstantiation;
-import static com.google.cloud.nativeimage.features.NativeImageUtils.registerForUnsafeFieldAccess;
-
-import com.oracle.svm.core.annotate.AutomaticFeature;
-import org.graalvm.nativeimage.hosted.Feature;
-
-/** Configures Native Image settings for the grpc-netty-shaded dependency. */
-@AutomaticFeature
-final class GrpcNettyFeature implements Feature {
-
- private static final String GRPC_NETTY_SHADED_CLASS =
- "io.grpc.netty.shaded.io.grpc.netty.NettyServer";
-
- private static final String GOOGLE_AUTH_CLASS =
- "com.google.auth.oauth2.ServiceAccountCredentials";
-
- @Override
- public void beforeAnalysis(BeforeAnalysisAccess access) {
- loadGoogleAuthClasses(access);
- loadGrpcNettyClasses(access);
- loadMiscClasses(access);
- }
-
- private static void loadGoogleAuthClasses(BeforeAnalysisAccess access) {
- // For com.google.auth:google-auth-library-oauth2-http
- Class> authClass = access.findClassByName(GOOGLE_AUTH_CLASS);
- if (authClass != null) {
- registerClassHierarchyForReflection(
- access, "com.google.auth.oauth2.ServiceAccountCredentials");
- registerClassHierarchyForReflection(
- access, "com.google.auth.oauth2.ServiceAccountJwtAccessCredentials");
- }
- }
-
- private static void loadGrpcNettyClasses(BeforeAnalysisAccess access) {
- // For io.grpc:grpc-netty-shaded
- Class> nettyShadedClass = access.findClassByName(GRPC_NETTY_SHADED_CLASS);
- if (nettyShadedClass != null) {
- // Misc. classes used by grpc-netty-shaded
- registerForReflectiveInstantiation(
- access, "io.grpc.netty.shaded.io.netty.channel.socket.nio.NioSocketChannel");
- registerClassForReflection(
- access, "io.grpc.netty.shaded.io.netty.util.internal.NativeLibraryUtil");
- registerClassForReflection(access, "io.grpc.netty.shaded.io.netty.util.ReferenceCountUtil");
- registerClassForReflection(
- access, "io.grpc.netty.shaded.io.netty.buffer.AbstractByteBufAllocator");
-
- // Epoll Libraries
- registerClassForReflection(access, "io.grpc.netty.shaded.io.netty.channel.epoll.Epoll");
- registerClassForReflection(
- access, "io.grpc.netty.shaded.io.netty.channel.epoll.EpollChannelOption");
- registerClassForReflection(
- access, "io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoopGroup");
- registerForReflectiveInstantiation(
- access, "io.grpc.netty.shaded.io.netty.channel.epoll.EpollServerSocketChannel");
- registerForReflectiveInstantiation(
- access, "io.grpc.netty.shaded.io.netty.channel.epoll.EpollSocketChannel");
-
- // Unsafe field accesses
- registerForUnsafeFieldAccess(
- access,
- "io.grpc.netty.shaded.io.netty.util.internal.shaded."
- + "org.jctools.queues.MpscArrayQueueProducerIndexField",
- "producerIndex");
- registerForUnsafeFieldAccess(
- access,
- "io.grpc.netty.shaded.io.netty.util.internal.shaded."
- + "org.jctools.queues.MpscArrayQueueProducerLimitField",
- "producerLimit");
- registerForUnsafeFieldAccess(
- access,
- "io.grpc.netty.shaded.io.netty.util.internal.shaded."
- + "org.jctools.queues.MpscArrayQueueConsumerIndexField",
- "consumerIndex");
- registerForUnsafeFieldAccess(
- access,
- "io.grpc.netty.shaded.io.netty.util.internal.shaded."
- + "org.jctools.queues.BaseMpscLinkedArrayQueueProducerFields",
- "producerIndex");
- registerForUnsafeFieldAccess(
- access,
- "io.grpc.netty.shaded.io.netty.util.internal.shaded."
- + "org.jctools.queues.BaseMpscLinkedArrayQueueColdProducerFields",
- "producerLimit");
- registerForUnsafeFieldAccess(
- access,
- "io.grpc.netty.shaded.io.netty.util.internal.shaded."
- + "org.jctools.queues.BaseMpscLinkedArrayQueueConsumerFields",
- "consumerIndex");
- }
- }
-
- /** Miscellaneous classes that need to be registered coming from various JARs. */
- private static void loadMiscClasses(BeforeAnalysisAccess access) {
- registerClassHierarchyForReflection(access, "com.google.protobuf.DescriptorProtos");
- registerClassForReflection(access, "com.google.api.FieldBehavior");
-
- registerForUnsafeFieldAccess(access, "javax.net.ssl.SSLContext", "contextSpi");
- registerClassForReflection(access, "java.lang.management.ManagementFactory");
- registerClassForReflection(access, "java.lang.management.RuntimeMXBean");
- }
-}
diff --git a/native-image-support/src/main/java/com/google/cloud/nativeimage/features/ProtobufMessageFeature.java b/native-image-support/src/main/java/com/google/cloud/nativeimage/features/ProtobufMessageFeature.java
deleted file mode 100644
index 40251e85e4..0000000000
--- a/native-image-support/src/main/java/com/google/cloud/nativeimage/features/ProtobufMessageFeature.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2022 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.cloud.nativeimage.features;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.List;
-import org.graalvm.nativeimage.hosted.Feature;
-import org.graalvm.nativeimage.hosted.RuntimeReflection;
-
-/**
- * A optional feature which registers reflective usages of the GRPC Protobuf libraries.
- *
- * This feature is only needed if you need to access proto objects reflectively (such as
- * printing/logging proto objects).
- *
- *
To add this feature, add "--feature
- * com.google.cloud.nativeimage.features.ProtobufMessageFeature" to your GraalVM configuration.
- */
-final class ProtobufMessageFeature implements Feature {
-
- // Proto classes to check on the classpath.
- private static final String PROTO_MESSAGE_CLASS = "com.google.protobuf.GeneratedMessageV3";
- private static final String PROTO_ENUM_CLASS = "com.google.protobuf.ProtocolMessageEnum";
- private static final String ENUM_VAL_DESCRIPTOR_CLASS =
- "com.google.protobuf.Descriptors$EnumValueDescriptor";
-
- // Prefixes of methods accessed reflectively by
- // com.google.protobuf.GeneratedMessageV3$ReflectionInvoker
- private static final List METHOD_ACCESSOR_PREFIXES =
- Arrays.asList("get", "set", "has", "add", "clear", "newBuilder");
-
- @Override
- public void beforeAnalysis(BeforeAnalysisAccess access) {
- Class> protoMessageClass = access.findClassByName(PROTO_MESSAGE_CLASS);
- if (protoMessageClass != null) {
- Method internalAccessorMethod =
- NativeImageUtils.getMethodOrFail(protoMessageClass, "internalGetFieldAccessorTable");
-
- // Finds every class whose `internalGetFieldAccessorTable()` is reached and registers it.
- // `internalGetFieldAccessorTable()` is used downstream to access the class reflectively.
- access.registerMethodOverrideReachabilityHandler(
- (duringAccess, method) -> {
- registerFieldAccessors(method.getDeclaringClass());
- registerFieldAccessors(getBuilderClass(method.getDeclaringClass()));
- },
- internalAccessorMethod);
- }
-
- Class> protoEnumClass = access.findClassByName(PROTO_ENUM_CLASS);
- if (protoEnumClass != null) {
- // Finds every reachable proto enum class and registers specific methods for reflection.
- access.registerSubtypeReachabilityHandler(
- (duringAccess, subtypeClass) -> {
- if (!PROTO_ENUM_CLASS.equals(subtypeClass.getName())) {
- Method method =
- NativeImageUtils.getMethodOrFail(
- subtypeClass,
- "valueOf",
- duringAccess.findClassByName(ENUM_VAL_DESCRIPTOR_CLASS));
- RuntimeReflection.register(method);
-
- method = NativeImageUtils.getMethodOrFail(subtypeClass, "getValueDescriptor");
- RuntimeReflection.register(method);
- }
- },
- protoEnumClass);
- }
- }
-
- /** Given a proto class, registers the public accessor methods for the provided proto class. */
- private static void registerFieldAccessors(Class> protoClass) {
- for (Method method : protoClass.getMethods()) {
- boolean hasAccessorPrefix =
- METHOD_ACCESSOR_PREFIXES.stream().anyMatch(prefix -> method.getName().startsWith(prefix));
- if (hasAccessorPrefix) {
- RuntimeReflection.register(method);
- }
- }
- }
-
- /** Given a proto class, returns the Builder nested class. */
- private static Class> getBuilderClass(Class> protoClass) {
- for (Class> clazz : protoClass.getClasses()) {
- if (clazz.getName().endsWith("Builder")) {
- return clazz;
- }
- }
- return null;
- }
-}
diff --git a/native-image-support/src/main/java/com/google/cloud/nativeimage/features/clients/OpenCensusFeature.java b/native-image-support/src/main/java/com/google/cloud/nativeimage/features/clients/OpenCensusFeature.java
deleted file mode 100644
index e718f28567..0000000000
--- a/native-image-support/src/main/java/com/google/cloud/nativeimage/features/clients/OpenCensusFeature.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2022 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.cloud.nativeimage.features.clients;
-
-import static com.google.cloud.nativeimage.features.NativeImageUtils.registerForReflectiveInstantiation;
-
-import com.oracle.svm.core.annotate.AutomaticFeature;
-import org.graalvm.nativeimage.hosted.Feature;
-
-/** Registers reflection usage in OpenCensus libraries. */
-@AutomaticFeature
-final class OpenCensusFeature implements Feature {
-
- private static final String TAGS_COMPONENT_CLASS = "io.opencensus.impl.tags.TagsComponentImpl";
- private static final String STATS_COMPONENT_CLASS = "io.opencensus.impl.stats.StatsComponentImpl";
-
- @Override
- public void beforeAnalysis(BeforeAnalysisAccess access) {
- if (access.findClassByName(STATS_COMPONENT_CLASS) != null) {
- registerForReflectiveInstantiation(access, STATS_COMPONENT_CLASS);
- }
- if (access.findClassByName(TAGS_COMPONENT_CLASS) != null) {
- registerForReflectiveInstantiation(access, "io.opencensus.impl.metrics.MetricsComponentImpl");
- registerForReflectiveInstantiation(access, "io.opencensus.impl.tags.TagsComponentImpl");
- registerForReflectiveInstantiation(access, "io.opencensus.impl.trace.TraceComponentImpl");
- }
- }
-}
diff --git a/native-image-support/src/main/java/com/google/cloud/nativeimage/features/clients/SpannerFeature.java b/native-image-support/src/main/java/com/google/cloud/nativeimage/features/clients/SpannerFeature.java
index 7c9fca1421..956f368dac 100644
--- a/native-image-support/src/main/java/com/google/cloud/nativeimage/features/clients/SpannerFeature.java
+++ b/native-image-support/src/main/java/com/google/cloud/nativeimage/features/clients/SpannerFeature.java
@@ -29,6 +29,7 @@ final class SpannerFeature implements Feature {
private static final String SPANNER_CLASS = "com.google.spanner.v1.SpannerGrpc";
private static final String SPANNER_TEST_CLASS = "com.google.cloud.spanner.GceTestEnvConfig";
+ private static final String MOCK_CLASS = "com.google.cloud.spanner.MockDatabaseAdminServiceImpl";
private static final String CLIENT_SIDE_IMPL_CLASS =
"com.google.cloud.spanner.connection.ClientSideStatementImpl";
private static final String CLIENT_SIDE_VALUE_CONVERTER =
@@ -50,10 +51,7 @@ final class SpannerFeature implements Feature {
@Override
public void beforeAnalysis(BeforeAnalysisAccess access) {
- Class> spannerTestClass = access.findClassByName(SPANNER_TEST_CLASS);
- if (spannerTestClass != null) {
- NativeImageUtils.registerConstructorsForReflection(access, SPANNER_TEST_CLASS);
- }
+ registerSpannerTestClasses(access);
if (access.findClassByName(CLIENT_SIDE_IMPL_CLASS) != null) {
NativeImageUtils.registerClassHierarchyForReflection(access, CLIENT_SIDE_IMPL_CLASS);
}
@@ -103,4 +101,16 @@ public void beforeAnalysis(BeforeAnalysisAccess access) {
"\\Qcom/google/cloud/spanner/connection/ITSqlScriptTest_TestQueryOptions.sql\\E");
}
}
+
+ private void registerSpannerTestClasses(BeforeAnalysisAccess access) {
+ Class> spannerTestClass = access.findClassByName(SPANNER_TEST_CLASS);
+ if (spannerTestClass != null) {
+ NativeImageUtils.registerConstructorsForReflection(access, SPANNER_TEST_CLASS);
+ }
+ Class> mockClass = access.findClassByName(MOCK_CLASS);
+ if (mockClass != null) {
+ NativeImageUtils.registerClassForReflection(
+ access, "com.google.cloud.spanner.MockDatabaseAdminServiceImpl$MockBackup");
+ }
+ }
}
diff --git a/native-image-support/src/main/java/com/google/cloud/nativeimage/features/substitutions/ApiClientVersionSubstitutions.java b/native-image-support/src/main/java/com/google/cloud/nativeimage/features/substitutions/ApiClientVersionSubstitutions.java
deleted file mode 100644
index c170c2ea7a..0000000000
--- a/native-image-support/src/main/java/com/google/cloud/nativeimage/features/substitutions/ApiClientVersionSubstitutions.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2022 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.cloud.nativeimage.features.substitutions;
-
-import com.oracle.svm.core.annotate.Alias;
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import java.util.function.BooleanSupplier;
-
-/** Substitution for setting Java version correctly in the Google Java Http Client. */
-@TargetClass(
- className =
- "com.google.api.client.googleapis.services.AbstractGoogleClientRequest$ApiClientVersion",
- onlyWith = ApiClientVersionSubstitutions.OnlyIfInClassPath.class)
-final class ApiClientVersionSubstitutions {
-
- @Alias private String versionString;
-
- @Substitute
- public String toString() {
- String[] tokens = versionString.split(" ");
-
- if (tokens.length > 0 && tokens[0].startsWith("gl-java")) {
- tokens[0] += "-graalvm";
- return String.join(" ", tokens);
- } else {
- return versionString;
- }
- }
-
- private ApiClientVersionSubstitutions() {}
-
- static class OnlyIfInClassPath implements BooleanSupplier {
-
- @Override
- public boolean getAsBoolean() {
- try {
- // Note: Set initialize = false to avoid initializing the class when looking it up.
- Class.forName(
- "com.google.api.client.googleapis.services."
- + "AbstractGoogleClientRequest$ApiClientVersion",
- false,
- Thread.currentThread().getContextClassLoader());
- return true;
- } catch (ClassNotFoundException e) {
- return false;
- }
- }
- }
-}
diff --git a/native-image-support/src/main/java/com/google/cloud/nativeimage/features/substitutions/GaxPropertiesSubstitutions.java b/native-image-support/src/main/java/com/google/cloud/nativeimage/features/substitutions/GaxPropertiesSubstitutions.java
deleted file mode 100644
index 54245a8ee8..0000000000
--- a/native-image-support/src/main/java/com/google/cloud/nativeimage/features/substitutions/GaxPropertiesSubstitutions.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2022 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.cloud.nativeimage.features.substitutions;
-
-import com.oracle.svm.core.annotate.Alias;
-import com.oracle.svm.core.annotate.RecomputeFieldValue;
-import com.oracle.svm.core.annotate.RecomputeFieldValue.Kind;
-import com.oracle.svm.core.annotate.TargetClass;
-import java.util.function.BooleanSupplier;
-
-/**
- * This file contains the GaxProperties substitution to correctly set the Java language string in
- * API call headers for Native Image users.
- */
-@TargetClass(
- className = "com.google.api.gax.core.GaxProperties",
- onlyWith = GaxPropertiesSubstitutions.OnlyIfInClassPath.class)
-final class GaxPropertiesSubstitutions {
-
- @Alias
- @RecomputeFieldValue(kind = Kind.FromAlias)
- private static String JAVA_VERSION = System.getProperty("java.version") + "-graalvm";
-
- private GaxPropertiesSubstitutions() {}
-
- static class OnlyIfInClassPath implements BooleanSupplier {
-
- @Override
- public boolean getAsBoolean() {
- try {
- // Note: Set initialize = false to avoid initializing the class when looking it up.
- Class.forName(
- "com.google.api.gax.core.GaxProperties",
- false,
- Thread.currentThread().getContextClassLoader());
- return true;
- } catch (ClassNotFoundException e) {
- return false;
- }
- }
- }
-}
diff --git a/native-image-support/src/main/java/com/google/cloud/nativeimage/features/substitutions/NettyInternalLoggerFactorySubstitutions.java b/native-image-support/src/main/java/com/google/cloud/nativeimage/features/substitutions/NettyInternalLoggerFactorySubstitutions.java
deleted file mode 100644
index 7fcea16318..0000000000
--- a/native-image-support/src/main/java/com/google/cloud/nativeimage/features/substitutions/NettyInternalLoggerFactorySubstitutions.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2022 Google LLC
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.cloud.nativeimage.features.substitutions;
-
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import io.grpc.netty.shaded.io.netty.util.internal.logging.InternalLoggerFactory;
-import io.grpc.netty.shaded.io.netty.util.internal.logging.JdkLoggerFactory;
-import java.util.function.BooleanSupplier;
-
-/**
- * Substitutions for {@link InternalLoggerFactory} which are needed to avoid dynamic loading of
- * logging library.
- */
-@TargetClass(
- className = "io.grpc.netty.shaded.io.netty.util.internal.logging.InternalLoggerFactory",
- onlyWith = NettyInternalLoggerFactorySubstitutions.OnlyIfInClassPath.class)
-final class NettyInternalLoggerFactorySubstitutions {
-
- @Substitute
- private static InternalLoggerFactory newDefaultFactory(String name) {
- return JdkLoggerFactory.INSTANCE;
- }
-
- static class OnlyIfInClassPath implements BooleanSupplier {
-
- @Override
- public boolean getAsBoolean() {
- try {
- // Note: Set initialize = false to avoid initializing the class when looking it up.
- Class.forName(
- "io.grpc.netty.shaded.io.netty.util.internal.logging.InternalLoggerFactory",
- false,
- Thread.currentThread().getContextClassLoader());
- return true;
- } catch (ClassNotFoundException e) {
- return false;
- }
- }
- }
-}
diff --git a/native-image-support/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-core/native-image.properties b/native-image-support/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-core/native-image.properties
index 2228a1f094..5ce9338cff 100644
--- a/native-image-support/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-core/native-image.properties
+++ b/native-image-support/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-core/native-image.properties
@@ -1,18 +1,2 @@
-Args = --allow-incomplete-classpath \
---enable-url-protocols=https,http \
---initialize-at-build-time=org.conscrypt,\
- org.slf4j.LoggerFactory,\
- org.junit.platform.engine.TestTag,\
- com.google.cloud.spanner.IntegrationTestEnv \
---initialize-at-run-time=io.grpc.netty.shaded.io.netty.handler.ssl.OpenSsl,\
- io.grpc.netty.shaded.io.netty.internal.tcnative.SSL,\
- io.grpc.netty.shaded.io.netty.internal.tcnative.CertificateVerifier,\
- io.grpc.netty.shaded.io.netty.internal.tcnative.SSLPrivateKeyMethod,\
- io.grpc.netty.shaded.io.netty.internal.tcnative.AsyncSSLPrivateKeyMethod,\
- io.grpc.netty.shaded.io.grpc.netty,\
- io.grpc.netty.shaded.io.netty.channel.epoll,\
- io.grpc.netty.shaded.io.netty.channel.unix,\
- io.grpc.netty.shaded.io.netty.handler.ssl,\
- io.grpc.internal.RetriableStream,\
- com.google.api.client.googleapis.services.AbstractGoogleClientRequest$ApiClientVersion,\
- com.google.cloud.firestore.FirestoreImpl
+Args = --initialize-at-build-time=com.google.cloud.spanner.IntegrationTestEnv \
+--initialize-at-run-time=com.google.cloud.firestore.FirestoreImpl
diff --git a/native-image-support/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-core/resource-config.json b/native-image-support/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-core/resource-config.json
deleted file mode 100644
index 3afe5ffebc..0000000000
--- a/native-image-support/src/main/resources/META-INF/native-image/com.google.cloud/google-cloud-core/resource-config.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "resources":[
- {"pattern":"\\QMETA-INF/native/libio_grpc_netty_shaded_netty_tcnative_linux_x86_64.so\\E"},
- {"pattern":"\\QMETA-INF/native/libio_grpc_netty_shaded_netty_transport_native_epoll_x86_64.so\\E"},
- {"pattern":"\\QMETA-INF/services/io.grpc.LoadBalancerProvider\\E"},
- {"pattern":"\\QMETA-INF/services/io.grpc.ManagedChannelProvider\\E"},
- {"pattern":"\\QMETA-INF/services/io.grpc.NameResolverProvider\\E"},
- {"pattern":"\\QMETA-INF/services/jdk.vm.ci.services.JVMCIServiceLocator\\E"},
- {"pattern":"\\Qdependencies.properties\\E"},
- {"pattern":"\\Qgoogle-http-client.properties\\E"}
- ],
- "bundles":[]
-}
diff --git a/pom.xml b/pom.xml
index b25f8c179b..a1d5a723a0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.google.cloud
google-cloud-core-parent
pom
- 2.5.11
+ 2.6.0
Google Cloud Core Parent
https://github.com/googleapis/java-core
@@ -151,15 +151,15 @@
UTF-8
github
google-cloud-core-parent
- 2.13.0
+ 2.16.0
2.1.5
- 2.8.0
- 1.2.10
+ 2.8.3
+ 1.3.1
1.6.0
- 1.33.4
- 1.41.5
+ 1.34.0
+ 1.41.7
22.0.0.2
- 1.45.0
+ 1.45.1
3.19.4
0.31.0
1.3.2
@@ -170,7 +170,7 @@
3.0.2
1.6.0
3.2
- 2.11.0
+ 2.12.1
2.9.0