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

#183: Gradle update #185

Merged
merged 8 commits into from
Nov 11, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
java-version: [ 17, 21 ]
java-version: [ 17, 21, 23 ]
steps:
- uses: actions/checkout@v2

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.jenetics/jpx/badge.svg)](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22jpx%22)
[![Javadoc](https://www.javadoc.io/badge/io.jenetics/jpx.svg)](http://www.javadoc.io/doc/io.jenetics/jpx)

**JPX** is a Java library for creating, reading and writing [GPS](https://en.wikipedia.org/wiki/Global_Positioning_System) data in [GPX](https://en.wikipedia.org/wiki/GPS_Exchange_Format) format. It is a *full* implementation of version [1.1](http://www.topografix.com/GPX/1/1/) and version [1.0](http://www.topografix.com/gpx_manual.asp) of the GPX format. The data classes are completely immutable and allows a functional programming style. They are working also nicely with the Java [Stream](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/stream/Stream.html) API. It is also possible to convert the location information into strings which are compatible to the [ISO 6709](http://en.wikipedia.org/wiki/ISO_6709) standard.
**JPX** is a Java library for creating, reading and writing [GPS](https://en.wikipedia.org/wiki/Global_Positioning_System) data in [GPX](https://en.wikipedia.org/wiki/GPS_Exchange_Format) format. It is a *full* implementation of version [1.1](http://www.topografix.com/GPX/1/1/) and version [1.0](http://www.topografix.com/gpx_manual.asp) of the GPX format. The data classes are completely immutable and allows a functional programming style. They are working also nicely with the Java [Stream](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/stream/Stream.html) API. It is also possible to convert the location information into strings which are compatible to the [ISO 6709](http://en.wikipedia.org/wiki/ISO_6709) standard.

Besides the basic functionality of reading and writing GPX files, the library also allows manipulating the read GPX object in a functional way.


## Dependencies

No external dependencies are needed by the _JPX_ library. It only needs **Java 17** to compile and run. It also runs and compiles with **Java 21**.
The _JPX_ library needs no external dependencies. It only needs **Java 17** to compile and run. It also runs and compiles with **Java 21** and **Java 23**.


## Building JPX

For building the JPX library you have to check out the `master` branch from GitHub.
For building the JPX library, you have to check out the `master` branch from GitHub.

$ git clone https://github.com/jenetics/jpx.git

Expand All @@ -32,7 +32,7 @@ For building the JPX library you have to check out the `master` branch from GitH

## Examples

### Creating new GPX object with 3 track-points
### Creating a new GPX object with 3 track-points

```java
final GPX gpx = GPX.builder()
Expand Down Expand Up @@ -283,7 +283,7 @@ final GPX gpx1 = gpx.toBuilder()

### XML configuration

The _JPX_ library uses the XML classes available in the Java [`java.xml`](https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/module-summary.html) module. This API is highly configurable and it is possible to replace the underlying implementation. Especially for Android, using different XML implementation is a necessity. _JPX_ uses three _factory_ classes for reading/writing GPX files:
The _JPX_ library uses the XML classes available in the Java [`java.xml`](https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/module-summary.html) module. This API is highly configurable, and it is possible to replace the underlying implementation. Especially for Android, using different XML implementation is a necessity. _JPX_ uses three _factory_ classes for reading/writing GPX files:

1. [`XMLInputFactory`](https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/javax/xml/stream/XMLInputFactory.html): This class is needed for reading GPX files.
1. [`XMLOutputFactory`](https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/javax/xml/stream/XMLOutputFactory.html): This class is needed for writing GPX files.
Expand All @@ -304,7 +304,7 @@ final class ValidatingDocumentBuilder extends XMLProvider {
}
}
```
And don't forget to create a `META-INF/services/io.jenetics.jpx.XMLProvider` file with the following content:
And remember to create a `META-INF/services/io.jenetics.jpx.XMLProvider` file with the following content:

```
org.acme.NonValidatingDocumentBuilder
Expand All @@ -314,7 +314,7 @@ org.acme.NonValidatingDocumentBuilder

The library is licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html).

Copyright 2016-2023 Franz Wilhelmstötter
Copyright 2016-2024 Franz Wilhelmstötter

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
11 changes: 7 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import io.jenetics.gradle.dsl.isModule
import io.jenetics.gradle.dsl.moduleName

/*
* Java GPX Library (@__identifier__@).
* Copyright (c) @__year__@ Franz Wilhelmstötter
Expand Down Expand Up @@ -31,7 +34,7 @@ plugins {
rootProject.version = JPX.VERSION

tasks.named<Wrapper>("wrapper") {
version = "8.4"
version = "8.10.2"
distributionType = Wrapper.DistributionType.ALL
}

Expand Down Expand Up @@ -111,8 +114,8 @@ fun setupJava(project: Project) {
"Build-OS-Arch" to Env.BUILD_OS_ARCH,
"Build-OS-Version" to Env.BUILD_OS_VERSION
)
if (project.extra.has("moduleName")) {
attr["Automatic-Module-Name"] = project.extra["moduleName"].toString()
if (project.isModule) {
attr["Automatic-Module-Name"] = project.moduleName
}

project.tasks.withType<Jar> {
Expand All @@ -129,7 +132,7 @@ fun setupTestReporting(project: Project) {
project.apply(plugin = "jacoco")

project.configure<JacocoPluginExtension> {
toolVersion = "0.8.9"
toolVersion = "0.8.12"
}

project.tasks {
Expand Down
18 changes: 9 additions & 9 deletions buildSrc/src/main/kotlin/Env.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ import java.time.format.DateTimeFormatter
* Common environment values.
*/
object Env {
val NOW = ZonedDateTime.now()
private val NOW: ZonedDateTime = ZonedDateTime.now()

val YEAR = Year.now();
private val YEAR: Year = Year.now();

val COPYRIGHT_YEAR = "2016-${YEAR}"

val DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")
private val DATE_FORMAT: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")

val BUILD_DATE = DATE_FORMAT.format(NOW)
val BUILD_DATE: String = DATE_FORMAT.format(NOW)

val BUILD_JDK = System.getProperty("java.version")
val BUILD_JDK: String = System.getProperty("java.version")

val BUILD_OS_NAME = System.getProperty("os.name")
val BUILD_OS_NAME: String = System.getProperty("os.name")

val BUILD_OS_ARCH = System.getProperty("os.arch")
val BUILD_OS_ARCH: String = System.getProperty("os.arch")

val BUILD_OS_VERSION = System.getProperty("os.version")
val BUILD_OS_VERSION: String = System.getProperty("os.version")

val BUILD_BY = System.getProperty("user.name")
val BUILD_BY: String = System.getProperty("user.name")

}

Expand Down
43 changes: 43 additions & 0 deletions buildSrc/src/main/kotlin/io/jenetics/gradle/dsl/Extensions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Java GPX Library (@__identifier__@).
* Copyright (c) @__year__@ Franz Wilhelmstötter
*
* 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
*
* http://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.
*
* Author:
* Franz Wilhelmstötter (franz.wilhelmstoetter@gmail.com)
*/

/**
* @author <a href="mailto:franz.wilhelmstoetter@gmail.com">Franz Wilhelmstötter</a>
* @since !__version__!
* @version !__version__!
*/
package io.jenetics.gradle.dsl

import org.gradle.api.Project
import org.gradle.kotlin.dsl.extra

/**
* Gets the module name of the project, as configured in the build file.
*/
var Project.moduleName: String
get() = if (this.isModule) this.extra.get("moduleName").toString()
else this.name
set(value) = this.extra.set("moduleName", value)

/**
* Checks if the project is configured as a module.
*/
val Project.isModule: Boolean
get() = this.extra.has("moduleName")
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
4 changes: 3 additions & 1 deletion jpx/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import io.jenetics.gradle.dsl.moduleName

/*
* Java GPX Library (@__identifier__@).
* Copyright (c) @__year__@ Franz Wilhelmstötter
Expand Down Expand Up @@ -31,7 +33,7 @@ plugins {

description = "JPX - Java GPX (GPS) Library"

extra["moduleName"] = "io.jenetics.jpx"
moduleName = "io.jenetics.jpx"

dependencies {
testImplementation(libs.assertj)
Expand Down
4 changes: 2 additions & 2 deletions jpx/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* format. It is a <em>full</em> implementation of version
* <a href="http://www.topografix.com/GPX/1/1/">1.1</a> and version
* <a href="http://www.topografix.com/gpx_manual.as">1.0</a> of the GPX format.
* The data classes are completely immutable and allows a functional programming
* The data classes are completely immutable and allow a functional programming
* style. It is also possible to convert the location information into strings
* which are compatible to the <a href="http://en.wikipedia.org/wiki/ISO_6709">
* ISO 6709</a> standard.
Expand Down Expand Up @@ -75,7 +75,7 @@
* final GPX gpx = GPX.Reader.of(GPX.Reader.Mode.LENIENT).read("track.xml");
* }</pre>
*
* This allows to read otherwise invalid GPX files, like
* This allows reading otherwise invalid GPX files, like
* <pre>{@code
* <?xml version="1.0" encoding="UTF-8"?>
* <gpx version="1.1" creator="GPSBabel - http://www.gpsbabel.org" xmlns="http://www.topografix.com/GPX/1/1">
Expand Down
8 changes: 4 additions & 4 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ pluginManagement {
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
library("assertj", "org.assertj:assertj-core:3.24.2")
library("assertj", "org.assertj:assertj-core:3.26.3")
library("commons-math", "org.apache.commons:commons-math3:3.6.1")
library("equalsverifier", "nl.jqno.equalsverifier:equalsverifier:3.15.3")
library("guava", "com.google.guava:guava:32.1.3-jre")
library("equalsverifier", "nl.jqno.equalsverifier:equalsverifier:3.17.1")
library("guava", "com.google.guava:guava:33.3.1-jre")
library("prngine", "io.jenetics:prngine:2.0.0")
library("rxjava", "io.reactivex.rxjava2:rxjava:2.2.21")
library("testng", "org.testng:testng:7.8.0")
library("testng", "org.testng:testng:7.10.2")
}
}
}
Expand Down
Loading