Compare commits

..

No commits in common. "master" and "1.1.1" have entirely different histories.

53 changed files with 243 additions and 414 deletions

View file

@ -1,8 +1,4 @@
version: 2.1
orbs:
sdkman: joshdholtz/sdkman@0.2.0
version: 2
defaults: &defaults
working_directory: ~/repo
environment:
@ -10,31 +6,18 @@ defaults: &defaults
TERM: dumb
CI_NAME: "CircleCI"
commands:
build_and_test:
parameters:
reports-dir:
type: string
default: "build/reports/test_results"
steps:
- checkout
- sdkman/setup-sdkman
- sdkman/sdkman-install:
candidate: kotlin
version: 2.1.10
- run:
name: Download dependencies
command: ./bld download
- run:
name: Compile source
command: ./bld compile
- run:
name: Run tests
command: ./bld jacoco -reports-dir=<< parameters.reports-dir >>
- store_test_results:
path: << parameters.reports-dir >>
- store_artifacts:
path: build/reports/jacoco/test/html
defaults_gradle: &defaults_bld
steps:
- checkout
- run:
name: Download the bld dependencies
command: ./bld download
- run:
name: Compile source with bld
command: ./bld compile
- run:
name: Run tests with bld
command: ./bld test
jobs:
bld_jdk17:
@ -43,20 +26,19 @@ jobs:
docker:
- image: cimg/openjdk:17.0
steps:
- build_and_test
<<: *defaults_bld
bld_jdk21:
bld_jdk20:
<<: *defaults
docker:
- image: cimg/openjdk:21.0
- image: cimg/openjdk:20.0
steps:
- build_and_test
<<: *defaults_bld
workflows:
version: 2
bld:
jobs:
- bld_jdk17
- bld_jdk21
- bld_jdk20

View file

@ -2,72 +2,50 @@ name: bld-ci
on: [ push, pull_request, workflow_dispatch ]
env:
COVERAGE_JDK: "21"
COVERAGE_KOTLIN: "2.1.20"
PINBOARD_API_TOKEN: ${{ secrets.PINBOARD_API_TOKEN }}
jobs:
build-bld-project:
runs-on: ubuntu-latest
env:
COVERAGE_SDK: "17"
strategy:
matrix:
java-version: [ 17, 21, 24 ]
kotlin-version: [ 1.9.25, 2.0.21, 2.1.20 ]
os: [ ubuntu-latest, windows-latest, macos-latest ]
runs-on: ${{ matrix.os }}
java-version: [ 17, 20 ]
steps:
- name: Checkout source repository
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK ${{ matrix.java-version }} with Kotlin ${{ matrix.kotlin-version }}
uses: actions/setup-java@v4
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
with:
distribution: "zulu"
distribution: 'zulu'
java-version: ${{ matrix.java-version }}
- name: Download dependencies [bld example]
working-directory: examples/bld
- name: Grant bld execute permission
run: chmod +x bld
- name: Download the bld dependencies
run: ./bld download
- name: Compile and run examples [bld example]
working-directory: examples/bld
run: |
./bld compile
./bld run
./bld run-java
- name: Run example [gradle java example]
working-directory: examples/gradle/java
run: |
./gradlew run
- name: Run example [gradle kotlin example]
working-directory: examples/gradle/kotlin
run: |
./gradlew run
- name: Download dependencies
run: ./bld download
- name: Compile source
- name: Compile source with bld
run: ./bld compile
- name: Run tests
- name: Run tests with bld
env:
PINBOARD_API_TOKEN: ${{ secrets.PINBOARD_API_TOKEN }}
run: ./bld jacoco
- name: Remove pom.xml
if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.kotlin-version == env.COVERAGE_KOTLIN
&& matrix.os == 'ubuntu-latest'
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_JDK && matrix.kotlin-version == env.COVERAGE_KOTLIN
&& matrix.os == 'ubuntu-latest'
if: success() && matrix.java-version == env.COVERAGE_SDK
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

View file

