Skip to content

Commit 71f4339

Browse files
authored
4.7.3.1 release (#37)
1 parent 4af73c9 commit 71f4339

33 files changed

+563
-3752
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Graal Development Kit for Micronaut (GDK)
22

3-
Graal Development Kit for Micronaut (GDK) is a curated set of open source Micronaut® framework modules designed from the ground up to be compiled ahead-of-time with GraalVM Native Image resulting in native executables ideal for microservices.
3+
[Graal Development Kit for Micronaut (GDK)](https://graal.cloud/gdk/) is a curated set of open source Micronaut® framework modules designed from the ground up to be compiled ahead-of-time with GraalVM Native Image resulting in native executables ideal for microservices.
44
With GDK, you can build portable cloud-native Java microservices that start instantly and use fewer resources to reduce compute costs.
55

66
## Installation

buildSrc/src/main/groovy/cloud/graal/gdk/dependencies/DependenciesSourceGenerator.groovy

+4-2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ abstract class DependenciesSourceGenerator extends DefaultTask {
8585
writer.println()
8686
writer.println('public class GdkDependencies {')
8787
writer.println(' public static final Map<String, Dependency> ALL_DEPENDENCIES;')
88+
writer.println(' public static final String GRAALVM_METADATA_REPOSITORY_VERSION = ' + '"%s";'.formatted(versionCatalog.get().findVersion("graalvm-metadata-version").get()) )
8889
def dependenciesMap = [:]
8990
def versionCatalog = getVersionCatalog().get()
9091
writeDependencies(writer, dependenciesMap, versionCatalog, true)
@@ -111,14 +112,15 @@ abstract class DependenciesSourceGenerator extends DefaultTask {
111112
String artifactId = lib.get().module.name
112113
String groupId = lib.get().module.group
113114
String version = lib.get().versionConstraint.requiredVersion
114-
String name = artifactId.toUpperCase().replaceAll('-', '_').replaceAll('\\.', '_')
115+
String groupIdArtifactId = groupId + '_' + artifactId
116+
String name = groupIdArtifactId.toUpperCase().replaceAll('-', '_').replaceAll('\\.', '_')
115117
writer.println(" public static final Dependency $name = Dependency.builder()\n" +
116118
" .groupId(\"$groupId\")\n" +
117119
" .artifactId(\"$artifactId\")\n" +
118120
" .version(\"$version\")\n" +
119121
" .pom($bom)\n" +
120122
" .build();")
121-
dependenciesMap[artifactId] = name
123+
dependenciesMap[groupId + ':' + artifactId] = name
122124
}
123125
}
124126
}

buildSrc/src/main/groovy/cloud/graal/gdk/dependencies/GdkVersionCatalogUpdatePlugin.groovy

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ class GdkVersionCatalogUpdatePlugin implements Plugin<Project> {
3737
'org.jetbrains.kotlin:kotlin-reflect',
3838
'org.jetbrains.kotlin:kotlin-stdlib',
3939
'org.jetbrains.kotlin:kotlin-stdlib-jdk8',
40+
'org.jetbrains.kotlin:kotlin-stdlib-jdk7',
41+
'org.jetbrains.kotlin:kotlin-stdlib-common',
4042
'org.jetbrains.kotlin:kotlin-test'
4143
])
4244
task.allowMajorUpdates.convention(false)

buildSrc/src/main/groovy/cloud/graal/gdk/dependencies/VersionCatalogUpdate.groovy

