Skip to content

Commit fee9913

Browse files
committed
use JGit 7.2.0 version
and clean up the GitHub Actions build scripts.
1 parent 606f290 commit fee9913

10 files changed

Lines changed: 381 additions & 280 deletions

File tree

.github/workflows/gradle-build.yml

Lines changed: 6 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -14,70 +14,22 @@ jobs:
1414
matrix:
1515
os: [ubuntu-latest, windows-latest]
1616
java-version: [17, 21]
17-
graalvm-distribution: ['graalvm-community']
17+
graalvm-distribution: ['liberica']
1818
fail-fast: false
1919

2020
steps:
2121
- name: Git checkout
22-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
2323

2424
- name: Verify Gradle Wrapper
25-
uses: gradle/wrapper-validation-action@v1
26-
27-
- name: Cache Gradle packages
28-
uses: actions/cache@v3
29-
with:
30-
path: ~/.gradle/caches
31-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
32-
restore-keys: ${{ runner.os }}-gradle-
33-
34-
- name: Download Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Linux)
35-
if: runner.os == 'Linux' && matrix.java-version == 17
36-
run: |
37-
download_url="https://github.com/bell-sw/LibericaNIK/releases/download/23.0.4+1-17.0.11+10/bellsoft-liberica-vm-core-openjdk17.0.11+10-23.0.4+1-linux-amd64.tar.gz"
38-
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
39-
40-
- name: Download Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Linux)
41-
if: runner.os == 'Linux' && matrix.java-version == 21
42-
run: |
43-
download_url="https://github.com/bell-sw/LibericaNIK/releases/download/23.1.3+2-21.0.3+10/bellsoft-liberica-vm-core-openjdk21.0.3+10-23.1.3+2-linux-amd64.tar.gz"
44-
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
45-
46-
- name: Download Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Windows)
47-
if: runner.os == 'Windows' && matrix.java-version == 21
48-
shell: cmd
49-
run: |
50-
set download_url="https://github.com/bell-sw/LibericaNIK/releases/download/23.1.3+2-21.0.3+10/bellsoft-liberica-vm-core-openjdk21.0.3+10-23.1.3+2-windows-amd64.zip"
51-
C:\msys64\usr\bin\wget.exe -O %RUNNER_TEMP%\java_package.zip %download_url%
52-
53-
- name: Set up Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Linux)
54-
if: runner.os == 'Linux'
55-
uses: actions/setup-java@v3
56-
with:
57-
distribution: jdkfile
58-
java-version: ${{ matrix.java-version }}
59-
jdkFile: ${{ runner.temp }}/java_package.tar.gz
60-
architecture: x64
61-
62-
- name: Set up Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Windows)
63-
if: runner.os == 'Windows' && matrix.java-version == 21
64-
uses: actions/setup-java@v3
65-
with:
66-
distribution: jdkfile
67-
java-version: ${{ matrix.java-version }}
68-
jdkFile: ${{ runner.temp }}/java_package.zip
69-
architecture: x64
70-
71-
- name: Set up a Developer Command Prompt for Microsoft Visual C++ (Windows)
72-
if: runner.os == 'Windows' && matrix.java-version == 21
73-
uses: ilammy/msvc-dev-cmd@v1
25+
uses: gradle/actions/wrapper-validation@v3
7426

7527
- name: Set up GraalVM ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }}
76-
if: runner.os == 'Windows' && matrix.java-version == 17
7728
uses: graalvm/setup-graalvm@v1
7829
with:
7930
java-version: ${{ matrix.java-version }}
8031
distribution: ${{ matrix.graalvm-distribution }}
32+
cache: 'gradle'
8133

8234
- name: Report Java version
8335
run: |
@@ -99,7 +51,7 @@ jobs:
9951

10052
- name: Package Linux artifacts
10153
if: runner.os == 'Linux'
102-
uses: actions/upload-artifact@v3
54+
uses: actions/upload-artifact@v4
10355
with:
10456
name: jgit ${{ runner.os }} native image with SubstrateVM for Java ${{ matrix.java-version }}
10557
path: |
@@ -108,7 +60,7 @@ jobs:
10860
10961
- name: Package Windows artifacts
11062
if: runner.os == 'Windows'
111-
uses: actions/upload-artifact@v3
63+
uses: actions/upload-artifact@v4
11264
with:
11365
name: jgit ${{ runner.os }} native image with SubstrateVM for Java ${{ matrix.java-version }}
11466
path: |