@ -1,24 +1,11 @@
image: fedora:latest
variables:
CI_NAME: "GitLab CI"
image: openjdk:17
stages:
- test
before_script:
- dnf -qy update && dnf -y install zip
- curl -s "https://get.sdkman.io" | bash
- echo sdkman_auto_answer=true > $HOME/.sdkman/etc/config
- echo sdkman_auto_selfupdate=true >> $HOME/.sdkman/etc/config
- source "$HOME/.sdkman/bin/sdkman-init.sh"
- sdk install java
- sdk install kotlin
- source "$HOME/.sdkman/bin/sdkman-init.sh"
test:
stage: test
script:
- ./bld download
- ./bld compile
- ./bld test
- ./bld download
- ./bld compile
- ./bld test

6
.idea/bld.xml generated
View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BldConfiguration">
<events />
</component>
</project>

View file

@ -1,6 +1,6 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="&amp;#36;file.fileName&#10;&#10;Copyright (c) 2017-&amp;#36;today.year, Erik C. Thauvin (erik@thauvin.net)&#10;&#10;Redistribution and use in source and binary forms, with or without&#10;modification, are permitted provided that the following conditions are met:&#10;&#10; Redistributions of source code must retain the above copyright notice, this&#10; list of conditions and the following disclaimer.&#10;&#10; Redistributions in binary form must reproduce the above copyright notice,&#10; this list of conditions and the following disclaimer in the documentation&#10; and/or other materials provided with the distribution.&#10;&#10; Neither the name of this project nor the names of its contributors may be&#10; used to endorse or promote products derived from this software without&#10; specific prior written permission.&#10;&#10;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot;&#10;AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE&#10;IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE&#10;DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE&#10;FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL&#10;DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR&#10;SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER&#10;CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,&#10;OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE&#10;OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." />
<option name="notice" value="&amp;#36;file.fileName&#10;&#10;Copyright 2021-&amp;#36;today.year Erik C. Thauvin (erik@thauvin.net)&#10;&#10;Redistribution and use in source and binary forms, with or without&#10;modification, are permitted provided that the following conditions are met:&#10;&#10; Redistributions of source code must retain the above copyright notice, this&#10; list of conditions and the following disclaimer.&#10;&#10; Redistributions in binary form must reproduce the above copyright notice,&#10; this list of conditions and the following disclaimer in the documentation&#10; and/or other materials provided with the distribution.&#10;&#10; Neither the name of this project nor the names of its contributors may be&#10; used to endorse or promote products derived from this software without&#10; specific prior written permission.&#10;&#10;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot;&#10;AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE&#10;IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE&#10;DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE&#10;FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL&#10;DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR&#10;SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER&#10;CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,&#10;OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE&#10;OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." />
<option name="myName" value="Erik's Copyright Notice" />
</copyright>
</component>

6
.idea/icon.svg generated
View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="290px" height="290px" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd" xmlns:xlink="http://www.w3.org/1999/xlink">
<g><path style="opacity:1" fill="#172ff1" d="M -0.5,-0.5 C 96.1667,-0.5 192.833,-0.5 289.5,-0.5C 289.5,96.1667 289.5,192.833 289.5,289.5C 192.833,289.5 96.1667,289.5 -0.5,289.5C -0.5,192.833 -0.5,96.1667 -0.5,-0.5 Z"/></g>
<g><path style="opacity:1" fill="#fcfdfe" d="M 105.5,36.5 C 107.309,44.7755 108.142,53.4421 108,62.5C 130.167,82 152.333,101.5 174.5,121C 182.659,120.794 190.825,120.294 199,119.5C 201.833,119.833 204.667,120.167 207.5,120.5C 196.031,132.008 184.698,143.508 173.5,155C 197.398,185.275 221.898,215.109 247,244.5C 248.919,246.691 250.253,249.024 251,251.5C 219.592,225.547 188.092,199.714 156.5,174C 155.5,173.333 154.5,173.333 153.5,174C 142.586,185.15 131.586,196.316 120.5,207.5C 120.167,204.667 119.833,201.833 119.5,199C 120.294,190.825 120.794,182.659 121,174.5C 101.618,152.623 82.4511,130.623 63.5,108.5C 54.5,107.833 45.5,107.167 36.5,106.5C 59.5211,83.1458 82.5211,59.8125 105.5,36.5 Z"/></g>
</svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -4,6 +4,5 @@
<inspection_tool class="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ADDITIONAL_TAGS" value="created" />
</inspection_tool>
<inspection_tool class="UsePropertyAccessSyntax" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
</profile>
</component>

View file

