Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: graalvm/native-build-tools
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.10.0
Choose a base ref
...
head repository: graalvm/native-build-tools
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.10.1
Choose a head ref
  • 17 commits
  • 33 files changed
  • 6 contributors

Commits on Jan 30, 2024

  1. Bump ch.qos.logback:logback-classic

    Bumps [ch.qos.logback:logback-classic](https://github.com/qos-ch/logback) from 1.4.4 to 1.4.12.
    - [Commits](qos-ch/logback@v_1.4.4...v_1.4.12)
    
    ---
    updated-dependencies:
    - dependency-name: ch.qos.logback:logback-classic
      dependency-type: direct:production
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored and fniephaus committed Jan 30, 2024
    Copy the full SHA
    0db3e00 View commit details
  2. Fix compile-no-fork with existing jar FileSystems (#547)

    FileSystems.newFileSystem on a dependency jar fails with a
    FileSystemAlreadyExistsException if another Maven plugin has already
    created it.
    
    Provide a wrapper that handles the exception, trying
    FileSystems.getFileSystem in that case.
    kohlschuetter authored and fniephaus committed Jan 30, 2024
    Copy the full SHA
    2bc6976 View commit details

Commits on Feb 1, 2024

  1. Upgrade to GraalVM SDK 23.0.2

    The Maven plugin was using the dependency at compile time, when it
    should only have been used at runtime. Unfortunately, if the
    dependency is added as a runtime only dependency, then the Maven
    plugin loading system will fail.
    Therefore, this commit changes how the JUnit Platform Native
    dependency is resolved by the plugin to do it in a similar way as
    what is done in the Gradle plugin, by resolving it at runtime.
    melix committed Feb 1, 2024
    Copy the full SHA
    9f49c1b View commit details

Commits on Feb 2, 2024

  1. Fix test so that it doesn't actually try to reach remote

    This has a side effect if the metadata repo is actually published.
    melix committed Feb 2, 2024
    Copy the full SHA
    d2072ea View commit details
  2. Merge pull request #567 from dnestoro/dnestoro/CreateRelease0.10.0

    Bump repository version to 0.10.0 and update samples
    dnestoro authored Feb 2, 2024
    Copy the full SHA
    e31c683 View commit details
  3. Copy the full SHA
    3b18a9a View commit details

Commits on Feb 5, 2024

  1. Merge pull request #568 from dnestoro/dnestoro/BumpRepoVersionTo0.10.…

    …1-SNAPSHOT
    
    Bump repo version to 0.10.1-SNAPSHOT and update samples
    dnestoro authored Feb 5, 2024
    Copy the full SHA
    8fb9b8e View commit details
  2. Copy the full SHA
    81d88de View commit details
  3. Update docs/src/docs/asciidoc/index.adoc

    Co-authored-by: Cédric Champeau <cedric.champeau@gmail.com>
    dnestoro and melix authored Feb 5, 2024
    Copy the full SHA
    8df92d0 View commit details
  4. Update docs/src/docs/asciidoc/index.adoc

    Co-authored-by: Cédric Champeau <cedric.champeau@gmail.com>
    dnestoro and melix authored Feb 5, 2024
    Copy the full SHA
    60b6176 View commit details

Commits on Feb 6, 2024

  1. Merge pull request #570 from dnestoro/dnestoro/AddLinkForDisablingMet…

    …adataRepoInDocs
    
    Add notes how to disable metadata repository support
    dnestoro authored Feb 6, 2024
    Copy the full SHA
    36b88aa View commit details
  2. Copy the full SHA
    60304c8 View commit details
  3. Merge pull request #571 from dnestoro/dnestoro/FixKotlinSnippet

    Fix Kotlin Snippet For Disabling Metadata Repository
    dnestoro authored Feb 6, 2024
    Copy the full SHA
    3dbd0af View commit details

Commits on Feb 8, 2024

  1. Copy the full SHA
    c06b595 View commit details
  2. Add changelog entry.

    [ci skip]
    fniephaus committed Feb 8, 2024
    Copy the full SHA
    e6e45fd View commit details

Commits on Feb 12, 2024

  1. Merge pull request #565 from graalvm/cc/upgrade-graalvm-sdk

    Upgrade to GraalVM SDK 23.0.2
    dnestoro authored Feb 12, 2024
    Copy the full SHA
    ffd9d85 View commit details

Commits on Feb 14, 2024

  1. Bump repo version and update samples

    dnestoro committed Feb 14, 2024
    Copy the full SHA
    f72f403 View commit details
Showing with 258 additions and 74 deletions.
  1. +1 −1 build-logic/common-plugins/src/main/kotlin/org.graalvm.build.publishing.gradle.kts
  2. +8 −2 ...tform-native/src/main/java/org/graalvm/junit/platform/config/platform/PlatformConfigProvider.java
  3. +1 −1 docs/src/docs/asciidoc/gradle-plugin.adoc
  4. +8 −3 docs/src/docs/asciidoc/index.adoc
  5. +3 −3 docs/src/docs/snippets/gradle/kotlin/build.gradle.kts
  6. +2 −2 gradle/libs.versions.toml
  7. +2 −2 native-gradle-plugin/src/test/groovy/org/graalvm/buildtools/gradle/NativeImagePluginTest.groovy
  8. +70 −0 native-maven-plugin/build-plugins/src/main/java/org/graalvm/build/maven/GenerateRuntimeMetadata.java
  9. +17 −0 native-maven-plugin/build-plugins/src/main/kotlin/org.graalvm.build.maven-plugin.gradle.kts
  10. +2 −2 native-maven-plugin/build.gradle.kts
  11. +2 −2 native-maven-plugin/reproducers/issue-144/pom.xml
  12. +12 −1 native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/AbstractNativeImageMojo.java
  13. +101 −26 native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/NativeTestMojo.java
  14. +1 −1 samples/java-application-with-custom-packaging/pom.xml
  15. +1 −1 samples/java-application-with-custom-tests/gradle.properties
  16. +1 −1 samples/java-application-with-extra-sourceset/gradle.properties
  17. +1 −1 samples/java-application-with-reflection/gradle.properties
  18. +2 −2 samples/java-application-with-reflection/pom.xml
  19. +1 −1 samples/java-application-with-resources/gradle.properties
  20. +2 −2 samples/java-application-with-resources/pom.xml
  21. +1 −1 samples/java-application-with-tests/gradle.properties
  22. +2 −2 samples/java-application-with-tests/pom.xml
  23. +1 −1 samples/java-application/gradle.properties
  24. +2 −2 samples/java-application/pom.xml
  25. +1 −1 samples/java-library/gradle.properties
  26. +2 −2 samples/java-library/pom.xml
  27. +1 −1 samples/kotlin-application-with-tests/gradle.properties
  28. +1 −1 samples/metadata-repo-integration/gradle.properties
  29. +3 −3 samples/metadata-repo-integration/pom.xml
  30. +1 −1 samples/multi-project-with-tests/gradle.properties
  31. +2 −2 samples/multi-project-with-tests/pom.xml
  32. +1 −1 samples/native-config-integration/gradle.properties
  33. +2 −2 samples/native-config-integration/pom.xml
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ val mavenExtension = project.extensions.create<MavenExtension>("maven").also {
it.description.convention(project.description)
}

val publishingTasks = tasks.withType<PublishToMavenRepository>()
val publishingTasks = tasks.withType<AbstractPublishToMaven>()
.matching { it.name.endsWith("ToCommonRepository") }

val repositoryElements by configurations.creating {
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ public void onLoad(NativeImageConfiguration config) {
);

if (getMajorJDKVersion() >= 21) {
/* new with simulated class initialization */
/* new with --strict-image-heap */
config.initializeAtBuildTime(
"org.junit.platform.engine.support.descriptor.ClassSource",
"org.junit.platform.engine.support.descriptor.MethodSource",
@@ -75,15 +75,21 @@ public void onLoad(NativeImageConfiguration config) {
"org.junit.platform.launcher.core.DefaultLauncher",
"org.junit.platform.launcher.core.DefaultLauncherConfig",
"org.junit.platform.launcher.core.EngineExecutionOrchestrator",
"org.junit.platform.launcher.core.LauncherConfigurationParameters$ParameterProvider$1",
"org.junit.platform.launcher.core.LauncherConfigurationParameters$ParameterProvider$2",
"org.junit.platform.launcher.core.LauncherConfigurationParameters$ParameterProvider$3",
"org.junit.platform.launcher.core.LauncherConfigurationParameters$ParameterProvider$4",
"org.junit.platform.launcher.core.LauncherDiscoveryResult",
"org.junit.platform.launcher.core.LauncherListenerRegistry",
"org.junit.platform.launcher.core.ListenerRegistry",
"org.junit.platform.launcher.core.SessionPerRequestLauncher",
"org.junit.platform.launcher.LauncherSessionListener$1",
"org.junit.platform.launcher.listeners.UniqueIdTrackingListener",
"org.junit.platform.reporting.shadow.org.opentest4j.reporting.events.api.DocumentWriter$1"
"org.junit.platform.reporting.shadow.org.opentest4j.reporting.events.api.DocumentWriter$1",
"org.junit.platform.suite.engine.SuiteEngineDescriptor",
"org.junit.platform.suite.engine.SuiteLauncher",
"org.junit.platform.suite.engine.SuiteTestDescriptor",
"org.junit.platform.suite.engine.SuiteTestEngine"
);
}

2 changes: 1 addition & 1 deletion docs/src/docs/asciidoc/gradle-plugin.adoc
Original file line number Diff line number Diff line change
@@ -373,7 +373,7 @@ include::../snippets/gradle/groovy/build.gradle[tags=disable-metadata-repository

[source, kotlin, role="multi-language-sample"]
----
include::../snippets/gradle/kotlin/build.gradle.kts[tags=enable-metadata-repository]
include::../snippets/gradle/kotlin/build.gradle.kts[tags=disable-metadata-repository]
----

A metadata repository consists of configuration files for GraalVM.
11 changes: 8 additions & 3 deletions docs/src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
@@ -19,17 +19,22 @@ If you are using alternative build systems, see <<alternative-build-systems.adoc
[[changelog]]
== Changelog

=== Release 0.10.1

- Mark additional JUnit 5 types for build-time initialization for compatibility with Native Image's `--strict-image-heap` option.


=== Release 0.10.0

- Update version of GraalVM dependency to 22.3.5

==== Gradle plugin

- Update plugin to use metadata repository by default
- Update plugin to use metadata repository by default. Metadata repository <<gradle-plugin.adoc#_configuring_the_metadata_repository,can be disabled manually.>>

====Maven plugin
==== Maven plugin

- Update plugin to use metadata repository by default
- Update plugin to use metadata repository by default. Metadata repository <<maven-plugin.adoc#_configuring_the_metadata_repository,can be disabled manually.>>


=== Release 0.9.28
6 changes: 3 additions & 3 deletions docs/src/docs/snippets/gradle/kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -179,13 +179,13 @@ graalvmNative {
}
// end::custom-binary[]

// tag::enable-metadata-repository[]
// tag::disable-metadata-repository[]
graalvmNative {
metadataRepository {
enabled.set(true)
enabled.set(false)
}
}
// end::enable-metadata-repository[]
// end::disable-metadata-repository[]

// tag::specify-metadata-repository-version[]
graalvmNative {
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
# Project versions
nativeBuildTools = "0.10.0"
nativeBuildTools = "0.10.1"
metadataRepository = "0.3.6"

# External dependencies
@@ -9,7 +9,7 @@ maven = "3.8.6"
mavenAnnotations = "3.6.4"
mavenEmbedder = "3.8.6"
mavenWagon = "3.4.3"
graalvm = "22.3.5"
graalvm = "23.0.2"
jackson = "2.13.5"
junitPlatform = "1.10.0"
junitJupiter = "5.10.0"
Original file line number Diff line number Diff line change
@@ -21,8 +21,8 @@ class NativeImagePluginTest extends Specification {
private URI fallbackUri

def setup() {
project = ProjectBuilder.builder().build()
project.repositories.mavenCentral()
project = ProjectBuilder.builder()
.build()
project.plugins.apply(NativeImagePlugin)
reachabilityMetadataRepositoryExtension = project.extensions
.findByType(GraalVMExtension)
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright 2003-2021 the original author or authors.
*
* 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 org.graalvm.build.maven;

import org.gradle.api.DefaultTask;
import org.gradle.api.file.DirectoryProperty;
import org.gradle.api.provider.MapProperty;
import org.gradle.api.provider.Property;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.TaskAction;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;

public abstract class GenerateRuntimeMetadata extends DefaultTask {
@Input
public abstract Property<String> getClassName();

@Input
public abstract MapProperty<String, String> getMetadata();

@OutputDirectory
public abstract DirectoryProperty getOutputDirectory();

@TaskAction
public void generateClass() throws IOException {
String fqcn = getClassName().get();
Map<String, String> metadata = getMetadata().get();
File outputDir = getOutputDirectory().getAsFile().get();
String packageName = fqcn.substring(0, fqcn.lastIndexOf("."));
String packagePath = packageName.replace(".", "/");
String className = fqcn.substring(fqcn.lastIndexOf(".") + 1);
Path outputPath = outputDir.toPath().resolve(packagePath);
Files.createDirectories(outputPath);
Path outputFile = outputPath.resolve(className + ".java");
try (PrintWriter writer = new PrintWriter(outputFile.toFile(), StandardCharsets.UTF_8)) {
writer.println("package " + packageName + ";");
writer.println();
writer.println("public abstract class " + className + " {");
writer.println(" private " + className + "() { }");
writer.println();
for (Map.Entry<String, String> entry : metadata.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
writer.println(" public static final String " + key + " = \"" + value + "\";");
}
writer.println();
writer.println("}");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.graalvm.build.maven.GeneratePluginDescriptor
import org.graalvm.build.maven.GenerateRuntimeMetadata
import org.gradle.api.publish.maven.tasks.GenerateMavenPom
import org.gradle.api.tasks.Copy
import org.gradle.kotlin.dsl.register
@@ -73,6 +74,22 @@ val generatePluginDescriptor = tasks.register<GeneratePluginDescriptor>("generat
outputDirectory.set(project.layout.buildDirectory.dir("generated/maven-plugin"))
}

val writeConstants = tasks.register<GenerateRuntimeMetadata>("writeRuntimeMetadata") {
className.set("org.graalvm.buildtools.maven.RuntimeMetadata")
outputDirectory.set(layout.buildDirectory.dir("generated/runtime-metadata"))
metadata.put("GROUP_ID", project.group as String)
metadata.put("VERSION", project.version as String)
metadata.put("JUNIT_PLATFORM_NATIVE_ARTIFACT_ID", "junit-platform-native")
}

sourceSets {
main {
java {
srcDir(writeConstants)
}
}
}

tasks {
jar {
from(generatePluginDescriptor)
4 changes: 2 additions & 2 deletions native-maven-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -60,11 +60,9 @@ maven {
}

dependencies {
implementation(libs.junitPlatformNative)
implementation(libs.utils)
implementation(libs.jackson.databind)
implementation(libs.jvmReachabilityMetadata)
implementation(libs.graalvm.svm)
implementation(libs.plexus.utils)
implementation(libs.plexus.xml)

@@ -177,4 +175,6 @@ tasks {

tasks.withType<Checkstyle>().configureEach {
configFile = layout.projectDirectory.dir("../config/checkstyle.xml").asFile
// generated code
exclude("**/RuntimeMetadata*")
}
4 changes: 2 additions & 2 deletions native-maven-plugin/reproducers/issue-144/pom.xml
Original file line number Diff line number Diff line change
@@ -56,8 +56,8 @@
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<native.maven.plugin.version>0.10.0</native.maven.plugin.version>
<junit.platform.native.version>0.10.0</junit.platform.native.version>
<native.maven.plugin.version>0.10.1</native.maven.plugin.version>
<junit.platform.native.version>0.10.1</junit.platform.native.version>
<imageName>example-app</imageName>
<mainClass>org.graalvm.demo.Application</mainClass>
</properties>
Original file line number Diff line number Diff line change
@@ -64,6 +64,7 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.FileSystemAlreadyExistsException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.Files;
@@ -293,13 +294,23 @@ protected void addArtifactToClasspath(Artifact artifact) throws MojoExecutionExc
Optional.ofNullable(processSupportedArtifacts(artifact)).ifPresent(imageClasspath::add);
}

private static FileSystem openFileSystem(URI uri) throws IOException {
FileSystem fs;
try {
fs = FileSystems.newFileSystem(uri, Collections.emptyMap());
} catch (FileSystemAlreadyExistsException e) {
fs = FileSystems.getFileSystem(uri);
}
return fs;
}

protected void warnIfWrongMetaInfLayout(Path jarFilePath, Artifact artifact) throws MojoExecutionException {
if (jarFilePath.toFile().isDirectory()) {
logger.debug("Artifact `" + jarFilePath + "` is a directory.");
return;
}
URI jarFileURI = URI.create("jar:" + jarFilePath.toUri());
try (FileSystem jarFS = FileSystems.newFileSystem(jarFileURI, Collections.emptyMap())) {
try (FileSystem jarFS = openFileSystem(jarFileURI)) {
Path nativeImageMetaInfBase = jarFS.getPath("/" + NATIVE_IMAGE_META_INF);
if (Files.isDirectory(nativeImageMetaInfBase)) {
try (Stream<Path> stream = Files.walk(nativeImageMetaInfBase)) {
Loading