.github/workflows/maven-build.yml

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -14,60 +14,19 @@ jobs:
1414
matrix:
1515
os: [ubuntu-latest, windows-latest]
1616
java-version: [17, 21]
17-
graalvm-distribution: ['graalvm-community']
17+
graalvm-distribution: ['liberica']
1818
fail-fast: false
1919

2020
steps:
2121
- name: Git checkout
22-
uses: actions/checkout@v3
23-
24-
- name: Download Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Linux)
25-
if: runner.os == 'Linux' && matrix.java-version == 17
26-
run: |
27-
download_url="https://github.com/bell-sw/LibericaNIK/releases/download/23.0.4+1-17.0.11+10/bellsoft-liberica-vm-core-openjdk17.0.11+10-23.0.4+1-linux-amd64.tar.gz"
28-
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
29-
30-
- name: Download Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Linux)
31-
if: runner.os == 'Linux' && matrix.java-version == 21
32-
run: |
33-
download_url="https://github.com/bell-sw/LibericaNIK/releases/download/23.1.3+2-21.0.3+10/bellsoft-liberica-vm-core-openjdk21.0.3+10-23.1.3+2-linux-amd64.tar.gz"
34-
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
35-
36-
- name: Download Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Windows)
37-
if: runner.os == 'Windows' && matrix.java-version == 21
38-
shell: cmd
39-
run: |
40-
set download_url="https://github.com/bell-sw/LibericaNIK/releases/download/23.1.3+2-21.0.3+10/bellsoft-liberica-vm-core-openjdk21.0.3+10-23.1.3+2-windows-amd64.zip"
41-
C:\msys64\usr\bin\wget.exe -O %RUNNER_TEMP%\java_package.zip %download_url%
42-
43-
- name: Set up Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Linux)
44-
if: runner.os == 'Linux'
45-
uses: actions/setup-java@v3
46-
with:
47-
distribution: jdkfile
48-
java-version: ${{ matrix.java-version }}
49-
jdkFile: ${{ runner.temp }}/java_package.tar.gz
50-
architecture: x64
51-
52-
- name: Set up Liberica NIK ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }} (Windows)
53-
if: runner.os == 'Windows' && matrix.java-version == 21
54-
uses: actions/setup-java@v3
55-
with:
56-
distribution: jdkfile
57-
java-version: ${{ matrix.java-version }}
58-
jdkFile: ${{ runner.temp }}/java_package.zip
59-
architecture: x64
60-
61-
- name: Set up a Developer Command Prompt for Microsoft Visual C++ (Windows)
62-
if: runner.os == 'Windows' && matrix.java-version == 21
63-
uses: ilammy/msvc-dev-cmd@v1
22+
uses: actions/checkout@v4
6423

6524
- name: Set up GraalVM ${{ matrix.graalvm-distribution }} for Java ${{ matrix.java-version }}
66-
if: runner.os == 'Windows' && matrix.java-version == 17
6725
uses: graalvm/setup-graalvm@v1
6826
with:
6927
java-version: ${{ matrix.java-version }}
7028
distribution: ${{ matrix.graalvm-distribution }}
29+
cache: 'maven'
7130

7231
- name: Report Java version
7332
run: |

README.md

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# Native executable for command-line JGit program (PGM)
22