@ -2,12 +2,12 @@
<library name="bld">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1.jar!/" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1-sources.jar!/" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.5-sources.jar!/" />
</SOURCES>
<excluded>
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />

View file

@ -7,7 +7,7 @@
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/compile" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -8,7 +8,7 @@
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/runtime" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -8,7 +8,7 @@
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/test" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
</library>
</component>

1
.idea/misc.xml generated
View file

@ -16,7 +16,6 @@
<option value="$PROJECT_DIR$/../../java/bld-checkstyle/config/pmd.xml" />
<option value="$PROJECT_DIR$/../../java/bld-exec/config/pmd.xml" />
<option value="$PROJECT_DIR$/../../java/bld-testng/config/pmd.xml" />
<option value="$PROJECT_DIR$/../../java/bld-generated-version/config/pmd.xml" />
</list>
</option>
<option name="skipTestSources" value="false" />

10
.vscode/settings.json vendored
View file

@ -3,13 +3,13 @@
"src/main/java",
"src/main/resources",
"src/test/java",
"src/test/resources",
"src/bld/java",
"src/bld/resources"
"src/bld/java"
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
"${HOME}/.bld/dist/bld-2.2.1.jar",
"lib/**/*.jar"
"${HOME}/.bld/dist/bld-1.7.5.jar",
"lib/compile/*.jar",
"lib/runtime/*.jar",
"lib/test/*.jar"
]
}

View file

@ -1,4 +1,4 @@
Copyright (c) 2017-2025, Erik C. Thauvin (erik@thauvin.net)
Copyright (c) 2017-2023, Erik C. Thauvin (erik@thauvin.net)
All rights reserved.
Redistribution and use in source and binary forms, with or without

View file

