diff --git a/.gitignore b/.gitignore index 2385928f..59fbe040 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ codegen/tmp/ codegen/versions.md .build-local +oss.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 01cd4f21..e80fd646 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,14 @@ # ARI4Java Changelog ## [Unreleased] -[Unreleased]: https://github.com/l3nz/ari4java/compare/v0.12.1...HEAD +[Unreleased]: https://github.com/l3nz/ari4java/compare/v0.12.2...HEAD +## [0.12.2] +[0.12.2]: https://github.com/l3nz/ari4java/compare/v0.12.1...v0.12.2 +### Changed +- groupId changed from `ch.loway.oss.ari4java` to `io.github.ari4java` + +### Added ## [0.12.1] [0.12.1]: https://github.com/l3nz/ari4java/compare/v0.12.0...v0.12.1 ### Added diff --git a/README.md b/README.md index 01de766c..90d6e5cf 100644 --- a/README.md +++ b/README.md @@ -21,11 +21,11 @@ across different versions. Simply add the library and an SLF4J implementation to your package config, here is an example using Gradle ``` repositories { - jcenter() + mavenCentral() } dependencies { - compile 'ch.loway.oss.ari4java:ari4java:+' + compile 'io.github.ari4java:ari4java:+' compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.13.0' } ``` diff --git a/build.gradle b/build.gradle index 0bfc99bb..146c629f 100644 --- a/build.gradle +++ b/build.gradle @@ -2,17 +2,25 @@ plugins { id "java" id "jacoco" id "maven-publish" - id "com.jfrog.bintray" version "1.8.4" - id "com.github.spotbugs" version "3.0.0" + id "signing" + id "com.github.spotbugs" version "4.7.0" id "org.sonarqube" version "2.7.1" } -group = "ch.loway.oss.ari4java" -version = "0.12.1" +group = "io.github.ari4java" +version = "0.12.2" + +def projectUrl = "http://github.com/ari4java/ari4java" +def build_number = "x" +if (System.getenv("BUILD_NUMBER") != null) { + build_number = System.getenv("BUILD_NUMBER") +} java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 + withJavadocJar() + withSourcesJar() } sourceSets { @@ -24,27 +32,23 @@ sourceSets { } repositories { - jcenter() + mavenCentral() } dependencies { - compile "com.fasterxml.jackson.core:jackson-core:2.10.1" - compile "com.fasterxml.jackson.core:jackson-databind:2.10.1" - compile "com.fasterxml.jackson.core:jackson-annotations:2.10.1" - compile "io.netty:netty-all:4.1.44.Final" - compile "javax.xml.bind:jaxb-api:2.3.1" - compile "org.slf4j:slf4j-api:1.7.30" - - testCompile "junit:junit:4.10" + implementation "com.fasterxml.jackson.core:jackson-core:2.10.1" + implementation "com.fasterxml.jackson.core:jackson-databind:2.10.1" + implementation "com.fasterxml.jackson.core:jackson-annotations:2.10.1" + implementation "io.netty:netty-all:4.1.44.Final" + implementation "javax.xml.bind:jaxb-api:2.3.1" + implementation "org.slf4j:slf4j-api:1.7.30" + + testImplementation "junit:junit:4.10" testImplementation "org.mockito:mockito-core:2.28.2" testImplementation "org.apache.logging.log4j:log4j-slf4j-impl:2.13.0" } -def build_number = "x" -if (System.getenv("BUILD_NUMBER") != null) { - build_number = System.getenv("BUILD_NUMBER") -} task buildProps(type: WriteProperties) { outputFile file("src/main/resources/build.properties") property "BUILD_NUMBER", build_number @@ -68,22 +72,7 @@ javadoc { ] includes = inc.toSet() options.overview = "src/overview.html" -} - -task sourcesJar(type: Jar, dependsOn: classes) { - archiveClassifier.set("sources") - from sourceSets.main.allSource -} - -javadoc.failOnError = false -task javadocJar(type: Jar, dependsOn: javadoc) { - archiveClassifier.set("javadoc") - from javadoc.destinationDir -} - -artifacts { - archives sourcesJar - archives javadocJar + failOnError = false } test { @@ -136,72 +125,75 @@ sonarqube { test.finalizedBy jacocoTestReport check.dependsOn jacocoTestCoverageVerification -def projectUrl = "http://github.com/ari4java/ari4java" -def pomConfig = { - licenses { - license { - name "LPGL-3.0" - } - } - developers { - developer { - name "Graham Brown" - email "grahambrown11@gmail.com" - } - developer { - name "lenz e." - email "nomail@home" - } - } - scm { - url projectUrl - } -} - publishing { publications { - mavenPublication(MavenPublication) { + maven(MavenPublication) { from components.java - groupId = "ch.loway.oss.ari4java" - artifact sourcesJar { - classifier "sources" - } - artifact javadocJar { - classifier "javadoc" + pom { + name = project.name + description = "Asterisk ARI interface bindings for Java" + url = projectUrl + licenses { + license { + name = "LPGL-3.0" + } + } + developers { + developer { + name = "Graham Brown" + email = "grahambrown11@gmail.com" + } + developer { + name = "lenz e." + email = "nomail@home" + } + } + scm { + url = projectUrl + } } - pom.withXml { - def root = asNode() - root.appendNode("description", "Asterisk ARI interface bindings for Java") - root.appendNode("name", project.name) - root.appendNode("url", projectUrl) - root.children().last() + pomConfig + } + } + repositories { + maven { + name = "sonatype" + url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" + credentials { + username = System.getenv("SONATYPE_USER") + password = System.getenv("SONATYPE_PASS") } } } + +} + +signing { + def signingKeyId = System.getenv("PGP_ID") + def signingKey = System.getenv("PGP_KEY") + def signingPassword = System.getenv("PGP_PASS") + useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) + sign publishing.publications } -bintray { - user = System.getenv("BINTRAY_USER") - key = System.getenv("BINTRAY_KEY") - publications = ["mavenPublication"] - publish = true - pkg { - repo = "maven" - name = project.name - group = "ch.loway.oss.ari4java" - userOrg = "ari4java" - licenses = ["LGPL-3.0"] - vcsUrl = projectUrl - version { - name = project.version - desc = project.version - released = new Date() +spotbugsMain { + reports { + html { + enabled = true + } + xml { + enabled = false } } } -// To generate an HTML report instead of XML -tasks.withType(com.github.spotbugs.SpotBugsTask) { - reports.xml.enabled = false - reports.html.enabled = true +spotbugsTest { + ignoreFailures = true + reports { + html { + enabled = true + } + xml { + enabled = false + } + } } diff --git a/codegen/build.gradle b/codegen/build.gradle index c82fd8e5..fcddd813 100644 --- a/codegen/build.gradle +++ b/codegen/build.gradle @@ -7,10 +7,10 @@ repositories { } dependencies { - compile 'com.fasterxml.jackson.core:jackson-core:2.9.6' - compile 'com.fasterxml.jackson.core:jackson-databind:2.9.6' - compile 'com.fasterxml.jackson.core:jackson-annotations:2.9.6' - compile 'com.google.googlejavaformat:google-java-format:1.7' + implementation 'com.fasterxml.jackson.core:jackson-core:2.9.6' + implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.6' + implementation 'com.fasterxml.jackson.core:jackson-annotations:2.9.6' + implementation 'com.google.googlejavaformat:google-java-format:1.7' } java { diff --git a/examples/build.gradle b/examples/build.gradle index 6f0f0e04..f794d2f1 100644 --- a/examples/build.gradle +++ b/examples/build.gradle @@ -3,9 +3,6 @@ plugins { } repositories { - maven { - url "https://dl.bintray.com/ari4java/maven" - } jcenter() } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 87b738cb..e708b1c0 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 44e7c4d1..442d9132 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index af6708ff..4f906e0c 100755 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$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"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -66,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -109,10 +126,11 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# 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 @@ -138,19 +156,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` 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" ;; + 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 @@ -159,14 +177,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # 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" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 6d57edc7..107acd32 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe 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. @@ -35,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% @@ -45,28 +64,14 @@ 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 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/src/test/java/ch/loway/oss/ari4java/generated/EventBuilderTest.java b/src/test/java/ch/loway/oss/ari4java/generated/EventBuilderTest.java index 4e3a6b1c..6d52aaab 100644 --- a/src/test/java/ch/loway/oss/ari4java/generated/EventBuilderTest.java +++ b/src/test/java/ch/loway/oss/ari4java/generated/EventBuilderTest.java @@ -7,8 +7,8 @@ import ch.loway.oss.ari4java.tools.RestException; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; +import static org.hamcrest.core.IsInstanceOf.instanceOf; /** * @author lenz @@ -68,7 +68,7 @@ public void generateStatsiStartOutOfData() throws RestException { BaseAriAction action = new BaseAriAction(); Message msg = action.deserializeEvent(jsonStasisStartEvent, Message_impl_ari_0_0_1.class); - assertTrue("Type: StasisStart", msg instanceof StasisStart); + assertThat("Type: StasisStart", msg, instanceOf(StasisStart.class)); StasisStart ss = (StasisStart) msg;