Skip to content

Commit 84b97ef

Browse files
authored
Git config native-image support (helidon-io#2400)
Git config native-image support Signed-off-by: David Kral <david.k.kral@oracle.com>
1 parent 0dc4d4b commit 84b97ef

8 files changed

Lines changed: 59 additions & 8 deletions

File tree

common/common/src/main/java/io/helidon/common/FeatureCatalog.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,9 @@ final class FeatureCatalog {
304304
.path("Config", "etcd")
305305
.nativeSupported(false));
306306
add("io.helidon.config.git",
307-
FeatureDescriptor.builder()
308-
.name("git")
309-
.description("Config source based on a git repository")
310-
.path("Config", "git")
311-
.nativeSupported(false));
307+
"git",
308+
"Config source based on a git repository",
309+
"Config", "git");
312310
add("io.helidon.config.hocon",
313311
"HOCON",
314312
"HOCON media type support for config",
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"annotated":[
3+
],
4+
"class-hierarchy": [
5+
"org.eclipse.jgit.nls.TranslationBundle"
6+
],
7+
"classes": [
8+
"org.eclipse.jgit.lib.CoreConfig$HideDotFiles",
9+
"org.eclipse.jgit.lib.CoreConfig$AutoCRLF",
10+
"org.eclipse.jgit.lib.CoreConfig$EolStreamType",
11+
"org.eclipse.jgit.lib.CoreConfig$CheckStat",
12+
"org.eclipse.jgit.lib.CoreConfig$SymLinks",
13+
"org.eclipse.jgit.lib.CoreConfig$EOL"
14+
],
15+
"exclude": [
16+
]
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#
2+
# Copyright (c) 2020 Oracle and/or its affiliates.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
Args=--initialize-at-build-time=org.slf4j -H:EnableURLProtocols=https
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
{
3+
"name": "org.eclipse.jgit.internal.JGitText",
4+
"allPublicConstructors": true
5+
}
6+
]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"bundles": [
3+
{
4+
"name": "org.eclipse.jgit.internal.JGitText"
5+
}
6+
]
7+
}

docs/se/aot/01_introduction.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ for native image.
5050
|✅ |{nbsp} |Object Mapping |{nbsp}
5151
|✅ |{nbsp} |YAML |{nbsp}
5252
|❓ |{nbsp} |etcd |Not yet tested.
53-
| |{nbsp} |git |Not yet tested.
53+
| |{nbsp} |git |{nbsp}
5454
|✅ |Db Client |Db Client |{nbsp}
5555
|✅ |{nbsp} |Health Check |{nbsp}
5656
|🔶 |{nbsp} |JDBC |Tested with Helidon modules for Oracle and H2 driver (see examples)

examples/config/git/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
<groupId>io.helidon.config</groupId>
5252
<artifactId>helidon-config-git</artifactId>
5353
</dependency>
54+
<dependency>
55+
<groupId>org.slf4j</groupId>
56+
<artifactId>slf4j-jdk14</artifactId>
57+
</dependency>
5458
</dependencies>
5559

5660
<build>

examples/config/git/src/main/java/io/helidon/config/examples/git/Main.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@ public static void main(String... args) throws IOException {
6363
// in this example we just set envvar in maven plugin 'exec', but can be set in k8s pod via ConfigMap
6464
Config env = Config.create(ConfigSources.environmentVariables());
6565

66-
System.out.println("Loading from branch " + env.get(ENVIRONMENT_NAME_PROPERTY).asString().orElse("null"));
66+
String branch = env.get(ENVIRONMENT_NAME_PROPERTY).asString().orElse("master");
67+
68+
System.out.println("Loading from branch " + branch);
6769

6870
Config config = Config.create(
6971
GitConfigSource.builder()
7072
.path("application.conf")
7173
.uri(URI.create("https://github.com/helidonrobot/test-config.git"))
72-
.branch(env.get(ENVIRONMENT_NAME_PROPERTY).asString().orElse("master"))
74+
.branch(branch)
7375
.build());
7476

7577
System.out.println("Greeting is " + config.get("greeting").asString().get());

0 commit comments

Comments
 (0)