Skip to content

Commit

Permalink
Merge pull request #37 from ical4j/develop
Browse files Browse the repository at this point in the history
Added full Java module support
  • Loading branch information
benfortuna committed Feb 24, 2024
2 parents c3ebbfe + 8fea868 commit 7e79e79
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CHANGELOG_START_TAG=ical4j-extensions-2.0.0-beta2
CHANGELOG_END_TAG=HEAD

GRADLE_VERSION=7.6
GRADLE_VERSION=8.4
19 changes: 12 additions & 7 deletions .github/workflows/publish-snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,25 @@ jobs:
strategy:
fail-fast: false
matrix:
jdk: [ '8', '11', '17', '18' ]
jdk: [ '11', '17', '21' ] # removed JDK due to plugin errors

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ matrix.jdk }}
- uses: eskatos/gradle-command-action@v1
with:
arguments: check -x test --console=plain --warning-mode all
cache: 'gradle'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Execute Gradle build
run: ./gradlew check -x test --console=plain --warning-mode all

publish:
name: Publish Artifact
Expand All @@ -36,7 +41,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: temurin
Expand Down
1 change: 0 additions & 1 deletion bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ Export-Package: net.fortuna.ical4j.extensions.*
Import-Package: groovy.*;resolution:=optional, org.codehaus.groovy*;resolution:=optional, *
Require-Capability: osgi.extender;filter:="(osgi.extender=osgi.serviceloader.registrar)", osgi.extender;filter:="(osgi.extender=osgi.serviceloader.processor)", osgi.serviceloader;filter:="(osgi.serviceloader=net.fortuna.ical4j.vcard.*)";cardinality:=multiple
Provide-Capability: osgi.serviceloader;osgi.serviceloader=net.fortuna.ical4j.model.ParameterFactory, osgi.serviceloader;osgi.serviceloader=net.fortuna.ical4j.model.PropertyFactory, osgi.serviceloader;osgi.serviceloader=net.fortuna.ical4j.validate.CalendarValidatorFactory
Automatic-Module-Name: org.mnode.ical4j.extensions
53 changes: 41 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ plugins {
id 'jacoco'
id 'signing'
id 'pl.allegro.tech.build.axion-release' version '1.13.6'
id "nebula.optional-base" version "7.0.0"
id "com.palantir.revapi" version "1.7.0"
id "biz.aQute.bnd.builder" version "$bndVersion"
id 'org.javamodularity.moduleplugin' version '1.8.14'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 11
targetCompatibility = 11

repositories {
mavenCentral()
Expand All @@ -26,17 +26,24 @@ repositories {
java {
withJavadocJar()
withSourcesJar()

registerFeature('groovyDsl') {
usingSourceSet(sourceSets.main)
}
}

sourcesJar.dependsOn ':compileModuleInfoJava'

dependencies {
api "org.mnode.ical4j:ical4j:$ical4jVersion",
"org.mnode.ical4j:ical4j-vcard:$ical4jVCardVersion",
'com.sun.mail:jakarta.mail:2.0.1'

implementation "org.codehaus.groovy:groovy:$groovyVersion", optional
// optional groovy DSL for calendar builder..
groovyDslImplementation "org.codehaus.groovy:groovy:$groovyVersion"

// junit
testImplementation 'org.junit.vintage:junit-vintage-engine:5.8.2'
testImplementation "org.junit.vintage:junit-vintage-engine:$junitVintageVersion"

// groovy-test
testImplementation "org.codehaus.groovy:groovy-test:$groovyVersion"
Expand All @@ -48,14 +55,41 @@ dependencies {
"org.apache.logging.log4j:log4j:$log4jVersion"
}

compileTestJava {
moduleOptions {
compileOnClasspath = true
}
}

test {
moduleOptions {
runOnClasspath = true
}

useJUnitPlatform()

finalizedBy jacocoTestCoverageVerification, jacocoTestReport // Ensure Jacoco is run after tests have completed

jvmArgs = ["-Duser.timezone=UTC"] // Some tests require default timezone to be UTC
}

jacocoTestCoverageVerification {
dependsOn test
violationRules {
rule {
limit {
minimum = 0.7
}
failOnViolation = false
}
}
}

jacocoTestReport {
dependsOn test
reports {
xml.enabled true
html.enabled 'true' == jacoco_htmlReport
xml.required = true
html.required = jacoco_htmlReport == 'true'
}
}

Expand Down Expand Up @@ -91,11 +125,6 @@ jar {
}
}

artifacts {
archives javadocJar
archives sourcesJar
}

revapi {
oldVersion = revApiOldVersion
}
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
ical4jVersion=4.0.0-rc2
ical4jVCardVersion=2.0.0-beta2

groovyVersion=3.0.10
slf4jVersion=2.0.7
log4jVersion=2.20.0
ical4jVersion=4.0.0-rc4
ical4jVCardVersion=2.0.0-beta3
groovyVersion=3.0.20
slf4jVersion=2.0.9
log4jVersion=2.22.1
bndVersion=6.2.0
jacoco_htmlReport=true
revApiOldVersion=1.0.4
junitVintageVersion=5.10.2
spockVersion=2.4-M1-groovy-3.0
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
18 changes: 14 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -205,6 +209,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
15 changes: 9 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module ical4j.extensions {
requires java.base;
requires ical4j.core;
requires ical4j.vcard;

requires org.threeten.extra;
requires static org.codehaus.groovy;

exports net.fortuna.ical4j.extensions.alarm;
exports net.fortuna.ical4j.extensions.caldav.parameter;
exports net.fortuna.ical4j.extensions.caldav.property;
exports net.fortuna.ical4j.extensions.concept;
exports net.fortuna.ical4j.extensions.data;
exports net.fortuna.ical4j.extensions.groupwise;
exports net.fortuna.ical4j.extensions.link;
exports net.fortuna.ical4j.extensions.location;
exports net.fortuna.ical4j.extensions.lotus;
exports net.fortuna.ical4j.extensions.outlook;
exports net.fortuna.ical4j.extensions.parameter;
exports net.fortuna.ical4j.extensions.participant;
exports net.fortuna.ical4j.extensions.property;
exports net.fortuna.ical4j.extensions.validate;
}

0 comments on commit 7e79e79

Please sign in to comment.