diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 9e4dccd..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..2c97cfa --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,31 @@ +name: build + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + java: + strategy: + matrix: + java: [25] + os: ['ubuntu-latest'] + runs-on: ${{ matrix.os }} + name: Build on ${{ matrix.os }} on Java ${{ matrix.java }} + steps: + - uses: actions/checkout@v6 + - name: Set up JDK ${{ matrix.java }} + uses: actions/setup-java@v5 + with: + distribution: corretto + java-version: ${{ matrix.java }} + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v6 + - name: Build with Gradle + run: | + cd java && ./gradlew --no-daemon -s :build + # TODO: add golang build \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8ef835c --- /dev/null +++ b/.gitignore @@ -0,0 +1,87 @@ +.DS_Store + +# Go - https://github.com/github/gitignore/blob/main/Go.gitignore + +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Code coverage profiles and other test artifacts +*.out +coverage.* +*.coverprofile +profile.cov + +# Dependency directories (remove the comment below to include it) +# vendor/ + +# Go workspace file +go.work +go.work.sum + +# env file +.env + +# Editor/IDE +# .idea/ +# .vscode/ + +# Java - https://github.com/github/gitignore/blob/main/Java.gitignore + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +replay_pid* + +# Gradle - https://github.com/github/gitignore/blob/main/Gradle.gitignore + +.gradle +**/build/ +!**/src/**/build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Avoid ignore Gradle wrapper properties +!gradle-wrapper.properties + +# Cache of project +.gradletasknamecache + +# Eclipse Gradle plugin generated files +# Eclipse Core +.project +# JDT-specific (Eclipse Java Development Tools) +.classpath \ No newline at end of file diff --git a/java/build.gradle.kts b/java/build.gradle.kts index d6a28d2..f3c670b 100644 --- a/java/build.gradle.kts +++ b/java/build.gradle.kts @@ -14,12 +14,12 @@ plugins { // Apply the java-library plugin for API and implementation separation. `java-library` - id("io.freefair.lombok") version "8.6" - id("com.github.johnrengelman.shadow") version "7.1.2" + id("io.freefair.lombok") version "9.5.0" + id("com.gradleup.shadow") version "9.4.2" jacoco - id("com.github.spotbugs") version "6.0.7" + id("com.github.spotbugs") version "6.5.6" checkstyle - id("org.cyclonedx.bom") version "1.10.0" + id("org.cyclonedx.bom") version "3.2.4" } repositories { @@ -49,7 +49,7 @@ dependencies { implementation("org.apache.commons:commons-lang3:3.0") implementation("com.jayway.jsonpath:json-path:2.9.0") implementation("io.github.resilience4j:resilience4j-retry:2.2.0") - implementation(enforcedPlatform("com.fasterxml.jackson:jackson-bom:2.17.0")) + implementation(platform("com.fasterxml.jackson:jackson-bom:2.17.0")) implementation("com.fasterxml.jackson.core:jackson-core") implementation("com.fasterxml.jackson.core:jackson-annotations") implementation("com.fasterxml.jackson.core:jackson-databind") @@ -70,7 +70,7 @@ dependencies { } jacoco { - toolVersion = "0.8.9" // Use the latest version available + toolVersion = "0.8.15" // Use the latest version available } tasks.jacocoTestReport { @@ -114,7 +114,7 @@ tasks.jacocoTestCoverageVerification { } spotbugs { - toolVersion.set("4.8.3") + toolVersion.set("4.10.2") ignoreFailures.set(false) showProgress.set(true) effort.set(com.github.spotbugs.snom.Effort.MAX) @@ -193,16 +193,14 @@ tasks.javadoc { } } +java { + withJavadocJar() + withSourcesJar() +} + tasks { - jar { - archiveBaseName.set("DemandDrivenTrafficEvaluator") - archiveClassifier.set("core") - archiveVersion.set("2.1.0") // Set your library version - } named("shadowJar") { - archiveBaseName.set("DemandDrivenTrafficEvaluator") archiveClassifier.set("fat") - archiveVersion.set("2.1.0") // Set your library version destinationDirectory.set(layout.buildDirectory.dir("libs")) configurations = listOf(project.configurations.runtimeClasspath.get()) diff --git a/java/gradle.properties b/java/gradle.properties index 70ebcc6..9bd28c2 100644 --- a/java/gradle.properties +++ b/java/gradle.properties @@ -4,6 +4,7 @@ # This file was generated by the Gradle 'init' task. # https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties -org.gradle.parallel=true -org.gradle.caching=true +version=2.1.0 +org.gradle.parallel=true +org.gradle.caching=true \ No newline at end of file diff --git a/java/gradle/wrapper/gradle-wrapper.jar b/java/gradle/wrapper/gradle-wrapper.jar index a4b76b9..b1b8ef5 100644 Binary files a/java/gradle/wrapper/gradle-wrapper.jar and b/java/gradle/wrapper/gradle-wrapper.jar differ diff --git a/java/gradle/wrapper/gradle-wrapper.properties b/java/gradle/wrapper/gradle-wrapper.properties index 0aaefbc..df6a6ad 100644 --- a/java/gradle/wrapper/gradle-wrapper.properties +++ b/java/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,9 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip networkTimeout=10000 +retries=0 +retryBackOffMs=500 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/java/gradlew b/java/gradlew index 2f856d1..b9bb139 100755 --- a/java/gradlew +++ b/java/gradlew @@ -1,9 +1,7 @@ #!/bin/sh -# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -# SPDX-License-Identifier: Apache-2.0 # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -59,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -88,8 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s -' "$PWD" ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -117,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -175,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -208,15 +203,14 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/java/gradlew.bat b/java/gradlew.bat index 40cf1b5..24c62d5 100644 --- a/java/gradlew.bat +++ b/java/gradlew.bat @@ -1,6 +1,3 @@ -@rem Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -@rem SPDX-License-Identifier: Apache-2.0 - @rem @rem Copyright 2015 the original author or authors. @rem @@ -26,8 +23,8 @@ @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @@ -54,7 +51,7 @@ echo. 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo location of your Java installation. 1>&2 -goto fail +"%COMSPEC%" /c exit 1 :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -68,30 +65,18 @@ echo. 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo location of your Java installation. 1>&2 -goto fail +"%COMSPEC%" /c exit 1 :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -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! -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 +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel -:omega +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/java/settings.gradle.kts b/java/settings.gradle.kts index e1f83b8..1a8e8da 100644 --- a/java/settings.gradle.kts +++ b/java/settings.gradle.kts @@ -15,5 +15,4 @@ plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" } -rootProject.name = "DemandDrivenTrafficEvaluator" -include("lib") +rootProject.name = "demand-driven-traffic-evaluator" diff --git a/java/src/main/resources/log4j2.xml b/java/src/main/resources/log4j2.xml index fa92283..d755010 100644 --- a/java/src/main/resources/log4j2.xml +++ b/java/src/main/resources/log4j2.xml @@ -10,8 +10,8 @@ + fileName="build/logs/application.log" + filePattern="build/logs/application-%d{yyyy-MM-dd}-%i.log">