diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 3dff70d0..0c3e468e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -24,6 +24,8 @@ on: - 'LICENSE' - '.github/ISSUE_TEMPLATE/**' - '.github/assets/**' + - '.github/workflows/**' + - 'renovate.json' pull_request: # The branches below must be a subset of the branches above branches: [ main ] @@ -36,6 +38,16 @@ on: - 'LICENSE' - '.github/ISSUE_TEMPLATE/**' - '.github/assets/**' + - '.github/workflows/**' + - 'renovate.json' + +permissions: + # required for all workflows + security-events: write + + # only required for workflows in private repositories + actions: read + contents: read jobs: analyze: @@ -48,15 +60,16 @@ jobs: language: [ 'java' ] steps: - name: Checkout repository - uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 #2.4.0 - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b #1.0.4 - name: Set up JDK 8 - uses: actions/setup-java@d202f5dbf7256730fb690ec59f6381650114feb2 + uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf #2.5.0 with: + distribution: adopt java-version: 8 - name: Initialize CodeQL - uses: github/codeql-action/init@46110c361b7e9ea1b6f9c6ba2cc941fa7a106cca + uses: github/codeql-action/init@d39d5d5c9707b926d517b1b292905ef4c03aa777 #v1.1.2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -66,6 +79,6 @@ jobs: - name: Build with Gradle run: ./gradlew build -x test - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@46110c361b7e9ea1b6f9c6ba2cc941fa7a106cca + uses: github/codeql-action/analyze@d39d5d5c9707b926d517b1b292905ef4c03aa777 #v1.1.2 - name: Check dependencies with Gradle run: ./gradlew ossIndexAudit -PossIndexUsername=${{ secrets.OSS_INDEX_USER }} -PossIndexPassword=${{ secrets.OSS_INDEX_PASSWORD }} diff --git a/.github/workflows/gradle-ci.yml b/.github/workflows/gradle-ci.yml index 2b3e930a..81e85179 100644 --- a/.github/workflows/gradle-ci.yml +++ b/.github/workflows/gradle-ci.yml @@ -15,6 +15,10 @@ on: - 'LICENSE' - '.github/ISSUE_TEMPLATE/**' - '.github/assets/**' + - '.github/workflows/**' + - 'renovate.json' + +permissions: read-all jobs: build: @@ -25,14 +29,15 @@ jobs: steps: # Set up build environment - - uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 #2.4.0 with: fetch-depth: 0 - name: Set up JDK 8 - uses: actions/setup-java@d202f5dbf7256730fb690ec59f6381650114feb2 + uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf #2.5.0 with: + distribution: adopt java-version: 8 - - uses: actions/cache@d1255ad9362389eac595a9ae406b8e8cb3331f16 # save wrapper + - uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed #2.1.7 save wrapper with: path: | ~/.gradle/wrapper diff --git a/.github/workflows/gradle-oss-index-scan.yml b/.github/workflows/gradle-oss-index-scan.yml index e9ca907a..e7e648fb 100644 --- a/.github/workflows/gradle-oss-index-scan.yml +++ b/.github/workflows/gradle-oss-index-scan.yml @@ -5,6 +5,8 @@ on: # * is a special character in YAML, so we have to quote this string - cron: '0 7 * * 1,3,5' +permissions: read-all + jobs: analyze: name: Analyze @@ -12,12 +14,13 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 #2.4.0 - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b #1.0.4 - name: Set up JDK 8 - uses: actions/setup-java@d202f5dbf7256730fb690ec59f6381650114feb2 + uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf #2.5.0 with: + distribution: adopt java-version: 8 - name: Check dependencies with Gradle run: ./gradlew ossIndexAudit -PossIndexUsername=${{ secrets.OSS_INDEX_USER }} -PossIndexPassword=${{ secrets.OSS_INDEX_PASSWORD }} diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index e583015c..331207a6 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -16,6 +16,10 @@ on: - 'LICENSE' - '.github/ISSUE_TEMPLATE/**' - '.github/assets/**' + - '.github/workflows/**' + - 'renovate.json' + +permissions: read-all jobs: build: @@ -24,14 +28,15 @@ jobs: steps: # Set up build environment - - uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 #2.4.0 with: fetch-depth: 0 - name: Set up JDK 8 - uses: actions/setup-java@d202f5dbf7256730fb690ec59f6381650114feb2 + uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf #2.5.0 with: + distribution: adopt java-version: 8 - - uses: actions/cache@d1255ad9362389eac595a9ae406b8e8cb3331f16 # save wrapper + - uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed #2.1.7 save wrapper with: path: | ~/.gradle/wrapper diff --git a/boosters/booster-cucumber-jvm/build.gradle b/boosters/booster-cucumber-jvm/build.gradle index dc7fd36d..84479cc3 100644 --- a/boosters/booster-cucumber-jvm/build.gradle +++ b/boosters/booster-cucumber-jvm/build.gradle @@ -7,16 +7,16 @@ project.ext { dependencies { implementation project(":mission-control") - implementation "org.slf4j:slf4j-api:${rootProject.ext.slf4jApiVersion}" - implementation "io.cucumber:cucumber-java:${rootProject.ext.cucumberVersion}" - implementation "io.cucumber:cucumber-junit:${rootProject.ext.cucumberVersion}" + implementation libs.slf4j.api + implementation libs.cucumber.java + implementation libs.cucumber.junit testImplementation project(":boosters:testkit") - testImplementation "org.springframework.boot:spring-boot-starter:${rootProject.ext.testSpringBootVersion}" - testImplementation "org.springframework.boot:spring-boot-starter-test:${rootProject.ext.testSpringBootVersion}" - testImplementation "io.cucumber:cucumber-spring:${rootProject.ext.cucumberVersion}" - testImplementation "org.junit.jupiter:junit-jupiter:${rootProject.ext.jupiterVersion}" - testImplementation "org.junit.vintage:junit-vintage-engine:${rootProject.ext.jupiterVersion}" - testImplementation "org.junit.platform:junit-platform-testkit:${rootProject.ext.jupiterTestKitVersion}" + testImplementation libs.spring.boot.starter + testImplementation libs.spring.boot.starter.test + testImplementation libs.cucumber.spring + testImplementation libs.jupiter.core + testImplementation libs.jupiter.vintage.engine + testImplementation libs.jupiter.platform.testkit } test { diff --git a/boosters/booster-junit-jupiter/build.gradle b/boosters/booster-junit-jupiter/build.gradle index cba2ed50..e84c1bcf 100644 --- a/boosters/booster-junit-jupiter/build.gradle +++ b/boosters/booster-junit-jupiter/build.gradle @@ -7,14 +7,14 @@ project.ext { dependencies { implementation project(":mission-control") - implementation "org.slf4j:slf4j-api:${rootProject.ext.slf4jApiVersion}" - implementation "org.junit.jupiter:junit-jupiter-api:${rootProject.ext.jupiterVersion}" - implementation "org.junit.jupiter:junit-jupiter:${rootProject.ext.jupiterVersion}" - implementation "org.junit.platform:junit-platform-reporting:${rootProject.ext.jupiterReportingVersion}" + implementation libs.slf4j.api + implementation libs.jupiter.api + implementation libs.jupiter.core + implementation libs.jupiter.platform.reporting testImplementation project(":boosters:testkit") - testImplementation "org.springframework.boot:spring-boot-starter:${rootProject.ext.testSpringBootVersion}" - testImplementation "org.springframework.boot:spring-boot-starter-test:${rootProject.ext.testSpringBootVersion}" - testImplementation "org.junit.platform:junit-platform-testkit:${rootProject.ext.jupiterTestKitVersion}" + testImplementation libs.spring.boot.starter + testImplementation libs.spring.boot.starter.test + testImplementation libs.jupiter.platform.testkit } test { diff --git a/boosters/booster-junit4/build.gradle b/boosters/booster-junit4/build.gradle index 439b2181..99afff88 100644 --- a/boosters/booster-junit4/build.gradle +++ b/boosters/booster-junit4/build.gradle @@ -7,13 +7,13 @@ project.ext { dependencies { implementation project(":mission-control") - implementation "junit:junit:${rootProject.ext.junit4Version}" + implementation libs.junit testImplementation project(":boosters:testkit") - testImplementation "org.springframework.boot:spring-boot-starter:${rootProject.ext.testSpringBootVersion}" - testImplementation "org.springframework.boot:spring-boot-starter-test:${rootProject.ext.testSpringBootVersion}" - testImplementation "org.junit.jupiter:junit-jupiter:${rootProject.ext.jupiterVersion}" - testImplementation "org.junit.vintage:junit-vintage-engine:${rootProject.ext.jupiterVersion}" - testImplementation "org.junit.platform:junit-platform-testkit:${rootProject.ext.jupiterTestKitVersion}" + testImplementation libs.spring.boot.starter + testImplementation libs.spring.boot.starter.test + testImplementation libs.jupiter.core + testImplementation libs.jupiter.vintage.engine + testImplementation libs.jupiter.platform.testkit } test { diff --git a/boosters/booster-testng/build.gradle b/boosters/booster-testng/build.gradle index 7edc8f0f..0a3f04d5 100644 --- a/boosters/booster-testng/build.gradle +++ b/boosters/booster-testng/build.gradle @@ -7,15 +7,15 @@ project.ext { dependencies { implementation project(":mission-control") - implementation "org.slf4j:slf4j-api:${rootProject.ext.slf4jApiVersion}" - implementation "org.testng:testng:${rootProject.ext.testNgVersion}" + implementation libs.slf4j.api + implementation libs.testng testImplementation project(":boosters:testkit") - testImplementation "org.springframework.boot:spring-boot-starter:${rootProject.ext.testSpringBootVersion}" - testImplementation("org.springframework.boot:spring-boot-starter-test:${rootProject.ext.testSpringBootVersion}") { + testImplementation libs.spring.boot.starter + testImplementation(libs.spring.boot.starter.test) { exclude group: "org.junit.jupiter" exclude group: "org.junit.vintage" } - testImplementation "org.testng:testng:${rootProject.ext.latestTestNgVersion}" + implementation libs.testng } test { diff --git a/boosters/testkit/build.gradle b/boosters/testkit/build.gradle index 5c5f1ece..8adbd0c8 100644 --- a/boosters/testkit/build.gradle +++ b/boosters/testkit/build.gradle @@ -7,12 +7,11 @@ project.ext { dependencies { implementation project(":mission-control") - implementation "org.springframework.boot:spring-boot-starter:${rootProject.ext.testSpringBootVersion}" - implementation "org.springframework.boot:spring-boot-starter-test:${rootProject.ext.testSpringBootVersion}" - implementation "ch.qos.logback:logback-core:${rootProject.ext.logbackVersion}" - implementation "ch.qos.logback:logback-classic:${rootProject.ext.logbackVersion}" - testImplementation "org.junit.jupiter:junit-jupiter-api:${rootProject.ext.jupiterPlatformVersion}" - testImplementation "org.junit.jupiter:junit-jupiter:${rootProject.ext.jupiterPlatformVersion}" + implementation libs.spring.boot.starter + implementation libs.spring.boot.starter.test + implementation libs.bundles.logback + testImplementation libs.jupiter.api + testImplementation libs.jupiter.core } test { diff --git a/build.gradle b/build.gradle index 357d486d..a995fc77 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { - id 'io.toolebox.git-versioner' version '1.6.5' - id 'org.sonatype.gradle.plugins.scan' version '2.2.2' apply false - id 'org.owasp.dependencycheck' version '6.5.2' apply false + alias(libs.plugins.versioner) + alias(libs.plugins.index.scan) + alias(libs.plugins.owasp.dependencycheck) } group = 'com.github.nagyesta.abort-mission' @@ -21,30 +21,6 @@ project.ext { maintainerUrl = 'https://github.com/nagyesta/' scmConnection = 'scm:git:https://github.com/nagyesta/abort-mission.git' scmProjectUrl = 'https://github.com/nagyesta/abort-mission/' - - // dependency versions - // minimum supported dependency version - junit4Version = '4.13.2' - jupiterVersion = '5.8.2' - jupiterReportingVersion = '1.8.2' - testNgVersion = '7.4.0' - testSpringBootVersion = '2.6.2' - - // internal build versions - jupiterTestKitVersion = '1.8.2' - jupiterPlatformVersion = '5.8.2' - latestTestNgVersion = '7.4.0' - mockitoCoreVersion = '4.1.0' - springBootVersion = '2.6.2' - springVersion = '5.3.14' - jdbiVersion = '3.18.0' - h2Version = '2.0.206' - gsonVersion = '2.8.9' - cucumberVersion = '7.1.0' - slf4jApiVersion = '1.7.32' - logbackVersion = '1.2.10' - jsonSchemaValidatorVersion = '1.0.64' - lombokVersion = '1.18.20' } versioner { @@ -113,7 +89,7 @@ configure(subprojects.findAll({ jacocoTestReport.finalizedBy jacocoTestCoverageVerification jacoco { - toolVersion = "0.8.2" + toolVersion = libs.versions.jacoco.get() } jacocoTestCoverageVerification { @@ -177,7 +153,7 @@ configure(subprojects.findAll({ .fromFile(rootProject.file('config/checkstyle/checkstyle-stylesheet.xsl') as String) } } - checkstyle.toolVersion = '9.2.1' + checkstyle.toolVersion = libs.versions.checkstyle.get() publishing { repositories { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..661ede92 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,79 @@ +[versions] +spring = "5.3.15" +springBoot = "2.6.3" +logback = "1.2.10" +jsonSchemaValidator = "1.0.64" +gson = "2.8.9" +slf4j = "1.7.32" +h2 = "2.1.210" +jdbi3 = "3.18.0" + +lombok = "1.18.22" + +junit4 = "4.13.2" +jupiter = "5.8.2" +jupiterPlatform = "1.8.2" +mockitoCore = "4.3.1" +cucumber = "7.2.3" +testNg = "7.5" + +lombokPlugin = "6.4.1" +springBootPlugin = "2.6.3" +minifyPlugin = "1.3.0" +gitVersionerPlugin = "1.6.7" +indexScanPlugin = "2.2.3" +owaspPlugin = "6.5.3" + +checkstyle = "9.2.1" +jacoco = "0.8.2" + +[libraries] +spring-core = { module = "org.springframework:spring-core", version.ref = "spring" } +spring-context = { module = "org.springframework:spring-context", version.ref = "spring" } + +spring-boot-starter = { module = "org.springframework.boot:spring-boot-starter", version.ref = "springBoot" } +spring-boot-starter-json = { module = "org.springframework.boot:spring-boot-starter-json", version.ref = "springBoot" } +spring-boot-starter-thymeleaf = { module = "org.springframework.boot:spring-boot-starter-thymeleaf", version.ref = "springBoot" } +spring-boot-configuration-processor = { module = "org.springframework.boot:spring-boot-configuration-processor", version.ref = "springBoot" } +spring-boot-starter-test = { module = "org.springframework.boot:spring-boot-starter-test", version.ref = "springBoot" } + +logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" } +logback-core = { module = "ch.qos.logback:logback-core", version.ref = "logback" } + +gson = { module = "com.google.code.gson:gson", version.ref = "gson" } +json-schema-validator = { module = "com.networknt:json-schema-validator", version.ref = "jsonSchemaValidator" } + +slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } + +h2 = { module = "com.h2database:h2", version.ref = "h2" } +jdbi3-sqlobject = { module = "org.jdbi:jdbi3-sqlobject", version.ref = "jdbi3" } + +lombok = { module = "org.projectlombok:lombok", version.ref = "lombok" } + +junit = { module = "junit:junit", version.ref = "junit4" } + +jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "jupiter" } +jupiter-core = { module = "org.junit.jupiter:junit-jupiter", version.ref = "jupiter" } +jupiter-vintage-engine = { module = "org.junit.vintage:junit-vintage-engine", version.ref = "jupiter" } +jupiter-platform-testkit = { module = "org.junit.platform:junit-platform-testkit", version.ref = "jupiterPlatform" } +jupiter-platform-reporting = { module = "org.junit.platform:junit-platform-reporting", version.ref = "jupiterPlatform" } + +mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockitoCore" } + +testng = { module = "org.testng:testng", version.ref = "testNg" } + +cucumber-java = { module = "io.cucumber:cucumber-java", version.ref = "cucumber" } +cucumber-junit = { module = "io.cucumber:cucumber-junit", version.ref = "cucumber" } +cucumber-spring = { module = "io.cucumber:cucumber-spring", version.ref = "cucumber" } + +[bundles] +spring-boot-repoort = ["spring-boot-starter", "spring-boot-starter-json", "spring-boot-starter-thymeleaf"] +logback = ["logback-classic", "logback-core"] + +[plugins] +spring-boot = { id = "org.springframework.boot", version.ref = "springBootPlugin" } +lombok = { id = "io.freefair.lombok", version.ref = "lombokPlugin" } +minify = { id = "org.gradlewebtools.minify", version.ref = "minifyPlugin" } +versioner = { id = "io.toolebox.git-versioner", version.ref = "gitVersionerPlugin" } +index-scan = { id = "org.sonatype.gradle.plugins.scan", version.ref = "indexScanPlugin" } +owasp-dependencycheck = { id = "org.owasp.dependencycheck", version.ref = "owaspPlugin" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 62d4c053..41d9927a 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c9c0f643..3486a4b6 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ # suppress inspection "SpellCheckingInspection" for whole file # suppress inspection "UnusedProperty" for whole file -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index fbd7c515..1b6c7873 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 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. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# 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 +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # 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"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index a9f778a7..ac1b06f9 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -54,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -64,21 +64,6 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line @@ -86,7 +71,7 @@ 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 %CMD_LINE_ARGS% +"%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 diff --git a/mission-control/build.gradle b/mission-control/build.gradle index 0012d45d..10461095 100644 --- a/mission-control/build.gradle +++ b/mission-control/build.gradle @@ -6,10 +6,10 @@ project.ext { } dependencies { - implementation "com.google.code.gson:gson:${rootProject.ext.gsonVersion}" - implementation "org.slf4j:slf4j-api:${rootProject.ext.slf4jApiVersion}" - testImplementation "org.junit.jupiter:junit-jupiter:${rootProject.ext.jupiterPlatformVersion}" - testImplementation "org.mockito:mockito-core:${rootProject.ext.mockitoCoreVersion}" + implementation libs.gson + implementation libs.slf4j.api + testImplementation libs.jupiter.core + testImplementation libs.mockito.core } test { diff --git a/mission-report/flight-evaluation-report/build.gradle b/mission-report/flight-evaluation-report/build.gradle index da31fae1..2193b5f8 100644 --- a/mission-report/flight-evaluation-report/build.gradle +++ b/mission-report/flight-evaluation-report/build.gradle @@ -1,9 +1,9 @@ plugins { - id 'org.springframework.boot' version '2.3.3.RELEASE' + alias(libs.plugins.spring.boot) id 'java' //noinspection SpellCheckingInspection - id "io.freefair.lombok" version "6.2.0" - id "org.padler.gradle.minify" version "1.6.0" + alias(libs.plugins.lombok) + alias(libs.plugins.minify) } group = "${rootProject.group}.reports" @@ -14,36 +14,43 @@ project.ext { } dependencies { - implementation "org.springframework.boot:spring-boot-starter:${rootProject.ext.springBootVersion}" - implementation "org.springframework.boot:spring-boot-starter-thymeleaf:${rootProject.ext.springBootVersion}" - implementation "org.springframework.boot:spring-boot-starter-json:${rootProject.ext.springBootVersion}" - implementation "com.networknt:json-schema-validator:${rootProject.ext.jsonSchemaValidatorVersion}" - implementation "ch.qos.logback:logback-core:${rootProject.ext.logbackVersion}" - implementation "ch.qos.logback:logback-classic:${rootProject.ext.logbackVersion}" - annotationProcessor "org.projectlombok:lombok:${rootProject.ext.lombokVersion}" - annotationProcessor "org.springframework.boot:spring-boot-configuration-processor:${rootProject.ext.springBootVersion}" - testImplementation "org.springframework.boot:spring-boot-starter-test:${rootProject.ext.springBootVersion}" - testImplementation "org.junit.jupiter:junit-jupiter:${rootProject.ext.jupiterPlatformVersion}" + implementation libs.bundles.spring.boot.repoort + implementation libs.json.schema.validator + implementation libs.bundles.logback + annotationProcessor libs.lombok + annotationProcessor libs.spring.boot.configuration.processor + testImplementation libs.spring.boot.starter.test + testImplementation libs.jupiter.core } minification { - cssSrcDir = file("src/main/templates/css") - cssDstDir = file("${buildDir}/css") - jsSrcDir = file("src/main/templates/js") - jsDstDir = file("${buildDir}/js") - - createCssSourceMaps = false - createJsSourceMaps = false - - js { - compilationLevel = "WHITESPACE_ONLY" + task cssMinifyBase(type: org.gradlewebtools.minify.CssMinifyTask) { + inputs.files(fileTree("src/main/templates/css", { + include "**.css" + exclude "all.min.css" + })) + outputs.dir("${buildDir}/css") + srcDir = file("src/main/templates/css") + dstDir = file("${buildDir}/css") + options.createSourceMaps = false + } + task jsMinifyBase(type: org.gradlewebtools.minify.JsMinifyTask) { + inputs.files(fileTree("src/main/templates/js", { + include "**.js" + exclude "all.min.js" + })) + outputs.dir("${buildDir}/js") + srcDir = file("src/main/templates/js") + dstDir = file("${buildDir}/js") + options.compilationLevel = "WHITESPACE_ONLY" + options.createSourceMaps = false } } task combineCss { inputs.files(fileTree("${buildDir}/css", { include "**.min.css" - })).skipWhenEmpty() + })).ignoreEmptyDirectories() outputs.file("${buildDir}/resources/main/templates/css/all.min.css") doLast { outputs.files.singleFile.withOutputStream { out -> @@ -64,13 +71,13 @@ task combineCss { } } } - dependsOn minify + dependsOn cssMinifyBase } task combineJs { inputs.files(fileTree("${buildDir}/js", { include "**.min.js" - })).skipWhenEmpty() + })).ignoreEmptyDirectories() outputs.file("${buildDir}/resources/main/templates/js/all.min.js") doLast { outputs.files.singleFile.withOutputStream { out -> @@ -86,13 +93,13 @@ task combineJs { } } } - dependsOn minify + dependsOn jsMinifyBase } task processTemplates { inputs.file("${buildDir}/resources/main/templates/js/all.min.js") inputs.file("${buildDir}/resources/main/templates/css/all.min.css") - inputs.files(fileTree("src/main/templates/html")).skipWhenEmpty() + inputs.files(fileTree("src/main/templates/html")).ignoreEmptyDirectories() outputs.dir("${buildDir}/resources/main/templates/html") doLast { for (template in inputs.files) { @@ -112,7 +119,7 @@ jar { } processResources.finalizedBy processTemplates -bootJar.dependsOn processTemplates +bootJarMainClassName.dependsOn processTemplates checkstyleMain.dependsOn processTemplates compileTestJava.dependsOn processTemplates javadoc.dependsOn processTemplates diff --git a/strongback/strongback-base/build.gradle b/strongback/strongback-base/build.gradle index 0524aeeb..e87e8018 100644 --- a/strongback/strongback-base/build.gradle +++ b/strongback/strongback-base/build.gradle @@ -7,12 +7,12 @@ project.ext { dependencies { implementation project(":mission-control") - implementation "org.springframework:spring-context:${rootProject.ext.springVersion}" - implementation "org.springframework:spring-core:${rootProject.ext.springVersion}" - implementation "org.slf4j:slf4j-api:${rootProject.ext.slf4jApiVersion}" - implementation "ch.qos.logback:logback-classic:${rootProject.ext.logbackVersion}" - testImplementation "org.junit.jupiter:junit-jupiter:${rootProject.ext.jupiterPlatformVersion}" - testImplementation "org.mockito:mockito-core:${rootProject.ext.mockitoCoreVersion}" + implementation libs.spring.context + implementation libs.spring.core + implementation libs.slf4j.api + implementation libs.logback.classic + testImplementation libs.jupiter.core + testImplementation libs.mockito.core } test { diff --git a/strongback/strongback-h2-supplier/build.gradle b/strongback/strongback-h2-supplier/build.gradle index 540a5cc5..1f22af7f 100644 --- a/strongback/strongback-h2-supplier/build.gradle +++ b/strongback/strongback-h2-supplier/build.gradle @@ -10,15 +10,15 @@ dependencies { transitive = false } implementation project(":mission-control") - implementation "com.h2database:h2:${rootProject.ext.h2Version}" - implementation "org.jdbi:jdbi3-sqlobject:${rootProject.ext.jdbiVersion}" + implementation libs.h2 + implementation libs.jdbi3.sqlobject testImplementation project(":boosters:testkit") testImplementation project(":boosters:booster-junit-jupiter") - testImplementation "org.junit.jupiter:junit-jupiter:${rootProject.ext.jupiterVersion}" - testImplementation "org.mockito:mockito-core:${rootProject.ext.mockitoCoreVersion}" - testImplementation "org.springframework.boot:spring-boot-starter:${rootProject.ext.testSpringBootVersion}" - testImplementation "org.springframework.boot:spring-boot-starter-test:${rootProject.ext.testSpringBootVersion}" - testImplementation "org.junit.platform:junit-platform-testkit:${rootProject.ext.jupiterTestKitVersion}" + testImplementation libs.jupiter.core + testImplementation libs.mockito.core + testImplementation libs.spring.boot.starter + testImplementation libs.spring.boot.starter.test + testImplementation libs.jupiter.platform.testkit } test { diff --git a/strongback/strongback-rmi-supplier/build.gradle b/strongback/strongback-rmi-supplier/build.gradle index 5c48f3eb..12608b17 100644 --- a/strongback/strongback-rmi-supplier/build.gradle +++ b/strongback/strongback-rmi-supplier/build.gradle @@ -10,14 +10,14 @@ dependencies { transitive = false } implementation project(":mission-control") - implementation "org.slf4j:slf4j-api:${rootProject.ext.slf4jApiVersion}" + implementation libs.slf4j.api testImplementation project(":boosters:testkit") testImplementation project(":boosters:booster-junit-jupiter") - testImplementation "org.junit.jupiter:junit-jupiter:${rootProject.ext.jupiterVersion}" - testImplementation "org.mockito:mockito-core:${rootProject.ext.mockitoCoreVersion}" - testImplementation "org.springframework.boot:spring-boot-starter:${rootProject.ext.testSpringBootVersion}" - testImplementation "org.springframework.boot:spring-boot-starter-test:${rootProject.ext.testSpringBootVersion}" - testImplementation "org.junit.platform:junit-platform-testkit:${rootProject.ext.jupiterTestKitVersion}" + testImplementation libs.jupiter.core + testImplementation libs.mockito.core + testImplementation libs.spring.boot.starter + testImplementation libs.spring.boot.starter.test + testImplementation libs.jupiter.platform.testkit } test {