diff --git a/.circleci/config.yml b/.circleci/config.yml index 29685bf..77889be 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,51 +4,41 @@ defaults: &defaults environment: JVM_OPTS: -Xmx3200m TERM: dumb - CI: true + CI_NAME: "CircleCI" -defaults_gradle: &defaults_gradle +defaults_gradle: &defaults_bld steps: - checkout - - restore_cache: - keys: - - gradle-dependencies-{{ checksum "build.gradle.kts" }} - # fallback to using the latest cache if no exact match is found - - gradle-dependencies- - run: - name: Gradle Dependencies - command: ./gradlew dependencies - - save_cache: - paths: ~/.m2 - key: gradle-dependencies-{{ checksum "build.gradle.kts" }} + name: Download the bld dependencies + command: ./bld download - run: - name: Run All Checks - command: ./gradlew check - - store_artifacts: - path: build/reports/ - destination: reports - - store_test_results: - path: build/reports/ + name: Compile source with bld + command: ./bld compile + - run: + name: Run tests with bld + command: ./bld test jobs: - build_gradle_jdk18: + bld_jdk17: <<: *defaults docker: - - image: cimg/openjdk:18.0 + - image: cimg/openjdk:17.0 - <<: *defaults_gradle + <<: *defaults_bld - build_gradle_jdk11: + bld_jdk20: <<: *defaults docker: - - image: cimg/openjdk:11.0 + - image: cimg/openjdk:20.0 - <<: *defaults_gradle + <<: *defaults_bld workflows: version: 2 - gradle: + bld: jobs: - - build_gradle_jdk11 - - build_gradle_jdk18 + - bld_jdk17 + - bld_jdk20 diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml new file mode 100644 index 0000000..ba51eb1 --- /dev/null +++ b/.github/workflows/bld.yml @@ -0,0 +1,49 @@ +name: bld-ci + +on: [ push, pull_request, workflow_dispatch ] + +jobs: + build-bld-project: + runs-on: ubuntu-latest + + env: + COVERAGE_SDK: "17" + + strategy: + matrix: + java-version: [ 17, 20 ] + + steps: + - name: Checkout source repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up JDK ${{ matrix.java-version }} + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: ${{ matrix.java-version }} + + - name: Grant bld execute permission + run: chmod +x bld + + - name: Download the bld dependencies + run: ./bld download + + - name: Compile source with bld + run: ./bld compile + + - name: Run tests with bld + run: ./bld jacoco + + - name: Remove pom.xml + if: success() && matrix.java-version == env.COVERAGE_SDK + run: rm -rf pom.xml + + - name: SonarCloud Scan + uses: sonarsource/sonarcloud-github-action@master + if: success() && matrix.java-version == env.COVERAGE_SDK + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml deleted file mode 100644 index ee7e5da..0000000 --- a/.github/workflows/gradle.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: gradle-ci - -on: [ push, pull_request, workflow_dispatch ] - -jobs: - build: - runs-on: ubuntu-latest - - env: - GRADLE_OPTS: "-Dorg.gradle.jvmargs=-XX:MaxMetaspaceSize=512m" - SONAR_JDK: "17" - - strategy: - matrix: - java-version: [ 11, 17, 20 ] - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up JDK ${{ matrix.java-version }} - uses: actions/setup-java@v3 - with: - distribution: 'zulu' - java-version: ${{ matrix.java-version }} - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: Cache SonarCloud packages - if: matrix.java-version == env.SONAR_JDK - uses: actions/cache@v3 - with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - - name: Test with Gradle - uses: gradle/gradle-build-action@v2 - env: - PINBOARD_API_TOKEN: ${{ secrets.PINBOARD_API_TOKEN }} - with: - arguments: build check --stacktrace - - - name: SonarCloud - if: success() && matrix.java-version == env.SONAR_JDK - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: ./gradlew sonar --info diff --git a/.gitignore b/.gitignore index 0742f86..3402a75 100644 --- a/.gitignore +++ b/.gitignore @@ -1,84 +1,58 @@ -!.vscode/extensions.json -!.vscode/launch.json -!.vscode/settings.json -!.vscode/tasks.json -*.class -*.code-workspace -*.ctxt -*.iws -*.log -*.nar -*.rar -*.sublime-* -*.tar.gz -*.zip -.DS_Store -.classpath .gradle -.history -.kobalt -.mtj.tmp/ -.mvn/timing.properties -.mvn/wrapper/maven-wrapper.jar -.nb-gradle -.project -.scannerwork -.settings -.vscode/* -/**/.idea/$CACHE_FILE$ -/**/.idea/$PRODUCT_WORKSPACE_FILE$ -/**/.idea/**/caches/build_file_checksums.ser -/**/.idea/**/contentModel.xml -/**/.idea/**/dataSources.ids -/**/.idea/**/dataSources.local.xml -/**/.idea/**/dataSources/ -/**/.idea/**/dbnavigator.xml -/**/.idea/**/dictionaries -/**/.idea/**/dynamic.xml -/**/.idea/**/gradle.xml -/**/.idea/**/httpRequests -/**/.idea/**/libraries -/**/.idea/**/mongoSettings.xml -/**/.idea/**/replstate.xml -/**/.idea/**/shelf -/**/.idea/**/shelf/ -/**/.idea/**/sqlDataSources.xml -/**/.idea/**/tasks.xml -/**/.idea/**/uiDesigner.xml -/**/.idea/**/usage.statistics.xml -/**/.idea/**/workspace.xml -/**/.idea/sonarlint* -/**/.idea_modules/ -Thumbs.db -__pycache__ +.DS_Store +build +lib/bld/** +!lib/bld/bld-wrapper.jar +!lib/bld/bld-wrapper.properties +lib/compile/ +lib/runtime/ +lib/standalone/ +lib/test/ + +# IDEA ignores + +# User-specific +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin atlassian-ide-plugin.xml -bin/ -build/ -cmake-build-*/ -com_crashlytics_export_strings.xml -crashlytics-build.properties -crashlytics.properties -dependency-reduced-pom.xml -deploy/ -dist/ -ehthumbs.db -fabric.properties -gen/ -hs_err_pid* -kobaltBuild -kobaltw*-test -lib/kotlin* -libs/ + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Editor-based Rest Client +.idea/httpRequests + + local.properties -out/ -pom.xml.asc -pom.xml.next -pom.xml.releaseBackup -pom.xml.tag -pom.xml.versionsBackup -proguard-project.txt -project.properties -release.properties -target/ -test-output -venv diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1a3e8b4..052df48 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,31 +1,11 @@ -image: gradle:8-jdk11 - -variables: - GRADLE_OPTS: "-Dorg.gradle.daemon=false" - -before_script: - - export GRADLE_USER_HOME=`pwd`/.gradle +image: openjdk:17 stages: - - build - test -build: - stage: build - script: gradle --build-cache assemble - cache: - key: "$CI_COMMIT_REF_NAME" - policy: push - paths: - - build - - .gradle - test: stage: test - script: gradle check - cache: - key: "$CI_COMMIT_REF_NAME" - policy: pull - paths: - - build - - .gradle + script: + - ./bld download + - ./bld compile + - ./bld test diff --git a/.idea/app.iml b/.idea/app.iml new file mode 100644 index 0000000..2c1fe21 --- /dev/null +++ b/.idea/app.iml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/bld.iml b/.idea/bld.iml new file mode 100644 index 0000000..e63e11e --- /dev/null +++ b/.idea/bld.iml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml deleted file mode 100644 index 95c433c..0000000 --- a/.idea/checkstyle-idea.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index 10aa334..0000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,298 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index 6e6eec1..0000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 88fa664..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/copyright/Erik_s_Copyright_Notice.xml b/.idea/copyright/Erik_s_Copyright_Notice.xml index 82870eb..6af75f8 100644 --- a/.idea/copyright/Erik_s_Copyright_Notice.xml +++ b/.idea/copyright/Erik_s_Copyright_Notice.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml index b03a87e..1419e40 100644 --- a/.idea/copyright/profiles_settings.xml +++ b/.idea/copyright/profiles_settings.xml @@ -1,15 +1,3 @@ - - - - - - - - - + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 562d6ca..1e01b48 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -1,43 +1,8 @@ \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index dd4c951..0000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml deleted file mode 100644 index 83bf06e..0000000 --- a/.idea/kotlinc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/libraries-with-intellij-classes.xml b/.idea/libraries-with-intellij-classes.xml deleted file mode 100644 index 9fa3156..0000000 --- a/.idea/libraries-with-intellij-classes.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/libraries/bld.xml b/.idea/libraries/bld.xml new file mode 100644 index 0000000..ca84ff0 --- /dev/null +++ b/.idea/libraries/bld.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/.idea/libraries/compile.xml b/.idea/libraries/compile.xml new file mode 100644 index 0000000..9bd86aa --- /dev/null +++ b/.idea/libraries/compile.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/runtime.xml b/.idea/libraries/runtime.xml new file mode 100644 index 0000000..2ae5c4b --- /dev/null +++ b/.idea/libraries/runtime.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/test.xml b/.idea/libraries/test.xml new file mode 100644 index 0000000..b80486a --- /dev/null +++ b/.idea/libraries/test.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 336a5ac..dd194dc 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,19 +1,23 @@ - + + + + - + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 917a540..55adcb9 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,8 @@ - + + \ No newline at end of file diff --git a/.idea/modules/samples-kotlin.iml b/.idea/modules/samples-kotlin.iml deleted file mode 100644 index 813d9e8..0000000 --- a/.idea/modules/samples-kotlin.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/Run Tests.xml b/.idea/runConfigurations/Run Tests.xml new file mode 100644 index 0000000..2d4326e --- /dev/null +++ b/.idea/runConfigurations/Run Tests.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/.idea/scopes/Source.xml b/.idea/scopes/Source.xml deleted file mode 100644 index 942e059..0000000 --- a/.idea/scopes/Source.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml deleted file mode 100644 index e96534f..0000000 --- a/.idea/uiDesigner.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..f25500c --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "java", + "name": "Run Tests", + "request": "launch", + "mainClass": "net.thauvin.erik.pinboard.PinboardPosterTest" + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..133aa45 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,15 @@ +{ + "java.project.sourcePaths": [ + "src/main/java", + "src/main/resources", + "src/test/java", + "src/bld/java" + ], + "java.configuration.updateBuildConfiguration": "automatic", + "java.project.referencedLibraries": [ + "${HOME}/.bld/dist/bld-1.7.5.jar", + "lib/compile/*.jar", + "lib/runtime/*.jar", + "lib/test/*.jar" + ] +} diff --git a/README.md b/README.md index 9493ee0..0aa6f0c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,11 @@ # [Pinboard](https://pinboard.in) Poster for Kotlin, Java and Android -[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](https://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) -[![Nexus Snapshot](https://img.shields.io/nexus/s/net.thauvin.erik/pinboard-poster?label=snapshot&server=https%3A%2F%2Foss.sonatype.org%2F)](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/pinboard-poster/) +[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](https://opensource.org/licenses/BSD-3-Clause) +[![Kotlin](https://img.shields.io/badge/kotlin-1.9.21-7f52ff)](https://kotlinlang.org/) +[![Release](https://img.shields.io/github/release/ethauvin/pinboard-poster.svg)](https://github.com/ethauvin/pinboard-poster/releases/latest) [![Maven Central](https://img.shields.io/maven-central/v/net.thauvin.erik/pinboard-poster.svg?color=blue)](https://central.sonatype.com/artifact/net.thauvin.erik/pinboard-poster) +[![Nexus Snapshot](https://img.shields.io/nexus/s/net.thauvin.erik/pinboard-poster?label=snapshot&server=https%3A%2F%2Foss.sonatype.org%2F)](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/pinboard-poster/) + [![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) [![GitHub CI](https://github.com/ethauvin/pinboard-poster/actions/workflows/gradle.yml/badge.svg)](https://github.com/ethauvin/pinboard-poster/actions/workflows/gradle.yml) @@ -24,7 +27,7 @@ poster.deletePin("https:///www.example.com/bar") ``` -[View Example](https://github.com/ethauvin/pinboard-poster/blob/master/samples/kotlin/src/main/kotlin/net/thauvin/erik/pinboard/samples/KotlinExample.kt) +[View Examples](https://github.com/ethauvin/pinboard-poster/blob/master/examples) ### Java @@ -41,13 +44,28 @@ poster.addPin(new PinConfig.Builder() poster.deletePin("https:///www.example.com/bar"); ``` -[View Example](https://github.com/ethauvin/pinboard-poster/blob/master/samples/java/src/main/java/net/thauvin/erik/pinboard/samples/JavaExample.java) +[View Examples](https://github.com/ethauvin/pinboard-poster/blob/master/examples) Your API authentication token is available on the [Pinboard settings page](https://pinboard.in/settings/password). -## Usage with Gradle, Maven, etc. -To install and run from Gradle, add the following to the build.gradle file: +## bld + +To use with [bld](https://rife2.com/bld), include the following dependency in your [build](https://github.com/ethauvin/pinboard-poster/blob/master/examples/bld/src/bld/java/net/thauvin/erik/pinboard/samples/ExampleBuild.java) file: + +```java +repositories = List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY); + +scope(compile) + .include(dependency("net.thauvin.erik:pinboard-poster:1.1.0")); +``` +Be sure to use the [bld Kotlin extension](https://github.com/rife2/bld-kotlin) in your project. + +[View Example](https://github.com/ethauvin/pinboard-poster/blob/master/examples/bld/) + +## Gradle, Maven, etc. + +To install and run from Gradle, add the following to the `build.gradle` file: ```gradle repositories { @@ -59,8 +77,7 @@ dependencies { } ``` -[View Example](https://github.com/ethauvin/pinboard-poster/blob/master/samples/java/build.gradle) -[View Kotlin DSL Example](https://github.com/ethauvin/pinboard-poster/blob/master/samples/kotlin/build.gradle.kts) +[View Examples](https://github.com/ethauvin/pinboard-poster/blob/master/examples/gradle/) Instructions for using with Maven, Ivy, etc. can be found on [Maven Central](https://central.sonatype.com/artifact/net.thauvin.erik/pinboard-poster). diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index a9514a0..7c85194 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -1,9 +1,10 @@ -image: maven:3-openjdk-18 +image: openjdk:17 pipelines: default: - step: - caches: - - gradle + name: Test with bld script: - - bash ./gradlew check + - ./bld download + - ./bld compile + - ./bld test diff --git a/bld b/bld new file mode 100755 index 0000000..3c1df97 --- /dev/null +++ b/bld @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build net.thauvin.erik.pinboard.PinboardPosterBuild "$@" diff --git a/bld.bat b/bld.bat new file mode 100644 index 0000000..1262822 --- /dev/null +++ b/bld.bat @@ -0,0 +1,4 @@ +@echo off +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +java -jar "%DIRNAME%/lib/bld/bld-wrapper.jar" "%0" --build net.thauvin.erik.pinboard.PinboardPosterBuild %* diff --git a/build.gradle.kts b/build.gradle.kts deleted file mode 100644 index 6c1b57c..0000000 --- a/build.gradle.kts +++ /dev/null @@ -1,213 +0,0 @@ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask -import org.gradle.api.tasks.testing.logging.TestExceptionFormat -import org.gradle.api.tasks.testing.logging.TestLogEvent - -plugins { - id("com.github.ben-manes.versions") version "0.50.0" - id("io.gitlab.arturbosch.detekt") version "1.23.3" - id("java") - id("maven-publish") - id("org.jetbrains.dokka") version "1.9.10" - id("org.jetbrains.kotlinx.kover") version "0.7.4" - id("org.sonarqube") version "4.4.1.3373" - id("signing") - kotlin("jvm") version "1.9.21" -} - -group = "net.thauvin.erik" -version = "1.1.1-SNAPSHOT" -description = "A small library for posting to Pinboard" - -val gitHub = "ethauvin/$name" -val mavenUrl = "https://github.com/$gitHub" -val deployDir = "deploy" -var isRelease = "release" in gradle.startParameter.taskNames - -val publicationName = "mavenJava" - -object Versions { - const val OKHTTP = "4.12.0" -} - -fun isNonStable(version: String): Boolean { - val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) } - val regex = "^[0-9,.v-]+(-r)?$".toRegex() - val isStable = stableKeyword || regex.matches(version) - return isStable.not() -} - -repositories { - mavenCentral() - maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") } -} - -dependencies { - implementation(platform(kotlin("bom"))) - - implementation("com.squareup.okhttp3:okhttp:${Versions.OKHTTP}") - implementation("com.squareup.okhttp3:logging-interceptor:${Versions.OKHTTP}") - - testImplementation("org.testng:testng:7.8.0") -} - -java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 - withSourcesJar() -} - -detekt { - //toolVersion = "main-SNAPSHOT" - baseline = project.rootDir.resolve("config/detekt/baseline.xml") -} - -koverReport { - defaults { - xml { - onCheck = true - } - html { - onCheck = true - } - } -} - -sonarqube { - properties { - property("sonar.projectKey", "ethauvin_$name") - property("sonar.organization", "ethauvin-github") - property("sonar.host.url", "https://sonarcloud.io") - property("sonar.sourceEncoding", "UTF-8") - property("sonar.coverage.jacoco.xmlReportPaths", "${layout.buildDirectory.get()}/reports/kover/report.xml") - } -} - -val javadocJar by tasks.creating(Jar::class) { - dependsOn(tasks.dokkaJavadoc) - from(tasks.dokkaJavadoc) - archiveClassifier.set("javadoc") - description = "Assembles a JAR of the generated Javadoc." - group = JavaBasePlugin.DOCUMENTATION_GROUP -} - -tasks { - withType { - testLogging { - exceptionFormat = TestExceptionFormat.FULL - events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED) - } - - useTestNG() - } - - withType { - kotlinOptions.jvmTarget = java.targetCompatibility.toString() - } - - withType { - destination = file("$projectDir/pom.xml") - } - - withType { - rejectVersionIf { - isNonStable(candidate.version) - } - } - - clean { - doLast { - project.delete(fileTree(deployDir)) - } - } - - val copyToDeploy by registering(Copy::class) { - from(configurations.runtimeClasspath) { - exclude("annotations-*.jar") - exclude("kotlin-*.jar") - } - from(jar) - into(deployDir) - } - - register("deploy") { - description = "Copies all needed files to the $deployDir directory." - group = PublishingPlugin.PUBLISH_TASK_GROUP - dependsOn(clean, build, jar) - outputs.dir(deployDir) - inputs.files(copyToDeploy) - mustRunAfter(clean) - } - - val gitIsDirty by registering(Exec::class) { - description = "Fails if git has uncommitted changes." - group = "verification" - commandLine("git", "diff", "--quiet", "--exit-code") - } - - val gitTag by registering(Exec::class) { - description = "Tags the local repository with version ${project.version}" - group = PublishingPlugin.PUBLISH_TASK_GROUP - dependsOn(gitIsDirty) - if (isRelease) { - commandLine("git", "tag", "-a", project.version, "-m", "Version ${project.version}") - } - } - - register("release") { - description = "Publishes version ${project.version} to local repository." - group = PublishingPlugin.PUBLISH_TASK_GROUP - dependsOn(wrapper, "deploy", gitTag, publishToMavenLocal) - } -} - -publishing { - publications { - create(publicationName) { - from(components["java"]) - artifact(javadocJar) - pom { - name.set(project.name) - description.set(project.description) - url.set(mavenUrl) - licenses { - license { - name.set("BSD 3-Clause") - url.set("https://opensource.org/licenses/BSD-3-Clause") - } - } - developers { - developer { - id.set("ethauvin") - name.set("Erik C. Thauvin") - email.set("erik@thauvin.net") - url.set("https://erik.thauvin.net/") - } - } - scm { - connection.set("scm:git:https//github.com/$gitHub.git") - developerConnection.set("scm:git:git@github.com:$gitHub.git") - url.set(mavenUrl) - } - issueManagement { - system.set("GitHub") - url.set("$mavenUrl/issues") - } - } - } - } - repositories { - maven { - name = "ossrh" - url = if (project.version.toString().contains("SNAPSHOT")) - uri("https://oss.sonatype.org/content/repositories/snapshots/") else - uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials(PasswordCredentials::class) - } - } -} - -signing { - useGpgCmd() - sign(publishing.publications[publicationName]) -} diff --git a/deploy.sh b/deploy.sh deleted file mode 100755 index f7caf5f..0000000 --- a/deploy.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -./gradlew deploy -[ $? -eq 0 ] && scp deploy/*.jar nix3.thauvin.us:/opt/lib/jtalk-ee/pinboard-poster diff --git a/examples/bld/.gitignore b/examples/bld/.gitignore new file mode 100644 index 0000000..a2805aa --- /dev/null +++ b/examples/bld/.gitignore @@ -0,0 +1,55 @@ +.gradle +.DS_Store +build +lib/bld/** +!lib/bld/bld-wrapper.jar +!lib/bld/bld-wrapper.properties +lib/compile/ +lib/runtime/ +lib/standalone/ +lib/test/ + +# IDEA ignores + +# User-specific +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Editor-based Rest Client +.idea/httpRequests \ No newline at end of file diff --git a/examples/bld/.idea/.gitignore b/examples/bld/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/examples/bld/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/examples/bld/.idea/.name b/examples/bld/.idea/.name new file mode 100644 index 0000000..6782949 --- /dev/null +++ b/examples/bld/.idea/.name @@ -0,0 +1 @@ +pinboard-poster-examples-bld \ No newline at end of file diff --git a/examples/bld/.idea/app.iml b/examples/bld/.idea/app.iml new file mode 100644 index 0000000..5a2dc51 --- /dev/null +++ b/examples/bld/.idea/app.iml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/bld/.idea/bld.iml b/examples/bld/.idea/bld.iml new file mode 100644 index 0000000..e63e11e --- /dev/null +++ b/examples/bld/.idea/bld.iml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/bld/.idea/inspectionProfiles/Project_Default.xml b/examples/bld/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..1e01b48 --- /dev/null +++ b/examples/bld/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/examples/bld/.idea/libraries/bld.xml b/examples/bld/.idea/libraries/bld.xml new file mode 100644 index 0000000..ca84ff0 --- /dev/null +++ b/examples/bld/.idea/libraries/bld.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/examples/bld/.idea/libraries/compile.xml b/examples/bld/.idea/libraries/compile.xml new file mode 100644 index 0000000..9bd86aa --- /dev/null +++ b/examples/bld/.idea/libraries/compile.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/bld/.idea/libraries/runtime.xml b/examples/bld/.idea/libraries/runtime.xml new file mode 100644 index 0000000..2ae5c4b --- /dev/null +++ b/examples/bld/.idea/libraries/runtime.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/bld/.idea/libraries/test.xml b/examples/bld/.idea/libraries/test.xml new file mode 100644 index 0000000..b80486a --- /dev/null +++ b/examples/bld/.idea/libraries/test.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/bld/.idea/misc.xml b/examples/bld/.idea/misc.xml new file mode 100644 index 0000000..542659b --- /dev/null +++ b/examples/bld/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/examples/bld/.idea/modules.xml b/examples/bld/.idea/modules.xml new file mode 100644 index 0000000..55adcb9 --- /dev/null +++ b/examples/bld/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/examples/bld/.idea/runConfigurations/Run Tests.xml b/examples/bld/.idea/runConfigurations/Run Tests.xml new file mode 100644 index 0000000..e5f873f --- /dev/null +++ b/examples/bld/.idea/runConfigurations/Run Tests.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/examples/bld/.idea/vcs.xml b/examples/bld/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/examples/bld/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/examples/bld/.vscode/launch.json b/examples/bld/.vscode/launch.json new file mode 100644 index 0000000..b183bbe --- /dev/null +++ b/examples/bld/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "java", + "name": "Run Tests", + "request": "launch", + "mainClass": "net.thauvin.erik.pinboard.samples.JavaExampleTest" + } + ] +} diff --git a/examples/bld/.vscode/settings.json b/examples/bld/.vscode/settings.json new file mode 100644 index 0000000..133aa45 --- /dev/null +++ b/examples/bld/.vscode/settings.json @@ -0,0 +1,15 @@ +{ + "java.project.sourcePaths": [ + "src/main/java", + "src/main/resources", + "src/test/java", + "src/bld/java" + ], + "java.configuration.updateBuildConfiguration": "automatic", + "java.project.referencedLibraries": [ + "${HOME}/.bld/dist/bld-1.7.5.jar", + "lib/compile/*.jar", + "lib/runtime/*.jar", + "lib/test/*.jar" + ] +} diff --git a/examples/bld/README.md b/examples/bld/README.md new file mode 100644 index 0000000..ad5401c --- /dev/null +++ b/examples/bld/README.md @@ -0,0 +1,18 @@ +## Kotlin Example +To compile & run the Kotlin example: + +```console +./bld compile + +./bld run +``` + +## Java Example + +To compile & run the Java example: + +```console +./bld compile + +./bld run-java +``` diff --git a/examples/bld/bld b/examples/bld/bld new file mode 100755 index 0000000..1a39c97 --- /dev/null +++ b/examples/bld/bld @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build net.thauvin.erik.pinboard.samples.ExampleBuild "$@" diff --git a/examples/bld/bld.bat b/examples/bld/bld.bat new file mode 100644 index 0000000..6357553 --- /dev/null +++ b/examples/bld/bld.bat @@ -0,0 +1,4 @@ +@echo off +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +java -jar "%DIRNAME%/lib/bld/bld-wrapper.jar" "%0" --build net.thauvin.erik.pinboard.samples.ExampleBuild %* diff --git a/examples/bld/lib/bld/bld-wrapper.jar b/examples/bld/lib/bld/bld-wrapper.jar new file mode 100644 index 0000000..44b7c9a Binary files /dev/null and b/examples/bld/lib/bld/bld-wrapper.jar differ diff --git a/examples/bld/lib/bld/bld-wrapper.properties b/examples/bld/lib/bld/bld-wrapper.properties new file mode 100644 index 0000000..095b48c --- /dev/null +++ b/examples/bld/lib/bld/bld-wrapper.properties @@ -0,0 +1,7 @@ +bld.downloadExtensionJavadoc=false +bld.downloadExtensionSources=true +bld.extensions=com.uwyn.rife2:bld-kotlin:0.9.0-SNAPSHOT +bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES +bld.downloadLocation= +bld.sourceDirectories= +bld.version=1.7.5 diff --git a/examples/bld/src/bld/java/net/thauvin/erik/pinboard/samples/ExampleBuild.java b/examples/bld/src/bld/java/net/thauvin/erik/pinboard/samples/ExampleBuild.java new file mode 100644 index 0000000..cebc20c --- /dev/null +++ b/examples/bld/src/bld/java/net/thauvin/erik/pinboard/samples/ExampleBuild.java @@ -0,0 +1,52 @@ +package net.thauvin.erik.pinboard.samples; + +import rife.bld.BaseProject; +import rife.bld.BuildCommand; +import rife.bld.extension.CompileKotlinOperation; +import rife.bld.operations.RunOperation; + +import java.util.List; + +import static rife.bld.dependencies.Repository.*; +import static rife.bld.dependencies.Scope.compile; + +public class ExampleBuild extends BaseProject { + public ExampleBuild() { + pkg = "net.thauvin.erik.pinboard.samples"; + name = "Example"; + version = version(0, 1, 0); + + mainClass = pkg + ".KotlinExampleKt"; + + javaRelease = 11; + downloadSources = true; + autoDownloadPurge = true; + + repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY); + + scope(compile) + .include(dependency("net.thauvin.erik", "pinboard-poster", version(1, 1, 1, "SNAPSHOT"))); + } + + public static void main(String[] args) { + new ExampleBuild().start(args); + } + + @Override + public void compile() throws Exception { + new CompileKotlinOperation() + .fromProject(this) + .execute(); + + // Also compile the Java source code + super.compile(); + } + + @BuildCommand(value = "run-java", summary = "Runs the Java example") + public void runJava() throws Exception { + new RunOperation() + .fromProject(this) + .mainClass(pkg + ".JavaExample") + .execute(); + } +} diff --git a/samples/java/src/main/java/net/thauvin/erik/pinboard/samples/JavaExample.java b/examples/bld/src/main/java/net/thauvin/erik/pinboard/samples/JavaExample.java similarity index 100% rename from samples/java/src/main/java/net/thauvin/erik/pinboard/samples/JavaExample.java rename to examples/bld/src/main/java/net/thauvin/erik/pinboard/samples/JavaExample.java diff --git a/samples/kotlin/src/main/kotlin/net/thauvin/erik/pinboard/samples/KotlinExample.kt b/examples/bld/src/main/kotlin/net/thauvin/erik/pinboard/samples/KotlinExample.kt similarity index 100% rename from samples/kotlin/src/main/kotlin/net/thauvin/erik/pinboard/samples/KotlinExample.kt rename to examples/bld/src/main/kotlin/net/thauvin/erik/pinboard/samples/KotlinExample.kt diff --git a/samples/java/.editorconfig b/examples/gradle/java/.editorconfig similarity index 100% rename from samples/java/.editorconfig rename to examples/gradle/java/.editorconfig diff --git a/samples/java/.gitignore b/examples/gradle/java/.gitignore similarity index 100% rename from samples/java/.gitignore rename to examples/gradle/java/.gitignore diff --git a/examples/gradle/java/.idea/.gitignore b/examples/gradle/java/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/examples/gradle/java/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/examples/gradle/java/.idea/.name b/examples/gradle/java/.idea/.name new file mode 100644 index 0000000..4f5dba1 --- /dev/null +++ b/examples/gradle/java/.idea/.name @@ -0,0 +1 @@ +pinboard-poster-examples-gradle-java \ No newline at end of file diff --git a/.idea/encodings.xml b/examples/gradle/java/.idea/compiler.xml similarity index 50% rename from .idea/encodings.xml rename to examples/gradle/java/.idea/compiler.xml index 97626ba..fb7f4a8 100644 --- a/.idea/encodings.xml +++ b/examples/gradle/java/.idea/compiler.xml @@ -1,6 +1,6 @@ - - + + \ No newline at end of file diff --git a/examples/gradle/java/.idea/inspectionProfiles/Project_Default.xml b/examples/gradle/java/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..1e01b48 --- /dev/null +++ b/examples/gradle/java/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/examples/gradle/java/.idea/jarRepositories.xml similarity index 53% rename from .idea/jarRepositories.xml rename to examples/gradle/java/.idea/jarRepositories.xml index 646928b..a529ef2 100644 --- a/.idea/jarRepositories.xml +++ b/examples/gradle/java/.idea/jarRepositories.xml @@ -16,30 +16,10 @@