From 44ee641e4d6d2bd668e0a93c8f32f1a4be7f3d7e Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Tue, 16 Nov 2021 18:14:00 +0800 Subject: [PATCH 01/17] switch from Java 11 LTS to Java 17 LTS accept java 17 source code and produce java 17 bytecode. this will require running on machines with JDK17 installed. use gradle cache functionality built into setup-java Github action. --- .github/workflows/gradle.yml | 15 ++++++--------- build.gradle | 4 ++-- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 22691e6d1..75efdff52 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -32,18 +32,15 @@ jobs: with: fetch-depth: 0 # Java setup step completes very fast, no need to run in a preconfigured docker container. - - name: Set up JDK 11 - uses: actions/setup-java@v1 + - name: Set up JDK 17 + uses: actions/setup-java@v2 with: - java-version: 11 - - uses: actions/cache@v1 - id: cache - with: - path: ~/.gradle/caches - key: gradle-caches + distribution: zulu + java-version: 17 + cache: gradle - name: Show version string run: gradle -q printVersion | head -n1 - - name: Build and Test + - name: Build and test run: gradle build - name: Ensure shadow JAR is runnable as local backend run: | diff --git a/build.gradle b/build.gradle index ee0c41c9b..ef1523ab6 100644 --- a/build.gradle +++ b/build.gradle @@ -10,8 +10,8 @@ group = 'com.conveyal' version gitVersion() java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } jar { From d2732ca36cde71aa42391e4a914d3d33e5aa1dcb Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Tue, 16 Nov 2021 22:28:30 +0800 Subject: [PATCH 02/17] open java.base packages for reflection by Kryo --- build.gradle | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.gradle b/build.gradle index ef1523ab6..1ddb52341 100644 --- a/build.gradle +++ b/build.gradle @@ -34,7 +34,13 @@ shadowJar { mergeServiceFiles() } +// Allow reflective access by Kryo to normally closed Java internals. +// This is used for testing equality, but also for building automatic Kryo (de)serializers. test { + jvmArgs = ['--add-opens=java.base/java.io=ALL-UNNAMED', + '--add-opens=java.base/java.time=ALL-UNNAMED', + '--add-opens=java.base/java.time.zone=ALL-UNNAMED', + '--add-opens=java.base/java.lang=ALL-UNNAMED'] useJUnitPlatform() } From 76a8d24e44061c7cd9767f711bc1c6c2e3f520ee Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Fri, 13 Jan 2023 17:54:04 +0800 Subject: [PATCH 03/17] use Gradle toolchain and languageVersion.set() --- build.gradle | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 1ddb52341..ec8465c24 100644 --- a/build.gradle +++ b/build.gradle @@ -10,8 +10,11 @@ group = 'com.conveyal' version gitVersion() java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + toolchain { + languageVersion.set(JavaLanguageVersion.of(19)) + } + // sourceCompatibility = JavaVersion.VERSION_19 + // targetCompatibility = JavaVersion.VERSION_19 } jar { From 3d7e7c3c4b2f98dc6a189369ee3942d45516bd1b Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Fri, 13 Jan 2023 17:59:11 +0800 Subject: [PATCH 04/17] update github actions workflow to use JDK 19 --- .github/workflows/gradle.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 75efdff52..182d223a7 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -32,11 +32,11 @@ jobs: with: fetch-depth: 0 # Java setup step completes very fast, no need to run in a preconfigured docker container. - - name: Set up JDK 17 + - name: Set up JDK 19 uses: actions/setup-java@v2 with: - distribution: zulu - java-version: 17 + distribution: temurin + java-version: 19 cache: gradle - name: Show version string run: gradle -q printVersion | head -n1 From 2a41a9d6e7a3fca4222e233ce243eecc4f9662c2 Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Fri, 13 Jan 2023 18:03:19 +0800 Subject: [PATCH 05/17] use checkout and setup-java actions at v3 --- .github/workflows/gradle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 182d223a7..1acd9c298 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -28,12 +28,12 @@ jobs: # BUILD_TARGET:staging steps: # Starting in v2.2 checkout action fetches all tags when fetch-depth=0, for auto-versioning. - - uses: actions/checkout@v2.3.2 + - uses: actions/checkout@v3 with: fetch-depth: 0 # Java setup step completes very fast, no need to run in a preconfigured docker container. - name: Set up JDK 19 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: temurin java-version: 19 From 38fd1eb0848defb0e56f629c28ed8e276fed6c3f Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Fri, 13 Jan 2023 22:12:09 +0800 Subject: [PATCH 06/17] eliminate shadow JAR (was causing build failures) shadow jars defy intended Java design and are essentially obsolete instead set up Gradle to run application with the JARs on the classpath will require changing end-to-end/UI testing to use 'gradle runBackend' --- .github/workflows/gradle.yml | 5 +++-- build.gradle | 29 ++++++++++++++--------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 1acd9c298..0572b1348 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -42,10 +42,11 @@ jobs: run: gradle -q printVersion | head -n1 - name: Build and test run: gradle build - - name: Ensure shadow JAR is runnable as local backend + # Check that build product is able to start up as a backend server before handing it to end-to-end testing + - name: Ensure backend runnable run: | cp analysis.properties.template analysis.properties - gradle testShadowJarRunnable + gradle testRunnable -x test - name: Publish to GH Packages # Supply access token to build.gradle (used in publishing.repositories.maven.credentials) env: diff --git a/build.gradle b/build.gradle index ec8465c24..faf1df236 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id 'java' - id 'com.github.johnrengelman.shadow' version '6.0.0' + id 'application' id 'maven-publish' id 'com.palantir.git-version' version '0.12.3' } @@ -13,8 +13,6 @@ java { toolchain { languageVersion.set(JavaLanguageVersion.of(19)) } - // sourceCompatibility = JavaVersion.VERSION_19 - // targetCompatibility = JavaVersion.VERSION_19 } jar { @@ -33,10 +31,6 @@ jar { } } -shadowJar { - mergeServiceFiles() -} - // Allow reflective access by Kryo to normally closed Java internals. // This is used for testing equality, but also for building automatic Kryo (de)serializers. test { @@ -81,19 +75,24 @@ task copyDependencies(type: Copy) { into 'dependencies' } +application { + applicationDefaultJvmArgs = ['-Xmx4G'] + mainClass = 'com.conveyal.analysis.BackendMain' +} + // Run R5 as a local analysis backend with all dependencies on the classpath, without building a shadowJar. task runBackend (type: JavaExec) { - dependsOn(build) - classpath(sourceSets.main.runtimeClasspath) - main("com.conveyal.analysis.BackendMain") + dependsOn(build) + classpath(sourceSets.main.runtimeClasspath) + main("com.conveyal.analysis.BackendMain") } -// Start up an analysis local backend from a shaded JAR and ask it to shut down immediately. -// This is used to check in the automated build that the JAR is usable before we keep it. +// Start up an analysis local backend and ask it to shut down immediately. +// This is used to check in the automated build that the JAR is usable in end-to-end tests before we keep it. // Create a configuration properties file (by copying the template) before running this task. -task testShadowJarRunnable(type: JavaExec) { - dependsOn(shadowJar) - classpath(shadowJar.archiveFile.get()) +task testRunnable(type: JavaExec) { + dependsOn(build) + classpath(sourceSets.main.runtimeClasspath) main("com.conveyal.analysis.BackendMain") jvmArgs("-Dconveyal.immediate.shutdown=true") } From 379d5b89ce6f6aabb0c6e56fe36e6f9afd43be99 Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Fri, 13 Jan 2023 23:22:39 +0800 Subject: [PATCH 07/17] switch cypress integration testing to use gradle Update Github actions versions. Use Java 19. Set max heap to 7G using dedicated parameter. Use UI commit where 'yarn start-backend' performs 'gradle runBackend'. --- .github/workflows/cypress-integration.yml | 30 ++++++++++------------- build.gradle | 1 + 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/.github/workflows/cypress-integration.yml b/.github/workflows/cypress-integration.yml index 0fd16c257..c97742540 100644 --- a/.github/workflows/cypress-integration.yml +++ b/.github/workflows/cypress-integration.yml @@ -12,36 +12,32 @@ jobs: runs-on: ubuntu-latest steps: - # Checkout each repo into sub-directories - - uses: actions/checkout@v2 + # Checkout each the UI and R5 into separate subdirectories + - uses: actions/checkout@v3 with: repository: conveyal/analysis-ui ref: 1701bd9aea859a4714bc3f35f5bcf767a3256a64 + fetch-depth: 0 path: ui - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 path: r5 - # Build .jar and copy to ./ui directory (along with config file) - # Cache Gradle dependencies to speed up the shadow jar build - - uses: actions/cache@v1 - id: cache - with: - path: ~/.gradle/caches - key: gradle-caches - - uses: actions/setup-java@v1 + # Build R5 and check that it can start up as a backend + - uses: actions/setup-java@v3 with: - java-version: 11 - - run: gradle shadowJar -x test + distribution: temurin + java-version: 19 + cache: gradle + - run: | + cp analysis.properties.template analysis.properties + gradle testRunnable -x test working-directory: r5 - - run: cp $(ls ./r5/build/libs/*-all.jar | head -n1) ./ui/latest.jar - - run: cp ./r5/analysis.properties.template ./ui/analysis.properties - # Install / cache dependencies with Cypress to handle caching Cypress binary. - uses: actions/setup-node@v2 with: node-version: '12' - - uses: cypress-io/github-action@v2 + - uses: cypress-io/github-action@v3 env: NEXT_PUBLIC_BASEMAP_DISABLED: true NEXT_PUBLIC_CYPRESS: true diff --git a/build.gradle b/build.gradle index faf1df236..4f93bd941 100644 --- a/build.gradle +++ b/build.gradle @@ -83,6 +83,7 @@ application { // Run R5 as a local analysis backend with all dependencies on the classpath, without building a shadowJar. task runBackend (type: JavaExec) { dependsOn(build) + maxHeapSize('7G') classpath(sourceSets.main.runtimeClasspath) main("com.conveyal.analysis.BackendMain") } From 69cb79c9d71ed1125ba8d9f79fa995bc381e9c38 Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Wed, 18 Jan 2023 17:50:15 +0800 Subject: [PATCH 08/17] update to kryo 5, update dependencies match dependencies to kryo-tools 1.5 network file version bumped to nv3 update r5 automatic module name eliminate use of Integer constructor in response to deprecation warning --- build.gradle | 31 ++++++++++--------- .../r5/kryo/KryoNetworkSerializer.java | 16 +++++++--- .../java/com/conveyal/r5/util/Histogram.java | 4 +-- 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/build.gradle b/build.gradle index 37ca4894f..353b16ccf 100644 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,7 @@ jar { // Build-Jdk-Spec mimics a Maven manifest entry that helps us automatically install the right JVM. // Implementation-X attributes are needed for ImageIO (used by Geotools) to initialize in some environments. manifest { - attributes 'Automatic-Module-Name': 'com.conveyal.analysis', + attributes 'Automatic-Module-Name': 'com.conveyal.r5', 'Main-Class': 'com.conveyal.analysis.BackendMain', 'Build-Jdk-Spec': targetCompatibility.getMajorVersion(), 'Implementation-Title': 'Conveyal Analysis Backend', @@ -31,15 +31,15 @@ jar { } } -// Allow reflective access by Kryo to normally closed Java internals. -// This is used for testing equality, but also for building automatic Kryo (de)serializers. -// Until we use the Java module system (add module-info.java) we also need to add these same flags to non-test runs. +// Allow reflective access by ObjectDiffer to normally closed Java internals. Used for round-trip testing serialization. +// IntelliJ seems not to pass these JVM arguments when running tests from within the IDE, so the Kryo serialization +// tests may only succeed under command line Gradle. test { + useJUnitPlatform() jvmArgs = ['--add-opens=java.base/java.io=ALL-UNNAMED', '--add-opens=java.base/java.time=ALL-UNNAMED', '--add-opens=java.base/java.time.zone=ALL-UNNAMED', '--add-opens=java.base/java.lang=ALL-UNNAMED'] - useJUnitPlatform() } // `gradle publish` will upload both shadow and simple JAR to Github Packages @@ -127,6 +127,7 @@ repositories { // Put Open Source Geospatial before Maven Central to get JAI core, see https://stackoverflow.com/a/26993223 maven { url 'https://repo.osgeo.org/repository/release/' } mavenCentral() + mavenLocal() // TODO review whether we really need the repositories below maven { url 'https://maven.conveyal.com' } // For the polyline encoder @@ -140,10 +141,10 @@ configurations.all { dependencies { // Provides our logging API - implementation 'org.slf4j:slf4j-api:1.7.30' + implementation 'org.slf4j:slf4j-api:2.0.6' // Implementation of the logging API - implementation 'ch.qos.logback:logback-classic:1.2.3' + implementation 'ch.qos.logback:logback-classic:1.4.5' // Spark is an HTTP framework built on Jetty. Its name is the same as several other projects. implementation (group: 'com.sparkjava', name: 'spark-core', version: '2.7.2') { @@ -199,9 +200,6 @@ dependencies { // Commons IO gives us BOMInputStream for handling UTF-8 Byte Order Marks. implementation 'commons-io:commons-io:2.6' - // Guava provides a lot of functionality, collections, and tools "missing" from the Java standard library. - implementation 'com.google.guava:guava:28.2-jre' - // Java 8 rewrite of the Guava cache with asynchronous LoadingCaches. We don't currently use the async // capabilities, but Caffeine's LoadingCache syntax is more modern idiomatic Java than Guava's. implementation 'com.github.ben-manes.caffeine:caffeine:2.8.1' @@ -218,15 +216,19 @@ dependencies { // Commons Math gives us FastMath, MersenneTwister, and low-discrepancy vector generators. implementation 'org.apache.commons:commons-math3:3.0' - // Provides some shared serializers for Kryo. Introduces transitive dependencies on Guava, Trove, and Kryo. + // Provides some Kryo serializers for Guava and Trove collecitons. // Also provides classes for testing that a round trip through serialization reproduces the same network. // This is an external dependency (not merged into backend) because it's also used by OTP2. - // TODO arguably we should declare non-transitive dependencies on Guava, Trove, and Kryo since we use them directly - implementation 'com.conveyal:kryo-tools:1.3.0' + implementation 'com.conveyal:kryo-tools:1.5.0' + // Ensure the versions of the next three dependencies match the transitive dependencies of kryo-tools. + implementation 'com.esotericsoftware:kryo:5.4.0' + // Guava provides a lot of functionality, collections, and tools "missing" from the Java standard library. + implementation 'com.google.guava:guava:31.1-jre' // Trove supplies very efficient collections of primitive data types for Java. implementation 'net.sf.trove4j:trove4j:3.0.3' + // TODO eliminate custom Conveyal geojson library, use Geotools? implementation 'com.conveyal:jackson2-geojson:0.9' @@ -249,8 +251,7 @@ dependencies { ////// Test-only dependencies ////// // Java unit testing framework. - testImplementation(platform('org.junit:junit-bom:5.7.0')) - testImplementation('org.junit.jupiter:junit-jupiter') + testImplementation('org.junit.jupiter:junit-jupiter:5.9.2') // Chart drawing library for examining travel time distributions when crafting tests. // Although rarely used it should be low-impact: it is a test-only dependency with no transitive dependenices. diff --git a/src/main/java/com/conveyal/r5/kryo/KryoNetworkSerializer.java b/src/main/java/com/conveyal/r5/kryo/KryoNetworkSerializer.java index 78fd0ca05..552f5cca9 100644 --- a/src/main/java/com/conveyal/r5/kryo/KryoNetworkSerializer.java +++ b/src/main/java/com/conveyal/r5/kryo/KryoNetworkSerializer.java @@ -9,8 +9,9 @@ import com.esotericsoftware.kryo.io.Input; import com.esotericsoftware.kryo.io.Output; import com.esotericsoftware.kryo.serializers.ExternalizableSerializer; +import com.esotericsoftware.kryo.serializers.ImmutableCollectionsSerializers; import com.esotericsoftware.kryo.serializers.JavaSerializer; -import com.esotericsoftware.kryo.util.DefaultStreamFactory; +import com.esotericsoftware.kryo.util.DefaultInstantiatorStrategy; import com.esotericsoftware.kryo.util.MapReferenceResolver; import gnu.trove.impl.hash.TPrimitiveHash; import gnu.trove.list.array.TIntArrayList; @@ -43,13 +44,18 @@ public abstract class KryoNetworkSerializer { * It should also be changed when the semantic content changes from that produced by earlier versions, even when * the serialization format itself does not change. This will ensure newer workers will not load cached older files. * We considered using an ISO date string as the version but that could get confusing when seen in filenames. + * + * History of Network Version (NV) changes: + * nv3 use Kryo 5 serialization format + * nv2 2022-04-05 + * nv1 2021-04-30 stopped using r5 version string (which caused networks to be rebuilt for every new r5 version) */ - public static final String NETWORK_FORMAT_VERSION = "nv2"; + public static final String NETWORK_FORMAT_VERSION = "nv3"; public static final byte[] HEADER = "R5NETWORK".getBytes(); /** Set this to true to count instances and print a report including which serializer is handling each class. */ - private static final boolean COUNT_CLASS_INSTANCES = false; + private static final boolean COUNT_CLASS_INSTANCES = true; /** * Factory method ensuring that we configure Kryo exactly the same way when saving and loading networks, without @@ -61,7 +67,7 @@ public abstract class KryoNetworkSerializer { private static Kryo makeKryo () { Kryo kryo; if (COUNT_CLASS_INSTANCES) { - kryo = new Kryo(new InstanceCountingClassResolver(), new MapReferenceResolver(), new DefaultStreamFactory()); + kryo = new Kryo(new InstanceCountingClassResolver(), null); } else { kryo = new Kryo(); } @@ -88,7 +94,7 @@ private static Kryo makeKryo () { // The default strategy requires every class you serialize, even in your dependencies, to have a zero-arg // constructor (which can be private). The setInstantiatorStrategy method completely replaces that default // strategy. The nesting below specifies the Java approach as a fallback strategy to the default strategy. - kryo.setInstantiatorStrategy(new Kryo.DefaultInstantiatorStrategy(new SerializingInstantiatorStrategy())); + kryo.setInstantiatorStrategy(new DefaultInstantiatorStrategy(new SerializingInstantiatorStrategy())); return kryo; } diff --git a/src/main/java/com/conveyal/r5/util/Histogram.java b/src/main/java/com/conveyal/r5/util/Histogram.java index cad306e5b..a585e8b0e 100644 --- a/src/main/java/com/conveyal/r5/util/Histogram.java +++ b/src/main/java/com/conveyal/r5/util/Histogram.java @@ -111,9 +111,9 @@ public void displayHorizontal () { row.append(' '); } - String start = new Integer(minBin).toString(); + String start = Integer.toString(minBin); row.replace(0, start.length(), start); - String end = new Integer(maxBin).toString(); + String end = Integer.toString(maxBin); row.replace(row.length() - end.length(), row.length(), end); System.out.println(row); } From f9ffe2fe251b449ec0b433e0f198e21272cccccb Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Wed, 18 Jan 2023 21:46:17 +0800 Subject: [PATCH 09/17] disable class count when serializing --- src/main/java/com/conveyal/r5/kryo/KryoNetworkSerializer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/conveyal/r5/kryo/KryoNetworkSerializer.java b/src/main/java/com/conveyal/r5/kryo/KryoNetworkSerializer.java index 552f5cca9..67298b1bc 100644 --- a/src/main/java/com/conveyal/r5/kryo/KryoNetworkSerializer.java +++ b/src/main/java/com/conveyal/r5/kryo/KryoNetworkSerializer.java @@ -55,7 +55,7 @@ public abstract class KryoNetworkSerializer { public static final byte[] HEADER = "R5NETWORK".getBytes(); /** Set this to true to count instances and print a report including which serializer is handling each class. */ - private static final boolean COUNT_CLASS_INSTANCES = true; + private static final boolean COUNT_CLASS_INSTANCES = false; /** * Factory method ensuring that we configure Kryo exactly the same way when saving and loading networks, without From ca0c5d40cb9323c4f08c353b8fe8953a4cf860fa Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Thu, 19 Jan 2023 16:09:07 +0800 Subject: [PATCH 10/17] remove cypress-integration (moved to other repo) --- .github/workflows/cypress-integration.yml | 50 ----------------------- 1 file changed, 50 deletions(-) delete mode 100644 .github/workflows/cypress-integration.yml diff --git a/.github/workflows/cypress-integration.yml b/.github/workflows/cypress-integration.yml deleted file mode 100644 index c97742540..000000000 --- a/.github/workflows/cypress-integration.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: 'Cypress Integration Tests' - -on: [push] - -jobs: - cypressIntegration: - services: - mongo: - image: mongo - ports: - - 27017:27017 - - runs-on: ubuntu-latest - steps: - # Checkout each the UI and R5 into separate subdirectories - - uses: actions/checkout@v3 - with: - repository: conveyal/analysis-ui - ref: 1701bd9aea859a4714bc3f35f5bcf767a3256a64 - fetch-depth: 0 - path: ui - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - path: r5 - # Build R5 and check that it can start up as a backend - - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: 19 - cache: gradle - - run: | - cp analysis.properties.template analysis.properties - gradle testRunnable -x test - working-directory: r5 - # Install / cache dependencies with Cypress to handle caching Cypress binary. - - uses: actions/setup-node@v2 - with: - node-version: '12' - - uses: cypress-io/github-action@v3 - env: - NEXT_PUBLIC_BASEMAP_DISABLED: true - NEXT_PUBLIC_CYPRESS: true - NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }} - with: - build: yarn build - start: yarn start, yarn start-backend # runs frontend and java server together - wait-on: 'http://localhost:3000, http://localhost:7070/version' - wait-on-timeout: 60 - working-directory: ui From 64eb9e834391a922327a7807f4e5da670c5254a1 Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Thu, 19 Jan 2023 16:11:50 +0800 Subject: [PATCH 11/17] remove temporary mavenLocal, increase default heap --- build.gradle | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 353b16ccf..f0b27f7e0 100644 --- a/build.gradle +++ b/build.gradle @@ -77,7 +77,7 @@ task copyDependencies(type: Copy) { } application { - applicationDefaultJvmArgs = ['-Xmx4G'] + applicationDefaultJvmArgs = ['-Xmx6G'] mainClass = 'com.conveyal.analysis.BackendMain' } @@ -127,7 +127,6 @@ repositories { // Put Open Source Geospatial before Maven Central to get JAI core, see https://stackoverflow.com/a/26993223 maven { url 'https://repo.osgeo.org/repository/release/' } mavenCentral() - mavenLocal() // TODO review whether we really need the repositories below maven { url 'https://maven.conveyal.com' } // For the polyline encoder From a9aca0d2f0cee37c0ff232bab0944030e90e6cd6 Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Thu, 17 Aug 2023 19:16:41 +0800 Subject: [PATCH 12/17] bump from JDK 19 to 20 --- .github/workflows/gradle.yml | 4 ++-- build.gradle | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 0572b1348..408507570 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -32,11 +32,11 @@ jobs: with: fetch-depth: 0 # Java setup step completes very fast, no need to run in a preconfigured docker container. - - name: Set up JDK 19 + - name: Set up JDK 20 uses: actions/setup-java@v3 with: distribution: temurin - java-version: 19 + java-version: 20 cache: gradle - name: Show version string run: gradle -q printVersion | head -n1 diff --git a/build.gradle b/build.gradle index f0b27f7e0..5141da6d5 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ version gitVersion() java { toolchain { - languageVersion.set(JavaLanguageVersion.of(19)) + languageVersion.set(JavaLanguageVersion.of(20)) } } From 170e6cd7f25b687fd093909dccd1a400dbc6f020 Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Thu, 17 Aug 2023 19:28:35 +0800 Subject: [PATCH 13/17] mainClass assignment instead of function call --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index debbb1ec9..d0e5586f6 100644 --- a/build.gradle +++ b/build.gradle @@ -88,7 +88,7 @@ task runBackend (type: JavaExec) { dependsOn(build) maxHeapSize('7G') classpath(sourceSets.main.runtimeClasspath) - mainClass("com.conveyal.analysis.BackendMain") + mainClass = 'com.conveyal.analysis.BackendMain' } // Start up an analysis local backend and ask it to shut down immediately. @@ -97,7 +97,7 @@ task runBackend (type: JavaExec) { task testRunnable(type: JavaExec) { dependsOn(build) classpath(sourceSets.main.runtimeClasspath) - mainClass("com.conveyal.analysis.BackendMain") + mainClass = 'com.conveyal.analysis.BackendMain"' jvmArgs("-Dconveyal.immediate.shutdown=true") } From 2e172ee7bf7d249f0c397fd721a04336a4de41d0 Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Thu, 17 Aug 2023 22:02:02 +0800 Subject: [PATCH 14/17] remove stray quote, set java toolchain on exec --- build.gradle | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index d0e5586f6..d34f7451a 100644 --- a/build.gradle +++ b/build.gradle @@ -97,7 +97,7 @@ task runBackend (type: JavaExec) { task testRunnable(type: JavaExec) { dependsOn(build) classpath(sourceSets.main.runtimeClasspath) - mainClass = 'com.conveyal.analysis.BackendMain"' + mainClass = 'com.conveyal.analysis.BackendMain' jvmArgs("-Dconveyal.immediate.shutdown=true") } @@ -120,6 +120,12 @@ task createVersionProperties(dependsOn: processResources) { } } +// Fix inconsistent Gradle behavior (see https://github.com/gradle/gradle/issues/16791) +// By default JavaExec tasks use the JVM Gradle was launched with, ignoring the project-level toolchain. +tasks.withType(JavaExec).configureEach { + javaLauncher.set(javaToolchains.launcherFor(java.toolchain)) +} + classes { dependsOn createVersionProperties } From 5ebfe79013f32e6a0c2137ba3bfa450ce2e45b44 Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Thu, 17 Aug 2023 22:35:47 +0800 Subject: [PATCH 15/17] add jdk 20 to codeql actions workflow --- .github/workflows/codeql-analysis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b3db3cf8c..856321723 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -43,6 +43,15 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 + # Java setup step completes very fast, no need to run in a preconfigured docker container. + # CodeQL is intended to detect any Java toolchains added to the execution environment. + - name: Set up JDK 20 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 20 + cache: gradle + # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 From 4c60b459a26f6bdf8f519f35ac3e5bcb74a65227 Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Fri, 18 Aug 2023 16:58:28 +0800 Subject: [PATCH 16/17] update to new kryo-tools 1.6 Align transitive dependency versions. Kryo 5.5 is tested with Java 20. New major version of Guava has security fixes but no breaking changes. --- build.gradle | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index d34f7451a..3397237c1 100644 --- a/build.gradle +++ b/build.gradle @@ -146,10 +146,10 @@ configurations.all { dependencies { // Provides our logging API - implementation 'org.slf4j:slf4j-api:2.0.6' + implementation 'org.slf4j:slf4j-api:2.0.7' // Implementation of the logging API - implementation 'ch.qos.logback:logback-classic:1.4.5' + implementation 'ch.qos.logback:logback-classic:1.4.11' // Spark is an HTTP framework built on Jetty. Its name is the same as several other projects. implementation (group: 'com.sparkjava', name: 'spark-core', version: '2.7.2') { @@ -224,12 +224,12 @@ dependencies { // Provides some Kryo serializers for Guava and Trove collecitons. // Also provides classes for testing that a round trip through serialization reproduces the same network. // This is an external dependency (not merged into backend) because it's also used by OTP2. - implementation 'com.conveyal:kryo-tools:1.5.0' + implementation 'com.conveyal:kryo-tools:1.6.0' // Ensure the versions of the next three dependencies match the transitive dependencies of kryo-tools. - implementation 'com.esotericsoftware:kryo:5.4.0' + implementation 'com.esotericsoftware:kryo:5.5.0' // Guava provides a lot of functionality, collections, and tools "missing" from the Java standard library. - implementation 'com.google.guava:guava:31.1-jre' + implementation 'com.google.guava:guava:32.1.2-jre' // Trove supplies very efficient collections of primitive data types for Java. implementation 'net.sf.trove4j:trove4j:3.0.3' From 46a0434248b3cdffd47319262777e84006390bdf Mon Sep 17 00:00:00 2001 From: Andrew Byrd Date: Thu, 19 Oct 2023 14:43:46 +0200 Subject: [PATCH 17/17] update to corretto 21 JDK also updated copyright line --- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/gradle.yml | 6 +++--- LICENSE | 2 +- build.gradle | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 856321723..b53d54936 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -45,11 +45,11 @@ jobs: # Java setup step completes very fast, no need to run in a preconfigured docker container. # CodeQL is intended to detect any Java toolchains added to the execution environment. - - name: Set up JDK 20 + - name: Set up JDK 21 uses: actions/setup-java@v3 with: - distribution: temurin - java-version: 20 + distribution: corretto + java-version: 21 cache: gradle # Initializes the CodeQL tools for scanning. diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 408507570..7224c579c 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -32,11 +32,11 @@ jobs: with: fetch-depth: 0 # Java setup step completes very fast, no need to run in a preconfigured docker container. - - name: Set up JDK 20 + - name: Set up JDK 21 uses: actions/setup-java@v3 with: - distribution: temurin - java-version: 20 + distribution: corretto + java-version: 21 cache: gradle - name: Show version string run: gradle -q printVersion | head -n1 diff --git a/LICENSE b/LICENSE index dbe6da4ec..f845c96e3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Conveyal +Copyright (c) 2020-2023 Conveyal Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/build.gradle b/build.gradle index 3397237c1..7bc3a4fff 100644 --- a/build.gradle +++ b/build.gradle @@ -11,12 +11,12 @@ version gitVersion() java { toolchain { - languageVersion.set(JavaLanguageVersion.of(20)) + languageVersion.set(JavaLanguageVersion.of(21)) } } jar { - // For Java 11 Modules, specify a module name. + // For Java 11+ Modules, specify a module name. // Do not create module-info.java until all our dependencies specify a module name. // Main-Class BackendMain will start a local backend. // Build-Jdk-Spec mimics a Maven manifest entry that helps us automatically install the right JVM.