@ -1,8 +1,7 @@
# [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)
[![Kotlin](https://img.shields.io/badge/kotlin-2.1.20-7f52ff)](https://kotlinlang.org/)
[![bld](https://img.shields.io/badge/2.2.1-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld)
[![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/)
@ -22,9 +21,9 @@ A small library for posting to [Pinboard](https://pinboard.in).
val poster = PinboardPoster("user:TOKEN")
poster.addPin("https://example.com/foo", "This is a test")
poster.addPin("https://example.com", "This is a test", tags = arrayOf("foo", "bar"))
poster.deletePin("https://example.com/bar")
poster.addPin("https://www.example.com/foo", "This is a test")
poster.addPin("https://examples.com", "This is a test", tags = arrayOf("foo", "bar"))
poster.deletePin("https:///www.example.com/bar")
```
@ -36,17 +35,20 @@ poster.deletePin("https://example.com/bar")
final PinboardPoster poster = new PinBboardPoster("user:TOKEN");
poster.addPin("https://example.com/foo", "This is a test");
poster.addPin(new PinConfig.Builder("https://example.com", "This is a test")
poster.addPin("https://www.example.com/foo", "This is a test");
poster.addPin(new PinConfig.Builder()
.url("https://example.com")
.description("This is a test")
.tags("foo", "bar")
.build());
poster.deletePin("https://example.com/bar");
poster.deletePin("https:///www.example.com/bar");
```
[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).
## 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:
@ -55,7 +57,7 @@ To use with [bld](https://rife2.com/bld), include the following dependency in yo
repositories = List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY);
scope(compile)
.include(dependency("net.thauvin.erik:pinboard-poster:1.2.0"));
.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.
@ -71,7 +73,7 @@ repositories {
}
dependencies {
compile 'net.thauvin.erik:pinboard-poster:1.2.0'
compile 'net.thauvin.erik:pinboard-poster:1.1.0'
}
```
@ -197,21 +199,3 @@ The API end point is automatically configured to `https://api.pinboard.in/v1/`.
```kotlin
poster.apiEndPoint = "https://www.example.com/v1"
```
## Contributing
If you want to contribute to this project, all you have to do is clone the GitHub
repository:
```console
git clone git@github.com:ethauvin/pinboard-poster.git
```
Then use [bld](https://rife2.com/bld) to build:
```console
cd pinboard-poster
./bld compile
```
The project has an [IntelliJ IDEA](https://www.jetbrains.com/idea/) project structure. You can just open it after all the dependencies were downloaded and peruse the code.

View file

@ -1,20 +1,10 @@
image: ubuntu:latest
image: openjdk:17
pipelines:
default:
- step:
name: Test with bld
script:
# Install latest Java & Kotlin via SDKMAN!
- apt-get update -qq && apt-get install -y curl zip
- curl -s "https://get.sdkman.io" | bash
- echo sdkman_auto_answer=true > $HOME/.sdkman/etc/config
- echo sdkman_auto_selfupdate=true >> $HOME/.sdkman/etc/config
- source "$HOME/.sdkman/bin/sdkman-init.sh"
- sdk install java
- sdk install kotlin
- source "$HOME/.sdkman/bin/sdkman-init.sh"
# Download, compile and test with bld
- ./bld download
- ./bld compile
- ./bld test

View file

@ -1,10 +1,10 @@
<?xml version="1.0" ?>
<?xml version='1.0' encoding='UTF-8'?>
<SmellBaseline>
<ManuallySuppressedIssues></ManuallySuppressedIssues>
<ManuallySuppressedIssues/>
<CurrentIssues>
<ID>LongParameterList:PinConfig.kt$PinConfig$( var url: String, var description: String, var extended: String = "", var tags: Array&lt;out String&gt; = emptyArray(), var dt: ZonedDateTime = ZonedDateTime.now(), var replace: Boolean = true, var shared: Boolean = true, var toRead: Boolean = false )</ID>
<ID>LongParameterList:PinConfig.kt$PinConfig$( val url: String, val description: String, val extended: String, val tags: Array&lt;out String>, val dt: ZonedDateTime, val replace: Boolean, val shared: Boolean, val toRead: Boolean )</ID>
<ID>LongParameterList:PinboardPoster.kt$PinboardPoster$( url: String, description: String, extended: String = "", vararg tags: String = emptyArray(), dt: ZonedDateTime = ZonedDateTime.now(), replace: Boolean = true, shared: Boolean = true, toRead: Boolean = false )</ID>
<ID>NestedBlockDepth:PinboardPoster.kt$PinboardPoster$private fun executeMethod(method: String, params: Map&lt;String, String&gt;): Boolean</ID>
<ID>NestedBlockDepth:PinboardPoster.kt$PinboardPoster$private fun executeMethod(method: String, params: Map&lt;String, String>): Boolean</ID>
<ID>ThrowsCount:PinboardPoster.kt$PinboardPoster$@Throws(IOException::class) internal fun parseMethodResponse(method: String, response: String)</ID>
<ID>TooManyFunctions:PinConfig.kt$PinConfig$Builder</ID>
</CurrentIssues>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BldConfiguration">
<events />
</component>
</project>

View file

@ -2,12 +2,12 @@
<library name="bld">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1.jar!/" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1-sources.jar!/" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.5-sources.jar!/" />
</SOURCES>
<excluded>
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />

View file

@ -7,7 +7,7 @@
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/compile" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -8,7 +8,7 @@
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/runtime" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -8,7 +8,7 @@
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/test" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -3,13 +3,13 @@
"src/main/java",
"src/main/resources",
"src/test/java",
"src/test/resources",
"src/bld/java",
"src/bld/resources"
"src/bld/java"
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
"${HOME}/.bld/dist/bld-2.2.1.jar",
"lib/**/*.jar"
"${HOME}/.bld/dist/bld-1.7.5.jar",
"lib/compile/*.jar",
"lib/runtime/*.jar",
"lib/test/*.jar"
]
}

Binary file not shown.

View file

@ -1,7 +1,7 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
bld.downloadLocation=
bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.1.0-SNAPSHOT
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=2.2.1
bld.version=1.7.5

View file

@ -3,7 +3,6 @@ package net.thauvin.erik.pinboard.samples;
import rife.bld.BaseProject;
import rife.bld.BuildCommand;
import rife.bld.extension.CompileKotlinOperation;
import rife.bld.extension.kotlin.CompileOptions;
import rife.bld.operations.RunOperation;
import java.util.List;
@ -26,7 +25,7 @@ public class ExampleBuild extends BaseProject {
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY);
scope(compile)
.include(dependency("net.thauvin.erik", "pinboard-poster", version(1, 2, 1, "SNAPSHOT")));
.include(dependency("net.thauvin.erik", "pinboard-poster", version(1, 1, 1)));
}
public static void main(String[] args) {
@ -37,7 +36,6 @@ public class ExampleBuild extends BaseProject {
public void compile() throws Exception {
new CompileKotlinOperation()
.fromProject(this)
.compileOptions(new CompileOptions().verbose(true))
.execute();
// Also compile the Java source code

View file

@ -31,7 +31,9 @@ public class JavaExample {
if (poster.validate()) {
// Add Pin
if (poster.addPin(new PinConfig.Builder(url, "Testing")
if (poster.addPin(new PinConfig.Builder()
.url(url)
.description("Testing")
.extended("Extra")
.tags("test", "java")
.build())) {

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
<component name="PDMPlugin">
<option name="skipTestSources" value="false" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="17" project-jdk-type="JavaSDK" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="20" project-jdk-type="JavaSDK" />
</project>

View file

@ -1,14 +1,12 @@
plugins {
id 'com.github.ben-manes.versions' version '0.51.0'
id 'com.github.ben-manes.versions' version '0.50.0'
id 'java'
id 'application'
}
defaultTasks 'run'
application {
mainClass = 'net.thauvin.erik.pinboard.samples.JavaExample'
}
mainClassName = 'net.thauvin.erik.pinboard.samples.JavaExample'
java {
sourceCompatibility = JavaVersion.VERSION_11
@ -18,9 +16,8 @@ java {
repositories {
mavenLocal()
mavenCentral()
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
}
dependencies {
implementation 'net.thauvin.erik:pinboard-poster:1.2.1-SNAPSHOT'
implementation 'net.thauvin.erik:pinboard-poster:1.1.1'
}

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

View file

@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@ -57,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/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/.
@ -86,7 +84,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
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
@ -114,7 +112,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@ -205,7 +203,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * 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.
@ -213,7 +211,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.

View file

@ -13,8 +13,6 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@ -45,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
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
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.
goto fail
@ -59,22 +57,22 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
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
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.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=
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%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
"%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

View file

@ -7,4 +7,4 @@
* in the user guide at https://docs.gradle.org/4.8/userguide/multi_project_builds.html
*/
rootProject.name = 'pinboard-poster-examples-gradle-java'
rootProject.name = 'samples-java'

View file

@ -31,7 +31,9 @@ public class JavaExample {
if (poster.validate()) {
// Add Pin
if (poster.addPin(new PinConfig.Builder(url, "Testing")
if (poster.addPin(new PinConfig.Builder()
.url(url)
.description("Testing")
.extended("Extra")
.tags("test", "java")
.build())) {

View file

@ -1 +1 @@
pinboard-post-examples-gradle-kotlin
pinboard-poster-examples-gradle-kotlin

View file

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="2.0.0" />
<option name="version" value="1.9.21" />
</component>
</project>

View file

@ -4,5 +4,5 @@
<component name="PDMPlugin">
<option name="skipTestSources" value="false" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="17" project-jdk-type="JavaSDK" />
</project>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="20" project-jdk-type="JavaSDK" />
</project>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/kotlin.iml" filepath="$PROJECT_DIR$/.idea/kotlin.iml" />
</modules>
</component>
</project>

View file

@ -2,8 +2,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("application")
id("com.github.ben-manes.versions") version "0.51.0"
kotlin("jvm") version "2.1.20"
id("com.github.ben-manes.versions") version "0.50.0"
kotlin("jvm") version "1.9.21"
}
defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
@ -11,11 +11,10 @@ defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
repositories {
mavenLocal()
mavenCentral()
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
}
dependencies {
implementation("net.thauvin.erik:pinboard-poster:1.2.1-SNAPSHOT")
implementation("net.thauvin.erik:pinboard-poster:1.1.1")
}
java {
@ -27,6 +26,8 @@ application {
mainClass.set("net.thauvin.erik.pinboard.samples.KotlinExampleKt")
}
kotlin {
compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11)
tasks {
withType<KotlinCompile>().configureEach {
kotlinOptions.jvmTarget = java.targetCompatibility.toString()
}
}

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

View file

@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@ -57,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/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/.
@ -86,7 +84,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
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
@ -114,7 +112,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@ -205,7 +203,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * 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.
@ -213,7 +211,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.

View file

@ -13,8 +13,6 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@ -45,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
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
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.
goto fail
@ -59,22 +57,22 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
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
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.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=
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%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
"%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

View file

@ -1 +1 @@
rootProject.name = "pinboard-post-examples-gradle-kotlin"
rootProject.name = "samples-kotlin"

Binary file not shown.

View file

@ -1,10 +1,9 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
bld.downloadLocation=
bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.10-SNAPSHOT
bld.extension-dokka=com.uwyn.rife2:bld-dokka:1.0.4-SNAPSHOT
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.10
bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.1.0-SNAPSHOT
bld.extension.jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.1
bld.extensions=com.uwyn.rife2:bld-kotlin:0.9.0-SNAPSHOT
bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.0-SNAPSHOT
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation=
bld.sourceDirectories=
bld.version=2.2.1
bld.version=1.7.5

14
pom.xml
View file

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.thauvin.erik</groupId>
<artifactId>pinboard-poster</artifactId>
<version>1.2.1-SNAPSHOT</version>
<version>1.1.1</version>
<name>pinboard-poster</name>
<description>A small library for posting to Pinboard</description>
<url>https://github.com/ethauvin/pinboard-poster</url>
@ -18,19 +18,25 @@
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>2.1.20</version>
<version>1.9.21</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-common</artifactId>
<version>2.1.20</version>
<version>1.9.21</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk7</artifactId>
<version>1.9.21</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>2.1.20</version>
<version>1.9.21</version>
<scope>compile</scope>
</dependency>
<dependency>

View file

@ -1,7 +1,7 @@
/*
* PinboardPosterBuild.java
*
* Copyright (c) 2017-2025, Erik C. Thauvin (erik@thauvin.net)
* Copyright 2021-2023 Erik C. Thauvin (erik@thauvin.net)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -35,11 +35,10 @@ import rife.bld.BuildCommand;
import rife.bld.Project;
import rife.bld.extension.CompileKotlinOperation;
import rife.bld.extension.DetektOperation;
import rife.bld.extension.DokkaOperation;
import rife.bld.extension.JacocoReportOperation;
import rife.bld.extension.dokka.DokkaOperation;
import rife.bld.extension.dokka.LoggingLevel;
import rife.bld.extension.dokka.OutputFormat;
import rife.bld.extension.kotlin.CompileOptions;
import rife.bld.operations.exceptions.ExitStatusException;
import rife.bld.publish.PomBuilder;
import rife.bld.publish.PublishDeveloper;
@ -50,21 +49,16 @@ import rife.tools.exceptions.FileUtilsErrorException;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import static rife.bld.dependencies.Repository.*;
import static rife.bld.dependencies.Scope.compile;
import static rife.bld.dependencies.Scope.test;
public class PinboardPosterBuild extends Project {
final File srcMainKotlin = new File(srcMainDirectory(), "kotlin");
public PinboardPosterBuild() {
pkg = "net.thauvin.erik";
name = "pinboard-poster";
version = version(1, 2, 1, "SNAPSHOT");
version = version(1, 1, 1);
mainClass = pkg + ".PinboardPoster";
@ -74,73 +68,62 @@ public class PinboardPosterBuild extends Project {
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL);
final var okHttp = version(4, 12, 0);
final var kotlin = version(2, 1, 20);
final var kotlin = version(1, 9, 21);
scope(compile)
// Kotlin
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin))
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib-common", kotlin))
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib-jdk7", kotlin))
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib-jdk8", kotlin))
// OkHttp
.include(dependency("com.squareup.okhttp3", "okhttp", okHttp))
.include(dependency("com.squareup.okhttp3", "logging-interceptor", okHttp));
scope(test)
.include(dependency("org.jetbrains.kotlin", "kotlin-test-junit5", kotlin))
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 12, 2)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 12, 2)))
.include(dependency("org.junit.platform", "junit-platform-launcher", version(1, 12, 2)));
.include(dependency("org.jetbrains.kotlin", "kotlin-test-junit5", version(1, 9, 21)))
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 1)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 1)));
publishOperation()
.repository(version.isSnapshot() ? repository(SONATYPE_SNAPSHOTS_LEGACY.location())
.withCredentials(property("sonatype.user"), property("sonatype.password"))
: repository(SONATYPE_RELEASES_LEGACY.location())
.withCredentials(property("sonatype.user"), property("sonatype.password")))
.repository(repository("github"))
.info()
.groupId(pkg)
.artifactId(name)
.description("A small library for posting to Pinboard")
.url("https://github.com/ethauvin/" + name)
.developer(new PublishDeveloper()
.id("ethauvin")
.name("Erik C. Thauvin")
.email("erik@thauvin.net")
.url("https://erik.thauvin.net/")
.developer(
new PublishDeveloper()
.id("ethauvin")
.name("Erik C. Thauvin")
.email("erik@thauvin.net")
.url("https://erik.thauvin.net/")
)
.license(new PublishLicense()
.name("BSD 3-Clause")
.url("https://opensource.org/licenses/BSD-3-Clause")
.license(
new PublishLicense()
.name("BSD 3-Clause")
.url("https://opensource.org/licenses/BSD-3-Clause")
)
.scm(new PublishScm()
.connection("scm:git:https://github.com/ethauvin/" + name + ".git")
.developerConnection("scm:git:git@github.com:ethauvin/" + name + ".git")
.url("https://github.com/ethauvin/" + name)
.scm(
new PublishScm()
.connection("scm:git:https://github.com/ethauvin/" + name + ".git")
.developerConnection("scm:git:git@github.com:ethauvin/" + name + ".git")
.url("https://github.com/ethauvin/" + name)
)
.signKey(property("sign.key"))
.signPassphrase(property("sign.passphrase"));
jarSourcesOperation().sourceDirectories(srcMainKotlin);
jarSourcesOperation().sourceDirectories(new File(srcMainDirectory(), "kotlin"));
}
public static void main(final String[] args) {
// Enable detailed logging for the extensions
var level = Level.ALL;
var logger = Logger.getLogger("rife.bld.extension");
var consoleHandler = new ConsoleHandler();
consoleHandler.setLevel(level);
logger.addHandler(consoleHandler);
logger.setLevel(level);
logger.setUseParentHandlers(false);
new PinboardPosterBuild().start(args);
}
@BuildCommand(summary = "Compiles the Kotlin project")
@Override
public void compile() throws Exception {
public void compile() throws IOException {
new CompileKotlinOperation()
.fromProject(this)
.compileOptions(new CompileOptions().verbose(true))
.execute();
}
@ -162,10 +145,9 @@ public class PinboardPosterBuild extends Project {
}
@BuildCommand(summary = "Generates JaCoCo Reports")
public void jacoco() throws Exception {
public void jacoco() throws IOException {
new JacocoReportOperation()
.fromProject(this)
.sourceFiles(srcMainKotlin)
.execute();
}
@ -187,12 +169,6 @@ public class PinboardPosterBuild extends Project {
pomRoot();
}
@Override
public void publishLocal() throws Exception {
super.publishLocal();
pomRoot();
}
@BuildCommand(value = "pom-root", summary = "Generates the POM file in the root directory")
public void pomRoot() throws FileUtilsErrorException {
PomBuilder.generateInto(publishOperation().fromProject(this).info(), dependencies(),

View file

@ -1,7 +1,8 @@
/*
* PinConfig.kt
*
* Copyright (c) 2017-2025, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2017-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -37,74 +38,48 @@ import java.time.ZonedDateTime
*
* Supports of all the [Pinboard API Parameters](https://pinboard.in/api/#posts_add).
*/
class PinConfig private constructor(builder: Builder) {
val url: String = builder.url
val description: String = builder.description
val extended = builder.extended
val tags = builder.tags
val dt = builder.dt
val replace = builder.replace
val shared = builder.shared
val toRead = builder.toRead
class PinConfig private constructor(
val url: String,
val description: String,
val extended: String,
val tags: Array<out String>,
val dt: ZonedDateTime,
val replace: Boolean,
val shared: Boolean,
val toRead: Boolean
) {
/**
* Configures the parameters to add a pin.
*
* @param url The URL of the bookmark.
* @param description The title of the bookmark.
*/
data class Builder(var url: String, var description: String) {
var extended: String = ""
var tags: Array<out String> = emptyArray()
var dt: ZonedDateTime = ZonedDateTime.now()
var replace: Boolean = true
var shared: Boolean = true
var toRead: Boolean = false
data class Builder(
private var url: String = "",
private var description: String = "",
private var extended: String = "",
private var tags: Array<out String> = emptyArray(),
private var dt: ZonedDateTime = ZonedDateTime.now(),
private var replace: Boolean = true,
private var shared: Boolean = true,
private var toRead: Boolean = false
) {
fun url(url: String) = apply { this.url = url }
fun description(description: String) = apply { this.description = description }
fun extended(extended: String) = apply { this.extended = extended }
fun tags(vararg tag: String) = apply { this.tags = tag }
fun dt(datetime: ZonedDateTime) = apply { this.dt = datetime }
fun replace(replace: Boolean) = apply { this.replace = replace }
fun shared(shared: Boolean) = apply { this.shared = shared }
fun toRead(toRead: Boolean) = apply { this.toRead = toRead }
/**
* The URL of the bookmark.
*/
fun url(url: String): Builder = apply { this.url = url }
/**
* The title of the bookmark.
*/
fun description(description: String): Builder = apply { this.description = description }
/**
* The description of the bookmark.
*/
fun extended(extended: String): Builder = apply { this.extended = extended }
/**
* A list of up to 100 tags.
*/
fun tags(vararg tag: String): Builder = apply { this.tags = tag }
/**
* The creation time of the bookmark.
*/
fun dt(datetime: ZonedDateTime): Builder = apply { this.dt = datetime }
/**
* Replace any existing bookmark with the specified URL. Default `true`.
*/
fun replace(replace: Boolean): Builder = apply { this.replace = replace }
/**
* Make bookmark public. Default is `true`.
*/
fun shared(shared: Boolean): Builder = apply { this.shared = shared }
/**
* Mark the bookmark as unread. Default is `false`.
*/
fun toRead(toRead: Boolean): Builder = apply { this.toRead = toRead }
/**
* Builds a new configuration.
*/
fun build() = PinConfig(this)
fun build() = PinConfig(
url,
description,
extended,
tags,
dt,
replace,
shared,
toRead
)
override fun equals(other: Any?): Boolean {
if (this === other) return true
@ -140,5 +115,7 @@ class PinConfig private constructor(builder: Builder) {
return "Builder(url='$url', description='$description', extended='$extended'," +
"tags=${tags.contentToString()}, dt=$dt, replace=$replace, shared=$shared, toRead=$toRead)"
}
}
}

View file

@ -1,7 +1,8 @@
/*
* PinboardPoster.kt
*
* Copyright (c) 2017-2025, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2017-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:

View file

@ -1,7 +1,8 @@
/*
* PinboardPosterTest.kt
*
* Copyright (c) 2017-2025, Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2017-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -43,13 +44,11 @@ import kotlin.test.assertFalse
import kotlin.test.assertTrue
class PinboardPosterTest {
private val url = randomUrl()
private val url = "http://www.example.com/?random=" + (1000..10000).random()
private val desc = "This is a test."
private val localProps = Paths.get("local.properties")
private val isCi = "true" == System.getenv("CI")
private fun randomUrl(): String = "https://www.example.com/?random=" + (1000..10000).random()
@Test
fun testAddPin() {
var poster = PinboardPoster("")
@ -67,7 +66,6 @@ class PinboardPosterTest {
if (!isCi) {
poster.logger.level = Level.FINE
}
assertTrue(poster.validate(), "validate()")
assertTrue(poster.addPin(url, desc), "addPin($url, $desc)")
@ -84,7 +82,7 @@ class PinboardPosterTest {
assertTrue(poster.validate(), "validate()")
var config = PinConfig.Builder(url, desc).extended("extra")
var config = PinConfig.Builder().url(url).description(desc).extended("extra")
assertTrue(poster.addPin(config.build()), "apiToken: ${Constants.ENV_API_TOKEN}")
@ -100,17 +98,13 @@ class PinboardPosterTest {
assertTrue(e.message!!.contains("item already exists"))
}
config = config.description("Yet another test.").replace(true).toRead(true)
config = config.replace(true).toRead(true)
assertTrue(poster.addPin(config.build()), "toRead(true)")
config = config.dt(ZonedDateTime.now())
assertTrue(poster.addPin(config.build()), "dt(now)")
assertTrue(poster.deletePin(url), "deletePin($url)")
config = config.url(randomUrl())
assertTrue(poster.addPin(config.build()), "add($url)")
assertTrue(poster.deletePin(config.url), "delete($url)")
}
@Test