From d1300f56bf39636120fa197c1a4256798538a5b3 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Fri, 9 Dec 2022 15:15:37 +0100 Subject: [PATCH] Add reachability metadata for GraphQL client resources This commit adds reachability metadata for resources loaded by the `GraphQlClient` and `GraphQlTester` when using the `document("name")` API variant. This method loads the query file from the classpath at particular locations, namely `"classpath:graphql-documents/"` and `"classpath:graphql-test/"` with the `".graphql"` and `".gql"` file extensions. This commit adds the relevant resource metadata so that such resources are loaded in the GraalVM native image at build time when the client or the tester are reachable through the static analysis. Fixes gh-575 --- .../spring-graphql/resource-config.json | 19 +++++++++++++++++++ .../spring-graphql/resource-config.json | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 spring-graphql-test/src/main/resources/META-INF/native-image/org.springframework.graphql/spring-graphql/resource-config.json create mode 100644 spring-graphql/src/main/resources/META-INF/native-image/org.springframework.graphql/spring-graphql/resource-config.json diff --git a/spring-graphql-test/src/main/resources/META-INF/native-image/org.springframework.graphql/spring-graphql/resource-config.json b/spring-graphql-test/src/main/resources/META-INF/native-image/org.springframework.graphql/spring-graphql/resource-config.json new file mode 100644 index 00000000..45da4e6a --- /dev/null +++ b/spring-graphql-test/src/main/resources/META-INF/native-image/org.springframework.graphql/spring-graphql/resource-config.json @@ -0,0 +1,19 @@ +{ + "bundles": [], + "resources": { + "includes": [ + { + "pattern": "\\Qgraphql-test\/\\E.*\\Q.graphql\\E", + "condition": { + "typeReachable": "org.springframework.graphql.test.tester.GraphQlTester" + } + }, + { + "pattern": "\\Qgraphql-test\/\\E.*\\Q.gql\\E", + "condition": { + "typeReachable": "org.springframework.graphql.test.tester.GraphQlTester" + } + } + ] + } +} \ No newline at end of file diff --git a/spring-graphql/src/main/resources/META-INF/native-image/org.springframework.graphql/spring-graphql/resource-config.json b/spring-graphql/src/main/resources/META-INF/native-image/org.springframework.graphql/spring-graphql/resource-config.json new file mode 100644 index 00000000..c2a276dc --- /dev/null +++ b/spring-graphql/src/main/resources/META-INF/native-image/org.springframework.graphql/spring-graphql/resource-config.json @@ -0,0 +1,19 @@ +{ + "bundles": [], + "resources": { + "includes": [ + { + "pattern": "\\Qgraphql-documents\/\\E.*\\Q.graphql\\E", + "condition": { + "typeReachable": "org.springframework.graphql.client.GraphQlClient" + } + }, + { + "pattern": "\\Qgraphql-documents\/\\E.*\\Q.gql\\E", + "condition": { + "typeReachable": "org.springframework.graphql.client.GraphQlClient" + } + } + ] + } +} \ No newline at end of file