Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build a multi-release and provide a module descriptor #85

Merged
merged 1 commit into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,23 @@ on:


jobs:
buildon-linux:
build-on-linux:
strategy:
matrix:
os: [ ubuntu-latest ]
# New gradle doesn't run on <= 8
# Java >= 12 doesn't support source/target level 6 anymore
java: [ 8, 9, 10, 11 ]
# See CONTRIBUTING.md on JDK 11 build requirement
java: [ 11 ]
architecture: [ x86, x64 ]
distribution: [ 'zulu', 'adopt' ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
architecture: ${{ matrix.architecture }}
distribution: ${{ matrix.distribution }}
- name: Cache Gradle packages
uses: actions/cache@v2
with:
Expand All @@ -41,19 +42,20 @@ jobs:
strategy:
matrix:
os: [ macos-latest ]
# New gradle doesn't run on <= 8
# Java >= 12 doesn't support source/target level 6 anymore
java: [ 8, 9, 10, 11 ]
# See CONTRIBUTING.md on JDK 11 build requirement
java: [ 11 ]
# MacOS has no support for x86 ("Error: No valid download found for version 11.x and package jdk.")
architecture: [ x64 ]
distribution: [ 'zulu', 'adopt' ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
architecture: ${{ matrix.architecture }}
distribution: ${{ matrix.distribution }}
- name: Cache Gradle packages
uses: actions/cache@v2
with:
Expand All @@ -68,10 +70,10 @@ jobs:
strategy:
matrix:
os: [ windows-latest ]
# New gradle doesn't run on <= 8
# Java >= 12 doesn't support source/target level 6 anymore
java: [ 8, 9, 10, 11 ]
# See CONTRIBUTING.md on JDK 11 build requirement
java: [ 11 ]
architecture: [ x86, x64 ]
distribution: [ 'zulu', 'adopt' ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand All @@ -80,6 +82,7 @@ jobs:
with:
java-version: ${{ matrix.java }}
architecture: ${{ matrix.architecture }}
distribution: ${{ matrix.distribution }}
- name: Cache Gradle packages
uses: actions/cache@v2
with:
Expand Down
5 changes: 4 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Contributing

Feel free to fork the project and create pull requests. Please use the `develop` branch for new features,
I like to keep the `master` branch stable.
I like to keep the `master` branch stable.

Note that JDK 11 is required to build. Older versions do not allow creating a Multi-Release JAR and
newer versions do not support `--release 6`.
25 changes: 23 additions & 2 deletions argon2-jvm-nolibs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,41 @@ plugins {
id 'org.sonarqube' version '3.0'
}

sourceSets {
java11 {
java {
srcDirs = ['src/main/java', 'src/main/java11']
}
}
}

jar {
manifest {
attributes(
'Automatic-Module-Name': 'de.mkammerer.argon2.nolibs'
'Automatic-Module-Name': 'de.mkammerer.argon2.nolibs',
'Multi-Release': 'true'
)
}
into('META-INF/versions/11') {
from sourceSets.java11.output
exclude('de/**')
}
}

dependencies {
implementation 'net.java.dev.jna:jna:5.8.0'
}

compileJava11Java {
sourceCompatibility = 11
targetCompatibility = 11
options.compilerArgs.addAll([
'--release', '11',
'--module-path', sourceSets.main.compileClasspath.asPath]);
}

sonarqube {
properties {
property 'sonar.exclusions', 'src/main/java/de/mkammerer/argon2/jna/*.java'
}
}
}
5 changes: 5 additions & 0 deletions argon2-jvm-nolibs/src/main/java11/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module de.mkammerer.argon2.nolibs {
exports de.mkammerer.argon2;
exports de.mkammerer.argon2.jna;
requires com.sun.jna;
}
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ subprojects {
options.encoding = 'UTF-8'
}

compileJava {
options.compilerArgs.addAll(['--release', '6']);
}

java {
sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6
Expand Down