diff --git a/api/build.gradle b/api/build.gradle index 01c890a..c946cfe 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -1,35 +1,41 @@ plugins { - id 'ssg.common' + id 'ssg-common' + id 'java-library' + id 'java-test-fixtures' } repositories { mavenCentral() } +configurations { + testFixturesApi { + extendsFrom configurations.testing + } +} + dependencies { + api libs.groovy + + compileOnlyApi libs.jetbrains.anontations + + api libs.groovy + implementation libs.groovy.templates + implementation libs.commonmark + implementation libs.commonmark.frontmatter + implementation libs.jsoup + // https://archiva.jessebrault.com/#artifact/com.jessebrault.gst/lib implementation 'com.jessebrault.gst:lib:0.0.5' - // https://mvnrepository.com/artifact/org.apache.groovy/groovy-templates - implementation 'org.apache.groovy:groovy-templates:4.0.12' - - // https://mvnrepository.com/artifact/org.commonmark/commonmark - implementation 'org.commonmark:commonmark:0.21.0' - - // https://mvnrepository.com/artifact/org.commonmark/commonmark-ext-yaml-front-matter - implementation 'org.commonmark:commonmark-ext-yaml-front-matter:0.21.0' - - // https://mvnrepository.com/artifact/org.jsoup/jsoup - implementation 'org.jsoup:jsoup:1.16.1' - // https://mvnrepository.com/artifact/org.jgrapht/jgrapht-core implementation 'org.jgrapht:jgrapht-core:1.5.2' // So we can use Grape dependency management // https://mvnrepository.com/artifact/org.apache.ivy/ivy - runtimeOnly 'org.apache.ivy:ivy:2.5.1' + runtimeOnly 'org.apache.ivy:ivy:2.5.2' } jar { archivesBaseName = 'ssg-api' -} \ No newline at end of file +} diff --git a/buildSrc/src/main/groovy/ssg-common.gradle b/buildSrc/src/main/groovy/ssg-common.gradle new file mode 100644 index 0000000..187f72f --- /dev/null +++ b/buildSrc/src/main/groovy/ssg-common.gradle @@ -0,0 +1,39 @@ +plugins { + id 'com.jessebrault.jbarchiva' + id 'java' + id 'groovy' +} + +group 'com.jessebrault.ssg' +version '0.4.0' + +repositories { + mavenCentral() +} + +configurations { + testing { + canBeConsumed = false + canBeResolved = false + } + testImplementation { + extendsFrom configurations.testing + } +} + +dependencies { + implementation libs.slf4j.api + + testing libs.slf4j.api + testing libs.junit.jupiter.api + testing libs.mockito.core + testing libs.mockito.junit.jupiter +} + +testing { + suites { + test { + useJUnitJupiter() + } + } +} diff --git a/buildSrc/src/main/groovy/ssg.common.gradle b/buildSrc/src/main/groovy/ssg.common.gradle deleted file mode 100644 index 3af081e..0000000 --- a/buildSrc/src/main/groovy/ssg.common.gradle +++ /dev/null @@ -1,69 +0,0 @@ -plugins { - id 'com.jessebrault.jbarchiva' - id 'groovy' - id 'java-library' - id 'java-test-fixtures' -} - -group 'com.jessebrault.ssg' -version '0.2.0' - -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 - -repositories { - mavenCentral() -} - -dependencies { - // https://mvnrepository.com/artifact/org.apache.groovy/groovy - api 'org.apache.groovy:groovy:4.0.12' - - // https://mvnrepository.com/artifact/org.jetbrains/annotations - api 'org.jetbrains:annotations:24.0.0' - - /** - * Logging - */ - // https://mvnrepository.com/artifact/org.slf4j/slf4j-api - api 'org.slf4j:slf4j-api:2.0.7' - - testFixturesApi 'org.slf4j:slf4j-api:2.0.7' - - /** - * TESTING - */ - // https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api - testFixturesApi 'org.junit.jupiter:junit-jupiter-api:5.9.2' - - // https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2' - - /** - * Mockito - */ - // https://mvnrepository.com/artifact/org.mockito/mockito-core - testFixturesApi 'org.mockito:mockito-core:5.1.1' - - // https://mvnrepository.com/artifact/org.mockito/mockito-junit-jupiter - testFixturesApi 'org.mockito:mockito-junit-jupiter:5.1.1' - - /** - * Test Logging - */ - // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j2-impl - testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j2-impl:2.20.0' - - // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core - testRuntimeOnly 'org.apache.logging.log4j:log4j-core:2.20.0' - - // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j2-impl - testFixturesRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j2-impl:2.20.0' - - // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core - testFixturesRuntimeOnly 'org.apache.logging.log4j:log4j-core:2.20.0' -} - -test { - useJUnitPlatform() -} diff --git a/cli/build.gradle b/cli/build.gradle index b8ede26..0574948 100644 --- a/cli/build.gradle +++ b/cli/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'ssg.common' + id 'ssg-common' id 'application' } @@ -9,21 +9,11 @@ repositories { dependencies { implementation project(':api') + implementation libs.picocli + implementation libs.log4j2.api + implementation libs.log4j2.core - // https://mvnrepository.com/artifact/info.picocli/picocli - implementation 'info.picocli:picocli:4.7.1' - - /** - * Logging - */ - // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api - implementation 'org.apache.logging.log4j:log4j-api:2.20.0' - - // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j2-impl - runtimeOnly 'org.apache.logging.log4j:log4j-slf4j2-impl:2.20.0' - - // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core - implementation 'org.apache.logging.log4j:log4j-core:2.20.0' + runtimeOnly libs.log4j2.slf4j2.impl } application { @@ -40,4 +30,4 @@ distributions { //noinspection GroovyAssignabilityCheck distributionBaseName = 'ssg' } -} \ No newline at end of file +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..b8c5504 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,22 @@ +[versions] +commonmark = '0.22.0' +groovy = '4.0.21' +log4j2 = '2.23.1' +mockito = '5.12.0' +junit = '5.10.2' + +[libraries] +commonmark = { module = 'org.commonmark:commonmark', version.ref = 'commonmark' } +commonmark-frontmatter = { module = 'org.commonmark:commonmark-ext-yaml-front-matter', version.ref = 'commonmark' } +groovy = { module = 'org.apache.groovy:groovy', version.ref = 'groovy' } +groovy-templates = { module = 'org.apache.groovy:groovy-templates', version.ref = 'groovy' } +jetbrains-anontations = 'org.jetbrains:annotations:24.1.0' +jsoup = 'org.jsoup:jsoup:1.17.2' +junit-jupiter-api = { module = 'org.junit.jupiter:junit-jupiter-api', version.ref = 'junit' } +log4j2-api = { module = 'org.apache.logging.log4j:log4j-api', version.ref = 'log4j2' } +log4j2-core = { module = 'org.apache.logging.log4j:log4j-core', version.ref = 'log4j2' } +log4j2-slf4j2-impl = { module = 'org.apache.logging.log4j:log4j-slf4j2-impl', version.ref = 'log4j2' } +mockito-core = { module = 'org.mockito:mockito-core', version.ref = 'mockito' } +mockito-junit-jupiter = { module = 'org.mockito:mockito-junit-jupiter', version.ref = 'mockito' } +picocli = 'info.picocli:picocli:4.7.6' +slf4j-api = 'org.slf4j:slf4j-api:2.0.13' diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cb..e644113 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 3499ded..b82aa23 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68..1aa94a4 100755 --- a/gradlew +++ b/gradlew @@ -83,10 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +131,13 @@ location of your Java installation." fi else 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. + if ! command -v java >/dev/null 2>&1 + then + 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 location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# 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. + +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_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" \ diff --git a/gradlew.bat b/gradlew.bat index 93e3f59..25da30d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +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 @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +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