+25
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ abstract class VersionCatalogUpdate extends DefaultTask {
119119
detachedConfiguration.canBeResolved = true
120120
detachedConfiguration.transitive = false
121121
detachedConfiguration.resolutionStrategy.cacheDynamicVersionsFor(0, MINUTES)
122+
lines = graalvmRepositoryMetadataVersion(lines)
122123
List<Pattern> rejectedQualifiers = getRejectedQualifiers().get()
123124
.stream()
124125
.map { qualifier -> Pattern.compile("(?i).*[.-]" + qualifier + "[.\\d-+]*") }
@@ -267,6 +268,30 @@ abstract class VersionCatalogUpdate extends DefaultTask {
267268
return ""
268269
}
269270

271+
private static List<String> graalvmRepositoryMetadataVersion(List<String> lines) {
272+
def reference_metadata = "graalvm-metadata-version"
273+
int ln = 0
274+
for (String x in lines) {
275+
if (x.startsWith(reference_metadata)) {
276+
break
277+
}
278+
ln++
279+
}
280+
if (ln < lines.size() - 1) {
281+
URL url = new URL("https://github.com/oracle/graalvm-reachability-metadata/releases/latest")
282+
HttpURLConnection con = (HttpURLConnection) url.openConnection()
283+
con.setRequestMethod("GET")
284+
con.setConnectTimeout(5000)
285+
con.setInstanceFollowRedirects(false)
286+
con.setReadTimeout(5000)
287+
con.connect()
288+
def graalvmRepoVersion = con.getHeaderField("Location").split("/").last()
289+
con.disconnect()
290+
lines.set(ln, '%s = "%s"'.formatted(reference_metadata, graalvmRepoVersion))
291+
}
292+
return lines
293+
}
294+
270295
static Dependency requirePom(DependencyHandler dependencies, Library library) {
271296
ExternalModuleDependency dependency = (ExternalModuleDependency) dependencies.create(library.getGroup() + ":" + library.getName() + ":+")
272297
dependency.artifact { artifact -> artifact.setType("pom") }

buildSrc/src/main/groovy/cloud/graal/gdk/pom/GdkBomPlugin.groovy

+15-4
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ abstract class GdkBomPlugin implements Plugin<Project> {
119119
Configuration catalogs = project.configurations.detachedConfiguration()
120120

121121
Map<String, String> mapAliasToVersion = new HashMap<>()
122+
Map<String, String> pomProperties = new HashMap<>()
122123

123124
publishing.publications.named("maven", MavenPublication, pub -> {
124125
pub.artifactId = "gdk-bom"
@@ -133,11 +134,21 @@ abstract class GdkBomPlugin implements Plugin<Project> {
133134
String bomPropertyName = bomPropertyName(alias)
134135
def version = modelProvider.versionsTable.find(x -> x.reference == library.version.reference).version
135136
mapAliasToVersion[library.alias] = '\${' + bomPropertyName + '}'
136-
pom.properties.put(bomPropertyName, version.require)
137+
pomProperties.put(bomPropertyName, version.require)
137138
}
138139
})
139140
pom.withXml { xml ->
140-
Node dependencies = childOf(childOf(xml.asNode(), "dependencyManagement"), "dependencies")
141+
Node properties = new Node(xml.asNode(), "properties")
142+
143+
for(String key: pomProperties.keySet().sort()) {
144+
new Node(properties, key, pomProperties.get(key))
145+
}
146+
147+
Node depManagement = childOf(xml.asNode(), "dependencyManagement")
148+
xml.asNode().remove(depManagement)
149+
xml.asNode().append(depManagement)
150+
151+
Node dependencies = childOf(depManagement, "dependencies")
141152
dependencyExclusion.exclusions.forEach {
142153
String[] exclusionDependencyStrings = it.name.split(':')
143154
it.from.forEach { parentDependency ->
@@ -199,8 +210,8 @@ abstract class GdkBomPlugin implements Plugin<Project> {
199210
MavenArtifactRepository repository = (MavenArtifactRepository) maven
200211
repository.name = "External"
201212
repository.url = externalRepoUri
202-
Provider<String> externalRepoUsername = project.providers.environmentVariable("PUBLISH_USERNAME")
203-
Provider<String> externalRepoPassword = project.providers.environmentVariable("PUBLISH_PASSWORD")
213+
Provider<String> externalRepoUsername = project.providers.environmentVariable("ARTIFACTHUB_ACCESS_TOKEN_USERNAME")
214+
Provider<String> externalRepoPassword = project.providers.environmentVariable("ARTIFACTHUB_ACCESS_TOKEN")
204215
if (externalRepoUsername.isPresent() && externalRepoPassword.isPresent()) {
205216
repository.credentials(credentials -> {
206217
credentials.username = externalRepoUsername.get()

buildSrc/src/main/groovy/cloud/graal/gdk/pom/GdkParentPlugin.groovy

+20-6
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ abstract class GdkParentPlugin implements Plugin<Project> {
8282

8383
Configuration api = project.configurations.named(API_CONFIGURATION_NAME).get()
8484

85+
Map<String, String> pomProperties = new HashMap<>()
86+
8587
Map<String, String> mapAliasToVersion = new HashMap<>()
8688
publishing.publications.named("maven", MavenPublication, pub -> {
8789
pub.artifactId = "gdk-parent"
@@ -98,7 +100,7 @@ abstract class GdkParentPlugin implements Plugin<Project> {
98100
String bomPropertyName = bomPropertyName(library.alias, alias)
99101
def version = modelProvider.versionsTable.find(x -> x.reference == library.version.reference).version
100102
mapAliasToVersion[library.alias] = '\${' + bomPropertyName + '}'
101-
pom.properties.put(bomPropertyName, version.require)
103+
pomProperties.put(bomPropertyName, version.require)
102104
}
103105
})
104106

@@ -114,19 +116,31 @@ abstract class GdkParentPlugin implements Plugin<Project> {
114116
}
115117

116118
pom.packaging = "pom"
117-
pom.properties.put("micronaut.version", platformVersion.require)
119+
pomProperties.put("micronaut.version", platformVersion.require)
120+
118121

119122
modelProvider.librariesTable.forEach(library -> {
120123
if (!library.alias.startsWith("exclude-") || pluginsMap.containsKey(library.alias) ) {
121124
String alias = Optional.ofNullable(library.version.reference).map(a -> a.replace('-', '.')).orElse("")
122125
String bomPropertyName = pluginsMap.containsKey(library.alias) ? pluginsMap.get(library.alias) : bomPropertyName(library.alias, alias)
123126
def version = modelProvider.versionsTable.find(x -> x.reference == library.version.reference).version
124-
pom.properties.put(bomPropertyName, version.require)
127+
pomProperties.put(bomPropertyName, version.require)
125128
}
126129
})
127130

128131
pom.withXml { xml ->
129-
Node dependencies = childOf(childOf(xml.asNode(), "dependencyManagement"), "dependencies")
132+
Node properties = new Node(xml.asNode(), "properties")
133+
134+
for(String key: pomProperties.keySet().sort()) {
135+
new Node(properties, key, pomProperties.get(key))
136+
}
137+
138+
139+
Node dependencyManagement = childOf(xml.asNode(), "dependencyManagement")
140+
xml.asNode().remove(dependencyManagement)
141+
xml.asNode().append(dependencyManagement)
142+
143+
Node dependencies = childOf(dependencyManagement, "dependencies")
130144
Node dependency = new Node(dependencies, "dependency", "")
131145
new Node(dependency, "groupId", "cloud.graal.gdk")
132146
new Node(dependency, "artifactId", "gdk-bom")
@@ -146,8 +160,8 @@ abstract class GdkParentPlugin implements Plugin<Project> {
146160
MavenArtifactRepository repository = (MavenArtifactRepository) maven
147161
repository.name = "External"
148162
repository.url = externalRepoUri
149-
Provider<String> externalRepoUsername = project.providers.environmentVariable("PUBLISH_USERNAME")
150-
Provider<String> externalRepoPassword = project.providers.environmentVariable("PUBLISH_PASSWORD")
163+
Provider<String> externalRepoUsername = project.providers.environmentVariable("ARTIFACTHUB_ACCESS_TOKEN_USERNAME")
164+
Provider<String> externalRepoPassword = project.providers.environmentVariable("ARTIFACTHUB_ACCESS_TOKEN")
151165
if (externalRepoUsername.isPresent() && externalRepoPassword.isPresent()) {
152166
repository.credentials(credentials -> {
153167
credentials.username = externalRepoUsername.get()

buildSrc/src/main/groovy/gdk-module.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ publishing {
2525
name = "External"
2626
url = providers.environmentVariable('PUBLISH_REPO')
2727
credentials {
28-
username = providers.environmentVariable('PUBLISH_USERNAME').getOrElse("")
29-
password = providers.environmentVariable('PUBLISH_PASSWORD').getOrElse("")
28+
username = providers.environmentVariable('ARTIFACTHUB_ACCESS_TOKEN_USERNAME').getOrElse("")
29+
password = providers.environmentVariable('ARTIFACTHUB_ACCESS_TOKEN').getOrElse("")
3030
}
3131
}
3232
}

gdk-cli-core/README.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
= gdk-cli-core
22

3-
This submodule is a reusable library contains most of the code for the CLI except for the main class and the build configuration to enable running the CLI.
3+
This submodule is a reusable library containing most of the code for the CLI except for the main class and the build configuration to enable running the CLI.

gdk-cli-core/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ plugins {
2222
dependencies {
2323
annotationProcessor mnLibs.picocli.codegen
2424

25-
// not in libs.versions.toml to keep Micronaut version in one place
2625
api(libs.micronaut.starter.cli) {
2726
exclude group: 'io.micronaut', module: 'micronaut-buffer-netty'
2827
exclude group: 'io.micronaut', module: 'micronaut-http-client'

gdk-core/build.gradle

-13
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,6 @@ dependencies {
4444
exclude group: 'org.eclipse.jgit', module: 'org.eclipse.jgit'
4545
}
4646
implementation(mnLibs.micronaut.http.client)
47-
implementation(libs.boms.netty)
48-
implementation(libs.netty.buffer)
49-
implementation(libs.netty.codec.http)
50-
implementation(libs.netty.codec.http2)
51-
implementation(libs.netty.common)
52-
implementation(libs.netty.incubator.codec.http3)
53-
implementation(libs.netty.handler)
54-
implementation(libs.netty.handler.proxy)
55-
implementation(libs.netty.transport.native.epoll)
56-
implementation(libs.netty.transport.native.kqueue)
57-
implementation(libs.netty.transport.native.iouring)
58-
implementation(libs.netty.transport.native.unix.common)
59-
implementation(libs.netty.tcnative.boringssl.static)
6047
}
6148

6249
def writeVersions = tasks.register('writeVersions', cloud.graal.gdk.util.WriteVersionsTask) {

gdk-core/src/main/java/cloud/graal/gdk/GdkContextFactory.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ public GdkFeatureContext createFeatureContext(AvailableFeatures available,
8888

8989
available.getAllFeatures()
9090
.filter(DefaultFeature.class::isInstance)
91-
.filter(f -> ((DefaultFeature) f).shouldApply(type, options, selectedAndDefaultFeatures))
91+
.map(DefaultFeature.class::cast)
92+
.filter(f -> f.shouldApply(type, options, selectedAndDefaultFeatures))
9293
.forEach(selectedAndDefaultFeatures::add);
9394

9495
return new GdkFeatureContext(options, type, os, selectedAndDefaultFeatures, selectedNames, clouds);

0 commit comments

Comments
 (0)