diff --git a/.circleci/config.yml b/.circleci/config.yml index 720cb51..21a1bf0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,11 +1,10 @@ +version: 2 defaults: &defaults working_directory: ~/repo environment: JVM_OPTS: -Xmx3200m TERM: dumb -version: 2.0 - jobs: build_gradle: diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..540b054 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,21 @@ +name: Java CI with Gradle + +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Test with Gradle + run: ./gradlew check + env: + PINBOARD_API_TOKEN: ${{ secrets.PINBOARD_API_TOKEN }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..26820aa --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,31 @@ +image: gradle:alpine + +variables: + GRADLE_OPTS: "-Dorg.gradle.daemon=false" + +before_script: + - export GRADLE_USER_HOME=`pwd`/.gradle + +stages: + - build + - test + +build: + stage: build + script: ./gradlew --build-cache assemble + cache: + key: "$CI_COMMIT_REF_NAME" + policy: push + paths: + - build + - .gradle + +test: + stage: test + script: ./gradlew check + cache: + key: "$CI_COMMIT_REF_NAME" + policy: pull + paths: + - build + - .gradle diff --git a/.idea/compiler.xml b/.idea/compiler.xml index d75075a..4e8da37 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -4,8 +4,18 @@ + + + + + + + + + + diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..3d4ac96 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/kotlinScripting.xml b/.idea/kotlinScripting.xml new file mode 100644 index 0000000..bc444de --- /dev/null +++ b/.idea/kotlinScripting.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index b65155f..0cc12b3 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,16 +2,16 @@ - - - - - - - + + + + + + + + + - - \ No newline at end of file diff --git a/.idea/modules/pinboard-poster-samples-kotlin.iml b/.idea/modules/kotlin.samples-kotlin.iml similarity index 100% rename from .idea/modules/pinboard-poster-samples-kotlin.iml rename to .idea/modules/kotlin.samples-kotlin.iml diff --git a/.idea/modules/kotlin.samples-kotlin.main.iml b/.idea/modules/kotlin.samples-kotlin.main.iml new file mode 100644 index 0000000..fbd1150 --- /dev/null +++ b/.idea/modules/kotlin.samples-kotlin.main.iml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/kotlin.samples-kotlin.test.iml b/.idea/modules/kotlin.samples-kotlin.test.iml new file mode 100644 index 0000000..2b9c8df --- /dev/null +++ b/.idea/modules/kotlin.samples-kotlin.test.iml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/pinboard-poster.main.iml b/.idea/modules/pinboard-poster.main.iml new file mode 100644 index 0000000..0c42b6f --- /dev/null +++ b/.idea/modules/pinboard-poster.main.iml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/pinboard-poster.test.iml b/.idea/modules/pinboard-poster.test.iml new file mode 100644 index 0000000..97fd06d --- /dev/null +++ b/.idea/modules/pinboard-poster.test.iml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/pinboard-poster_main.iml b/.idea/modules/pinboard-poster_main.iml deleted file mode 100644 index 1155021..0000000 --- a/.idea/modules/pinboard-poster_main.iml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/pinboard-poster_test.iml b/.idea/modules/pinboard-poster_test.iml deleted file mode 100644 index 974f7f2..0000000 --- a/.idea/modules/pinboard-poster_test.iml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/samples-java_main.iml b/.idea/modules/samples-java.main.iml similarity index 93% rename from .idea/modules/samples-java_main.iml rename to .idea/modules/samples-java.main.iml index ee0308a..9a2896e 100644 --- a/.idea/modules/samples-java_main.iml +++ b/.idea/modules/samples-java.main.iml @@ -1,6 +1,6 @@ - + @@ -9,7 +9,7 @@ - + diff --git a/.idea/modules/samples-java_test.iml b/.idea/modules/samples-java.test.iml similarity index 87% rename from .idea/modules/samples-java_test.iml rename to .idea/modules/samples-java.test.iml index 3914650..100a3c5 100644 --- a/.idea/modules/samples-java_test.iml +++ b/.idea/modules/samples-java.test.iml @@ -1,18 +1,18 @@ - + - + - + - + \ No newline at end of file diff --git a/.idea/modules/samples-kotlin_main.iml b/.idea/modules/samples-kotlin_main.iml deleted file mode 100644 index 3525c23..0000000 --- a/.idea/modules/samples-kotlin_main.iml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules/samples-kotlin_test.iml b/.idea/modules/samples-kotlin_test.iml deleted file mode 100644 index 5245859..0000000 --- a/.idea/modules/samples-kotlin_test.iml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt index c6c30f9..22a50b9 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2017-2019, Erik C. Thauvin (erik@thauvin.net) +Copyright (c) 2017-2020, Erik C. Thauvin (erik@thauvin.net) All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index 45d74e4..665609b 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # [Pinboard](https://pinboard.in) Poster for Kotlin/Java [![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause) [![release](https://img.shields.io/github/release/ethauvin/pinboard-poster.svg)](https://github.com/ethauvin/pinboard-poster/releases/latest) [![Download](https://api.bintray.com/packages/ethauvin/maven/pinboard-poster/images/download.svg)](https://bintray.com/ethauvin/maven/pinboard-poster/_latestVersion) -[![Known Vulnerabilities](https://snyk.io/test/github/ethauvin/pinboard-poster/badge.svg?targetFile=pom.xml)](https://snyk.io/test/github/ethauvin/pinboard-poster?targetFile=pom.xml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ethauvin_pinboard-poster&metric=alert_status)](https://sonarcloud.io/dashboard?id=ethauvin_pinboard-poster) [![Build Status](https://travis-ci.org/ethauvin/pinboard-poster.svg?branch=master)](https://travis-ci.org/ethauvin/pinboard-poster) [![CircleCI](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master) +[![Known Vulnerabilities](https://snyk.io/test/github/ethauvin/pinboard-poster/badge.svg?targetFile=pom.xml)](https://snyk.io/test/github/ethauvin/pinboard-poster?targetFile=pom.xml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ethauvin_pinboard-poster&metric=alert_status)](https://sonarcloud.io/dashboard?id=ethauvin_pinboard-poster) [![Build Status](https://travis-ci.com/ethauvin/pinboard-poster.svg?branch=master)](https://travis-ci.com/ethauvin/pinboard-poster) [![CircleCI](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/pinboard-poster/tree/master) -A small Kotlin/Java library for posting to [Pinboard](https://pinboard.in). +A small Kotlin/Java/Android library for posting to [Pinboard](https://pinboard.in). ## Examples diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml new file mode 100644 index 0000000..7d98402 --- /dev/null +++ b/bitbucket-pipelines.yml @@ -0,0 +1,9 @@ +image: openjdk:8 + +pipelines: + default: + - step: + caches: + - gradle + script: + - bash ./gradlew check diff --git a/build.gradle.kts b/build.gradle.kts index 2938a95..0be8cc0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,21 +1,18 @@ import com.jfrog.bintray.gradle.tasks.BintrayUploadTask -import org.jetbrains.dokka.gradle.LinkMapping import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import java.io.FileInputStream import java.util.Properties plugins { - id("com.gradle.build-scan") version "2.3" jacoco java - kotlin("jvm") version "1.3.31" + kotlin("jvm") version "1.4.0" `maven-publish` - id("com.github.ben-manes.versions") version "0.21.0" - id("com.jfrog.bintray") version "1.8.4" - id("io.gitlab.arturbosch.detekt") version "1.0.0-RC14" - id("org.jetbrains.dokka") version "0.9.18" - id("org.jmailen.kotlinter") version "1.25.2" - id("org.sonarqube") version "2.7.1" + id("com.github.ben-manes.versions") version "0.29.0" + id("com.jfrog.bintray") version "1.8.5" + id("io.gitlab.arturbosch.detekt") version "1.11.0" + id("org.jetbrains.dokka") version "1.4.0-rc" + id("org.sonarqube") version "3.0" } group = "net.thauvin.erik" @@ -48,26 +45,17 @@ repositories { } dependencies { - compile("com.squareup.okhttp3:okhttp:3.14.2") - compile(kotlin("stdlib")) + compile("com.squareup.okhttp3:okhttp:4.8.1") - testImplementation("org.testng:testng:6.14.3") + testImplementation("org.testng:testng:7.3.0") } detekt { - input = files("src/main/kotlin", "src/test/kotlin") - filters = ".*/resources/.*,.*/build/.*" - baseline = project.rootDir.resolve("detekt-baseline.xml") -} - -kotlinter { - ignoreFailures = false - reporters = arrayOf("html") - experimentalRules = false + baseline = project.rootDir.resolve("config/detekt/baseline.xml") } jacoco { - toolVersion = "0.8.3" + toolVersion = "0.8.5" } sonarqube { @@ -83,8 +71,8 @@ val sourcesJar by tasks.creating(Jar::class) { } val javadocJar by tasks.creating(Jar::class) { - dependsOn(tasks.dokka) - from(tasks.dokka) + dependsOn(tasks.dokkaJavadoc) + from(tasks.dokkaJavadoc) archiveClassifier.set("javadoc") description = "Assembles a JAR of the generated Javadoc." group = JavaBasePlugin.DOCUMENTATION_GROUP @@ -120,19 +108,6 @@ tasks { } } - dokka { - outputFormat = "html" - outputDirectory = "$buildDir/javadoc" - jdkVersion = 8 - val mapping = LinkMapping().apply { - dir = "src/main/kotlin" - url = "https://github.com/ethauvin/pinboard-poster/blob/${project.version}/src/main/kotlin" - suffix = "#L" - } - linkMappings = arrayListOf(mapping) - includeNonPublic = false - } - val copyToDeploy by registering(Copy::class) { from(configurations.runtime) { exclude("annotations-*.jar") @@ -200,7 +175,7 @@ bintray { githubRepo = gitHub githubReleaseNotesFile = "README.md" vcsUrl = "$mavenUrl.git" - setLabels("kotlin", "java", "pinboard", "poster", "bookmarks") + setLabels("android", "kotlin", "java", "pinboard", "poster", "bookmarks") publicDownloadNumbers = true version.apply { name = project.version as String diff --git a/detekt-baseline.xml b/config/detekt/baseline.xml similarity index 100% rename from detekt-baseline.xml rename to config/detekt/baseline.xml diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf..e708b1c 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 f4d7b2b..6c9a224 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.4.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index b0d6d0a..4f906e0 100755 --- a/gradlew +++ b/gradlew @@ -7,7 +7,7 @@ # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# 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, @@ -82,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 @@ -125,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 @@ -154,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 @@ -175,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 9991c50..107acd3 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -5,7 +5,7 @@ @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 http://www.apache.org/licenses/LICENSE-2.0 +@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, @@ -29,6 +29,9 @@ 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" "-Xms64m" @@ -37,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. @@ -51,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% @@ -61,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/pinboard-poster.iml b/pinboard-poster.iml index 289e170..82e18fd 100644 --- a/pinboard-poster.iml +++ b/pinboard-poster.iml @@ -2,7 +2,7 @@ - +