Skip to content

Commit 909a1c4

Browse files
authored
Merge pull request #21
Deployment helpers and minor cleanups
2 parents b07a395 + bc572b3 commit 909a1c4

File tree

9 files changed

+117
-61
lines changed

9 files changed

+117
-61
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ jobs:
194194
uses: actions/upload-artifact@v4
195195
with:
196196
name: jbang-native-image-log
197-
path: /tmp/jbang*native-image
197+
path: |
198+
/tmp/jbang*native-image
199+
/var/folders/sw/**/T/jbang*native-image
198200
199201
unit-tests:
200202
needs: [build, maven_bundle_url]

org.graalvm.python.embedding/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@
7171
</goals>
7272
<configuration>
7373
<executable>${project.basedir}/../scripts/sigtest-check-embedding.sh</executable>
74+
<arguments>
75+
<argument>-s</argument>
76+
<argument>${session.request.userSettingsFile.path}</argument>
77+
<argument>-Dlocal.repo.url=${local.repo.url}</argument>
78+
</arguments>
7479
</configuration>
7580
</execution>
7681
</executions>

org.graalvm.python.gradle.plugin/build.gradle

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,36 @@ dependencies {
3939
}
4040

4141
publishing {
42-
publications {
43-
pluginMaven(MavenPublication) {
44-
// TODO: why this does not appear in the generated pom.xml for Mavencentral/local?
45-
pom {
46-
name = 'GraalPy Plugin'
47-
description = 'Gradle plugin for GraalPy, a high-performance embeddable Python 3 runtime for Java. The plugin provides support for installing and managing Python packages.'
48-
url = 'https://graalvm.org'
49-
50-
licenses {
51-
license {
52-
name = 'Universal Permissive License, Version 1.0'
53-
url = 'http://opensource.org/licenses/UPL'
54-
}
42+
repositories {
43+
// Accept Maven's -DaltDeploymentRepository=id::layout::url
44+
def repoSpec = findProperty('altDeploymentRepository') as String
45+
if (repoSpec) {
46+
def parts = repoSpec.split('::')
47+
if (parts.length >= 3) {
48+
maven {
49+
name = parts[0]
50+
url = uri(parts[2])
5551
}
56-
57-
developers {
58-
developer {
59-
name = 'GraalVM Development'
60-
email = 'graalvm-dev@oss.oracle.com'
61-
}
52+
} else {
53+
logger.warn("altDeploymentRepository should be 'id::layout::url', got: ${repoSpec}")
54+
}
55+
}
56+
}
57+
publications.withType(MavenPublication).configureEach {
58+
pom {
59+
name.set('GraalPy Plugin')
60+
description.set('Gradle plugin for GraalPy, a high-performance embeddable Python 3 runtime for Java. The plugin provides support for installing and managing Python packages.')
61+
url.set('https://graalvm.org ')
62+
licenses {
63+
license {
64+
name.set('Universal Permissive License, Version 1.0')
65+
url.set('http://opensource.org/licenses/UPL ')
66+
}
67+
}
68+
developers {
69+
developer {
70+
name.set('GraalVM Development')
71+
email.set('graalvm-dev@oss.oracle.com ')
6272
}
6373
}
6474
}

org.graalvm.python.gradle.plugin/pom.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,24 @@ SOFTWARE.
171171
</arguments>
172172
</configuration>
173173
</execution>
174+
<execution>
175+
<id>gradle-deploy</id>
176+
<phase>deploy</phase>
177+
<goals>
178+
<goal>exec</goal>
179+
</goals>
180+
<configuration>
181+
<executable>${project.basedir}/${gradlew}</executable>
182+
<workingDirectory>${project.basedir}</workingDirectory>
183+
<arguments>
184+
<argument>-Dorg.gradle.java.home=${gradle.java.home}</argument>
185+
<argument>-Pversion=${revision}</argument>
186+
<argument>-Ppolyglot.version=${project.polyglot.version}</argument>
187+
<argument>-PaltDeploymentRepository=${altDeploymentRepository}</argument>
188+
<argument>publish</argument>
189+
</arguments>
190+
</configuration>
191+
</execution>
174192
</executions>
175193
</plugin>
176194
</plugins>

pom.xml

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
<project.hamcrest.version>3.0</project.hamcrest.version>
2222
<project.sigtest.version>1.3</project.sigtest.version>
2323
<integration.tests.args>--help</integration.tests.args>
24+
<!-- intentionally empty: the default value, override with a URL the use a local repository -->
25+
<local.repo.url></local.repo.url>
2426
</properties>
2527

2628
<developers>
@@ -69,32 +71,32 @@
6971
</modules>
7072
</profile>
7173
<profile>
72-
<id>release</id>
73-
<build>
74-
<plugins>
75-
<plugin>
76-
<groupId>org.apache.maven.plugins</groupId>
77-
<artifactId>maven-gpg-plugin</artifactId>
78-
<version>3.2.8</version>
79-
<configuration>
80-
<!-- For headless in-process signing using provided private key uncomment: -->
81-
<!-- <signer>bc</signer> -->
82-
<!-- The key contents must be provided via an environment variable MAVEN_GPG_KEY, which should contain
83-
private key in binary or ASCII-armored form (specifically in the GPG TSK export format).
84-
See https://maven.apache.org/plugins/maven-gpg-plugin/sign-mojo.html -->
85-
</configuration>
86-
<executions>
87-
<execution>
88-
<id>sign-artifacts</id>
89-
<phase>verify</phase>
90-
<goals>
91-
<goal>sign</goal>
92-
</goals>
93-
</execution>
94-
</executions>
95-
</plugin>
96-
</plugins>
97-
</build>
74+
<id>local-repo-profile</id>
75+
<activation>
76+
<property>
77+
<name>local.repo.url</name>
78+
</property>
79+
</activation>
80+
<pluginRepositories>
81+
<pluginRepository>
82+
<id>local-repo</id>
83+
<name>local-repo</name>
84+
<url>${local.repo.url}</url>
85+
</pluginRepository>
86+
</pluginRepositories>
87+
<repositories>
88+
<repository>
89+
<id>local-repo</id>
90+
<name>local-repo</name>
91+
<url>${local.repo.url}</url>
92+
<releases>
93+
<enabled>true</enabled>
94+
</releases>
95+
<snapshots>
96+
<enabled>true</enabled>
97+
</snapshots>
98+
</repository>
99+
</repositories>
98100
</profile>
99101
</profiles>
100102

scripts/deploy-local-repo.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
if [ $# -eq 0 ]; then
3+
echo "Deploys the artifacts to a local repository"
4+
echo "Usage: $0 local-repository-path [additional Maven options]"
5+
exit 1
6+
fi
7+
8+
source="${BASH_SOURCE[0]}"
9+
while [ -h "$source" ] ; do
10+
prev_source="$source"
11+
source="$(readlink "$source")";
12+
if [[ "$source" != /* ]]; then
13+
# if the link was relative, it was relative to where it came from
14+
dir="$( cd -P "$( dirname "$prev_source" )" && pwd )"
15+
source="$dir/$source"
16+
fi
17+
done
18+
project_root="$( cd -P "$( dirname "$source" )/.." && pwd )"
19+
20+
cd "${project_root}"
21+
22+
set -ex
23+
repo=$(readlink -f "$1")
24+
shift
25+
./mvnw "$@" -DskipJavainterfacegen -DskipTests -DdeployAtEnd=true \
26+
-DaltDeploymentRepository=local::default::file:${repo} \
27+
deploy

scripts/maven-bundle-setup.sh

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,6 @@ while [ -h "$source" ] ; do
2020
done
2121
project_root="$( cd -P "$( dirname "$source" )/.." && pwd )"
2222

23-
revision="$(mvn -f "${project_root}/pom.xml" help:evaluate -Dexpression=revision -q -DforceStdout)"
24-
revision="${revision%-SNAPSHOT}" # remove -SNAPSHOT
25-
revision_quoted_for_jq="${revision//./\\\\.}"
26-
27-
echo "Trying to find the release for revision: ${revision}"
28-
curl -sSL "https://api.github.com/repos/graalvm/oracle-graalvm-ea-builds/releases" -o github_releases.json
29-
30-
echo "Downloaded releases JSON from GitHub, head:"
31-
head -n 20 github_releases.json
32-
echo "==========================================="
33-
3423
if [ -z "$2" ]; then
3524
asset_url=$("${project_root}/scripts/maven-bundle-url.sh" | tail -n 1)
3625
else
@@ -42,5 +31,4 @@ echo "Downloading: $asset_url"
4231
curl -L -o maven-resource-bundle.zip "$asset_url"
4332
unzip -q -o maven-resource-bundle.zip -d "$1"
4433
rm maven-resource-bundle.zip
45-
rm github_releases.json
46-
"${project_root}/scripts/maven-bundle-create-settings.sh" "$(realpath "$1")"
34+
"${project_root}/scripts/maven-bundle-create-settings.sh" "$(readlink -f "$1")"

scripts/maven-bundle-url.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ echo "==========================================="
2525

2626
asset_url=$(cat github_releases.json \
2727
| jq -r 'map(select(.tag_name | test("'${revision_quoted_for_jq}'"))) | max_by(.published_at) | .assets[] | select(.name | test("^maven-resource-.*\\.zip$")) | .browser_download_url')
28+
29+
rm github_releases.json
2830
if [[ -z "$asset_url" ]]; then
2931
echo "Failed to find a maven-resource-bundle zip" >&2
3032
exit 1

scripts/sigtest-check-embedding.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/bash
2+
# Note: any arguments are forwarded to Maven
3+
24
set -xe
35

46
source="${BASH_SOURCE[0]}"
@@ -14,10 +16,10 @@ done
1416
project_root="$( cd -P "$( dirname "$source" )/.." && pwd )"
1517

1618
cd "${project_root}"
17-
classpath="$(mvn -q -pl org.graalvm.python.embedding exec:exec -Dexec.executable="echo" -Dexec.args='%classpath')"
19+
classpath="$(./mvnw "$@" -q -pl org.graalvm.python.embedding exec:exec -Dexec.executable="echo" -Dexec.args='%classpath')"
1820
exec_args="-BootCP -Static -Mode bin -FileName ./org.graalvm.python.embedding/snapshot.sigtest -ClassPath ${classpath} -b -PackageWithoutSubpackages org.graalvm.python.embedding"
1921
rc=0
20-
mvn exec:java@sigtest-tool -Dexec.args="${exec_args}" || rc=$?
22+
./mvnw "$@" exec:java@sigtest-tool -Dexec.args="${exec_args}" || rc=$?
2123
echo "Exit code from sigtest tool: ${rc}"
2224
if [ $rc -ne 95 ]; then
2325
exit 1

0 commit comments

Comments
 (0)