3-
JGit PGM, part of the Eclipse [JGit](https://git.eclipse.org/c/jgit/jgit.git/) [project](http://www.eclipse.org/jgit/),
3+
[![Github Actions Build Status](https://github.com/chirontt/jgit.pgm.native/actions/workflows/gradle-build.yml/badge.svg)](https://github.com/chirontt/jgit.pgm.native/actions/workflows/gradle-build.yml)
4+
[![Github Actions Build Status](https://github.com/chirontt/jgit.pgm.native/actions/workflows/maven-build.yml/badge.svg)](https://github.com/chirontt/jgit.pgm.native/actions/workflows/maven-build.yml)
5+
6+
[JGit PGM](https://github.com/eclipse-jgit/jgit/tree/master/org.eclipse.jgit.pgm), part of the Eclipse [JGit](https://github.com/eclipse-jgit/jgit) [project](https://projects.eclipse.org/projects/technology.jgit),
47
is the stand-alone command-line Java program which provides Git commands similar
58
to the native [git](https://git-scm.com) commands, to access Git repositories.
69

7-
Usually distributed as a jar package, JGit [PGM](https://git.eclipse.org/c/jgit/jgit.git/tree/org.eclipse.jgit.pgm)
10+
Usually distributed as a jar package, JGit [PGM](https://github.com/eclipse-jgit/jgit/tree/master/org.eclipse.jgit.pgm)
811
is also distributed as a stand-alone, self-contained (with all dependencies), executable shell archive,
912
from Maven Central, like
1013
[this](https://repo1.maven.org/maven2/org/eclipse/jgit/org.eclipse.jgit.pgm/6.7.0.202309050840-r/org.eclipse.jgit.pgm-6.7.0.202309050840-r.sh)
@@ -18,7 +21,7 @@ This project aims to produce platform-specific, native executable `jgit` of the
1821
using the [GraalVM native-image](https://www.graalvm.org/reference-manual/native-image) utility,
1922
complementing the shell archive distribution.
2023

21-
Gradle and Maven build scripts are provided for building the project. The latest JGit version used here is 6.7.0.
24+
Gradle and Maven build scripts are provided for building the project. The latest JGit version used here is [7.2.0](https://projects.eclipse.org/projects/technology.jgit/releases/7.2.0).
2225

2326
## Build pre-requisites
2427

@@ -27,6 +30,19 @@ shows how to set up GraalVM and its native-image utility for common platforms.
2730
[Gluon](https://gluonhq.com/) also provides some setup [details](https://docs.gluonhq.com/#_platforms)
2831
for GraalVM native-image creation.
2932

33+
Actually, because this PGM application can produce a graphical window showing the commit logs,
34+
via the command `jgit glog`, e.g.:
35+
36+
<img src="jgit-glog.jpg"/>
37+
38+
and thus for a *Swing-based application* like this PGM project, an implementation of GraalVM called
39+
the [Liberica Native Image Kit](https://bell-sw.com/pages/downloads/native-image-kit/)
40+
can produce a *working* native executable better than the stock
41+
[GraalVM-CE](https://github.com/graalvm/graalvm-ce-builds) software could, for some reason.
42+
This Liberica NIK software is used in the GitHub Actions
43+
[build scripts](https://github.com/chirontt/jgit.pgm.native/tree/main/.github/workflows)
44+
of this project to successfully build and generate the relevant *working* native images for Linux and Windows.
45+
3046
The GraalVM native-image utility will use the configuration files in
3147
`src/graal-cfg/<platform>/META-INF/native-image` folder to assist in the native image generation.
3248

@@ -48,28 +64,28 @@ To produce a native executable, execute the `nativeCompile` task:
4864
The `nativeCompile` task would take a while to compile the application and link into an executable file.
4965
The resulting `jgit` executable file is:
5066

51-
build/native-image-linux/jgit
67+
build/native/nativeCompile/jgit
5268

5369
(or if building on a Windows machine, the executable file is:
5470

55-
build\native-image-windows\jgit.exe
71+
build\native\nativeCompile\jgit.exe
5672

5773
)
5874

5975
which can then be run directly (with relevant parameters):
6076

61-
./build/native-image-linux/jgit --version
62-
./build/native-image-linux/jgit ls-remote <some-repo-url>
63-
./build/native-image-linux/jgit clone <some-repo-url>
64-
./build/native-image-linux/jgit glog
77+
./build/native/nativeCompile/jgit --version
78+
./build/native/nativeCompile/jgit ls-remote <some-repo-url>
79+
./build/native/nativeCompile/jgit clone <some-repo-url>
80+
./build/native/nativeCompile/jgit glog
6581
etc.
6682

6783
(or if building on a Windows machine:
6884

69-
build\native-image-windows\jgit.exe --version
70-
build\native-image-windows\jgit.exe ls-remote <some-repo-url>
71-
build\native-image-windows\jgit.exe clone <some-repo-url>
72-
build\native-image-windows\jgit.exe glog
85+
build\native\nativeCompile\jgit.exe --version
86+
build\native\nativeCompile\jgit.exe ls-remote <some-repo-url>
87+
build\native\nativeCompile\jgit.exe clone <some-repo-url>
88+
build\native\nativeCompile\jgit.exe glog
7389
etc.
7490

7591
)
@@ -93,28 +109,28 @@ To produce a native executable, execute the `package` task:
93109
The `package` task would take a while to compile the application and link into an executable file.
94110
The resulting `jgit` executable file is:
95111

96-
target/native-image-linux/jgit
112+
target/jgit
97113

98114
(or if building on a Windows machine, the executable file is:
99115

100-
target\native-image-windows\jgit.exe
116+
target\jgit.exe
101117

102118
)
103119

104120
which can then be run directly (with relevant parameters):
105121

106-
./target/native-image-linux/jgit --version
107-
./target/native-image-linux/jgit ls-remote <some-repo-url>
108-
./target/native-image-linux/jgit clone <some-repo-url>
109-
./target/native-image-linux/jgit glog
122+
./target/jgit --version
123+
./target/jgit ls-remote <some-repo-url>
124+
./target/jgit clone <some-repo-url>
125+
./target/jgit glog
110126
etc.
111127

112128
(or if building on a Windows machine:
113129

114-
target\native-image-windows\jgit.exe --version
115-
target\native-image-windows\jgit.exe ls-remote <some-repo-url>
116-
target\native-image-windows\jgit.exe clone <some-repo-url>
117-
target\native-image-windows\jgit.exe glog
130+
target\jgit.exe --version
131+
target\jgit.exe ls-remote <some-repo-url>
132+
target\jgit.exe clone <some-repo-url>
133+
target\jgit.exe glog
118134
etc.
119135

120136
)

build.gradle

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
plugins {
22
id 'application'
3-
id 'org.graalvm.buildtools.native' version '0.10.5'
3+
id 'org.graalvm.buildtools.native' version '0.10.6'
44
}
55

66
tasks.wrapper {
7-
gradleVersion = '8.12.1'
7+
gradleVersion = '8.13'
88
distributionType = Wrapper.DistributionType.ALL
99
}
1010

1111
group = 'com.github.chirontt'
12-
version = '7.1.0'
12+
version = '7.2.0'
1313
description = 'JGit PGM native executable built by GraalVM'
1414

1515
ext {
1616
mainClassName = 'com.github.chirontt.jgit.graalvm.NativeMain'
17-
jgitReleaseVersion = '7.1.0.202411261347-r'
18-
slf4jVersion = '2.0.16'
17+
jgitReleaseVersion = '7.2.0.202503040940-r'
18+
slf4jVersion = '2.0.17'
1919
xzVersion = '1.10'
2020
graalvmVersion = '22.3.5'
2121
currentPlatform = getCurrentPlatform()
@@ -32,11 +32,14 @@ private static String getCurrentPlatform() {
3232

3333
repositories {
3434
mavenCentral()
35+
maven {
36+
url = "https://repo.eclipse.org/content/groups/releases/"
37+
}
3538
mavenLocal()
3639
}
3740

3841
compileJava {
39-
options.release = 11 //use GraalVM 21+ for compiling
42+
options.release = 17 //use GraalVM 21+ for compiling
4043
options.encoding = 'UTF-8'
4144
}
4245

@@ -127,7 +130,6 @@ graalvmNative {
127130
//list of GraalVM Feature implementation classes
128131
def featureClasses = [
129132
'com.github.chirontt.jgit.graalvm.BouncyCastleFeature',
130-
'com.github.chirontt.jgit.graalvm.EdDSAFeature',
131133
]
132134

133135
//packages/classes to be initialized at native image build time
@@ -177,9 +179,8 @@ graalvmNative {
177179
'org.eclipse.jgit.util.sha1.SHA1:rerun',
178180
]
179181

180-
//if (currentPlatform == 'linux') {
181-
jvmArgs.add('-Djava.awt.headless=false')
182-
//}
182+
jvmArgs.add('-Djava.awt.headless=false')
183+
183184
if (currentPlatform == 'linux') {
184185
runTimeReInitClasses.add('org.eclipse.jgit.util.FS_POSIX:rerun')
185186
}

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

jgit-glog.jpg

205 KB
Loading

0 commit comments

Comments
 (0)