Compare commits

...

42 commits

Author SHA1 Message Date
1c9a5191ce
Fix typo 2025-03-26 12:31:00 -07:00
a9cb103cdb
Add snapshot repository 2025-03-26 12:07:26 -07:00
1e5f088639
Cleanup compile command 2025-03-26 12:02:45 -07:00
0ea3fd0520
Add OS matrix for Ubuntu, Windows and macOS 2025-03-26 11:59:03 -07:00
28aebbabfa
IDEA project update 2025-03-26 11:58:46 -07:00
771e2fb208
Add extensions logging 2025-03-26 11:58:20 -07:00
53defaedb3
Update to latest snapshots 2025-03-26 11:57:29 -07:00
3cac9171fd
Add Kotlin example compile options for JDK 24 2025-03-20 21:36:17 -07:00
6510b2b6b3
Combine Kotlin compile options 2025-03-20 20:36:06 -07:00
f8cbab5e87
1.2.1-Add Kotlin compile options for JDK 24 2025-03-20 09:40:34 -07:00
221fa19b94
1.2.1-SNAPSHOT 2025-03-20 09:40:08 -07:00
12b4a80296
Bump Kotlin to version 2.1.20 2025-03-20 09:39:50 -07:00
f582a1e2c1
JDK 24 2025-03-18 23:56:56 -07:00
4b741538ad
Add Junit Platform Launcher dependency 2025-03-18 04:22:11 -07:00
fdb587c716
Update Java/Kotlin to more recent versions 2025-03-16 21:16:51 -07:00
8ebcca5bfe
Version 1.0.0 2025-03-16 20:10:17 -07:00
a748e4139c
Update copyright 2025-03-16 19:55:13 -07:00
34f8fc8fed
Add project icon 2025-03-16 19:54:22 -07:00
0bad2bf332
Bump JUnit to version 5.12.1 2025-03-16 19:54:09 -07:00
81d628a021
Update dependencies
Bump Detekt to extension version 0.9.9
Bump Dokka to extension version 1.0.3
Bump Jacco Report extension to version 0.9.9
2025-03-16 19:53:23 -07:00
a4ac975051
Bump Kotlin to version 2.1.10 2025-03-16 19:51:55 -07:00
36996f36fe
Bump Gradle to version 8.13 2025-03-16 19:50:30 -07:00
8e64ad8c4a
Bump bld to version 2.2.1 2025-03-16 19:49:11 -07:00
fed9a5ca3f
Updated dependencies
Bumped Kotlin to version 2.1.0
Bumped Kotlin extension to version 1.0.3
Bumped Dokka extension to version 1.0.2
Bumped Gradle to version 8.12
Bumped JUnit to version 5.11.4
2024-12-22 15:21:53 -08:00
86ae130748
Updated copyright 2024-09-21 12:51:17 -07:00
19f21f22dc
Updated dependencies
Bumped bld to version 2.1.0
Bumped Gradle to version 8.10.1
Bumped Kotlin to version 2.0.20
Bumped JUnit to version 5.11.0
2024-09-21 12:31:57 -07:00
c41f1f3b2e
Bumped Gradle to version 8.8 2024-06-04 22:02:46 -07:00
bca19736cf
Bumped Kotlin extension to version 0.9.8 2024-05-27 18:05:34 -07:00
8de0330b91
Made config constructor private 2024-05-26 00:35:18 -07:00
9036a32239
Reworked PinConfig with required parameters, etc. 2024-05-25 15:34:40 -07:00
0f9606391e
Bumped Kotlin to version 2.0.0 2024-05-25 15:33:20 -07:00
8e05823153
Minor cleanup 2024-05-10 11:37:29 -07:00
6bef05c7de
Bumped JaCoCo to version 0.9.3 2024-05-10 11:31:32 -07:00
b2b0540e39
Bumped Kotlin to version 1.9.24 2024-05-10 11:30:10 -07:00
154bcccc9c
Bumped bld to version 1.9.1
Bumped Grade to version 8.7
2024-05-10 11:24:54 -07:00
ab87916f16
Bumped workflow actions to latest versions 2024-05-10 11:19:24 -07:00
f01ed318f9
Bumped bld to 1.9.0 2024-03-21 00:23:10 -07:00
fecf40457a
Bumped dependencies 2024-03-21 00:23:10 -07:00
dd2dff89b4
Added contributing section 2024-03-21 00:23:10 -07:00
0f01084405
Bumped dependencies 2024-03-21 00:23:10 -07:00
4274930988
Bumped bld to 1.8.0 2024-03-21 00:23:04 -07:00
c9d4ec46df Updated version in README 2023-11-26 00:39:53 -08:00
53 changed files with 407 additions and 235 deletions

View file

@ -1,4 +1,8 @@
version: 2
version: 2.1
orbs:
sdkman: joshdholtz/sdkman@0.2.0
defaults: &defaults
working_directory: ~/repo
environment:
@ -6,18 +10,31 @@ defaults: &defaults
TERM: dumb
CI_NAME: "CircleCI"
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
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
jobs:
bld_jdk17:
@ -26,19 +43,20 @@ jobs:
docker:
- image: cimg/openjdk:17.0
<<: *defaults_bld
steps:
- build_and_test
bld_jdk20:
bld_jdk21:
<<: *defaults
docker:
- image: cimg/openjdk:20.0
- image: cimg/openjdk:21.0
<<: *defaults_bld
steps:
- build_and_test
workflows:
version: 2
bld:
jobs:
- bld_jdk17
- bld_jdk20
- bld_jdk21

View file

@ -2,50 +2,73 @@ 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, 20 ]
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 }}
steps:
- name: Checkout source repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
- name: Set up JDK ${{ matrix.java-version }} with Kotlin ${{ matrix.kotlin-version }}
uses: actions/setup-java@v4
with:
distribution: 'zulu'
distribution: "zulu"
java-version: ${{ matrix.java-version }}
- name: Grant bld execute permission
run: chmod +x bld
- name: Download the bld dependencies
- name: Download dependencies [bld example]
working-directory: examples/bld
run: ./bld download
- name: Compile source with bld
- name: Compile and run [bld examples]
working-directory: examples/bld
run: |
./bld compile run
./bld run-java
- name: Run example [gradle java example]
working-directory: examples/gradle/java
if: matrix.java-version != '24'
run: |
./gradlew run
- name: Run example [gradle kotlin example]
working-directory: examples/gradle/kotlin
if: matrix.java-version != '24'
run: |
./gradlew run
- name: Download dependencies
run: ./bld download
- name: Compile source
run: ./bld compile
- name: Run tests with bld
env:
PINBOARD_API_TOKEN: ${{ secrets.PINBOARD_API_TOKEN }}
- name: Run tests
run: ./bld jacoco
- name: Remove pom.xml
if: success() && matrix.java-version == env.COVERAGE_SDK
if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.kotlin-version == env.COVERAGE_KOTLIN
&& matrix.os == 'ubuntu-latest'
run: rm -rf pom.xml
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
if: success() && matrix.java-version == env.COVERAGE_SDK
if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.kotlin-version == env.COVERAGE_KOTLIN
&& matrix.os == 'ubuntu-latest'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

View file

@ -1,11 +1,24 @@
image: openjdk:17
image: fedora:latest
variables:
CI_NAME: "GitLab CI"
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 Normal file
View file

@ -0,0 +1,6 @@
<?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 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="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="myName" value="Erik's Copyright Notice" />
</copyright>
</component>

6
.idea/icon.svg generated Normal file
View file

@ -0,0 +1,6 @@
<?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>

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -4,5 +4,6 @@
<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-1.7.5.jar!/" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.5-sources.jar!/" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1-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="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" 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="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" 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="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
</library>
</component>

1
.idea/misc.xml generated
View file

@ -16,6 +16,7 @@
<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/bld/java"
"src/test/resources",
"src/bld/java",
"src/bld/resources"
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
"${HOME}/.bld/dist/bld-1.7.5.jar",
"lib/compile/*.jar",
"lib/runtime/*.jar",
"lib/test/*.jar"
"${HOME}/.bld/dist/bld-2.2.1.jar",
"lib/**/*.jar"
]
}

View file

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

View file

@ -1,7 +1,8 @@
# [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-1.9.21-7f52ff)](https://kotlinlang.org/)
[![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)
[![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/)
@ -21,9 +22,9 @@ A small library for posting to [Pinboard](https://pinboard.in).
val poster = PinboardPoster("user:TOKEN")
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")
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")
```
@ -35,20 +36,17 @@ poster.deletePin("https:///www.example.com/bar")
final PinboardPoster poster = new PinBboardPoster("user:TOKEN");
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")
poster.addPin("https://example.com/foo", "This is a test");
poster.addPin(new PinConfig.Builder("https://example.com", "This is a test")
.tags("foo", "bar")
.build());
poster.deletePin("https:///www.example.com/bar");
poster.deletePin("https://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:
@ -57,7 +55,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.1.0"));
.include(dependency("net.thauvin.erik:pinboard-poster:1.2.0"));
```
Be sure to use the [bld Kotlin extension](https://github.com/rife2/bld-kotlin) in your project.
@ -73,7 +71,7 @@ repositories {
}
dependencies {
compile 'net.thauvin.erik:pinboard-poster:1.1.0'
compile 'net.thauvin.erik:pinboard-poster:1.2.0'
}
```
@ -199,3 +197,21 @@ 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,10 +1,20 @@
image: openjdk:17
image: ubuntu:latest
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' encoding='UTF-8'?>
<?xml version="1.0" ?>
<SmellBaseline>
<ManuallySuppressedIssues/>
<ManuallySuppressedIssues></ManuallySuppressedIssues>
<CurrentIssues>
<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: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: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>): Boolean</ID>
<ID>NestedBlockDepth:PinboardPoster.kt$PinboardPoster$private fun executeMethod(method: String, params: Map&lt;String, String&gt;): 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>

6
examples/bld/.idea/bld.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?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-1.7.5.jar!/" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.5-sources.jar!/" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1-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="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" 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="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" 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="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
</library>
</component>

View file

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

Binary file not shown.

View file

@ -1,7 +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.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.1.0-SNAPSHOT
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.sourceDirectories=
bld.version=1.7.5
bld.version=2.2.1

View file

@ -3,6 +3,7 @@ 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;
@ -25,7 +26,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, 1, 1)));
.include(dependency("net.thauvin.erik", "pinboard-poster", version(1, 2, 1, "SNAPSHOT")));
}
public static void main(String[] args) {
@ -36,6 +37,7 @@ 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,9 +31,7 @@ public class JavaExample {
if (poster.validate()) {
// Add Pin
if (poster.addPin(new PinConfig.Builder()
.url(url)
.description("Testing")
if (poster.addPin(new PinConfig.Builder(url, "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="PDMPlugin">
<option name="skipTestSources" value="false" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="20" project-jdk-type="JavaSDK" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="17" project-jdk-type="JavaSDK" />
</project>

View file

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

View file

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

View file

@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@ -84,7 +86,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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@ -203,7 +205,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_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.

View file

@ -13,6 +13,8 @@
@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 ##########################################################################
@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail

View file

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

View file

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

View file

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

9
examples/gradle/kotlin/.idea/kotlin.iml generated Normal file
View file

@ -0,0 +1,9 @@
<?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="1.9.21" />
<option name="version" value="2.0.0" />
</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="20" project-jdk-type="JavaSDK" />
</project>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="17" project-jdk-type="JavaSDK" />
</project>

View file

@ -0,0 +1,8 @@
<?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.50.0"
kotlin("jvm") version "1.9.21"
id("com.github.ben-manes.versions") version "0.51.0"
kotlin("jvm") version "2.1.20"
}
defaultTasks(ApplicationPlugin.TASK_RUN_NAME)
@ -11,10 +11,11 @@ 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.1.1")
implementation("net.thauvin.erik:pinboard-poster:1.2.1-SNAPSHOT")
}
java {
@ -26,8 +27,6 @@ application {
mainClass.set("net.thauvin.erik.pinboard.samples.KotlinExampleKt")
}
tasks {
withType<KotlinCompile>().configureEach {
kotlinOptions.jvmTarget = java.targetCompatibility.toString()
}
kotlin {
compilerOptions.jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11)
}

View file

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

View file

@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@ -84,7 +86,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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@ -203,7 +205,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_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.

View file

@ -13,6 +13,8 @@
@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 ##########################################################################
@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail

View file

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

Binary file not shown.

View file

@ -1,9 +1,10 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
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.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-SNAPSHOT
bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.1.0-SNAPSHOT
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.sourceDirectories=
bld.version=1.7.5
bld.version=2.2.1

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.1.1</version>
<version>1.2.1-SNAPSHOT</version>
<name>pinboard-poster</name>
<description>A small library for posting to Pinboard</description>
<url>https://github.com/ethauvin/pinboard-poster</url>
@ -18,25 +18,19 @@
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>1.9.21</version>
<version>2.1.20</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-common</artifactId>
<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>
<version>2.1.20</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>1.9.21</version>
<version>2.1.20</version>
<scope>compile</scope>
</dependency>
<dependency>

View file

@ -1,7 +1,7 @@
/*
* PinboardPosterBuild.java
*
* Copyright 2021-2023 Erik C. Thauvin (erik@thauvin.net)
* Copyright (c) 2017-2025, 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,10 +35,11 @@ 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;
@ -49,16 +50,21 @@ 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, 1, 1);
version = version(1, 2, 1, "SNAPSHOT");
mainClass = pkg + ".PinboardPoster";
@ -68,62 +74,73 @@ public class PinboardPosterBuild extends Project {
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL);
final var okHttp = version(4, 12, 0);
final var kotlin = version(1, 9, 21);
final var kotlin = version(2, 1, 20);
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", 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)));
.include(dependency("org.jetbrains.kotlin", "kotlin-test-junit5", kotlin))
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 12, 1)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 12, 1)))
.include(dependency("org.junit.platform", "junit-platform-launcher", version(1, 12, 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(new File(srcMainDirectory(), "kotlin"));
jarSourcesOperation().sourceDirectories(srcMainKotlin);
}
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 IOException {
public void compile() throws Exception {
new CompileKotlinOperation()
.fromProject(this)
.compileOptions(new CompileOptions().verbose(true))
.execute();
}
@ -145,9 +162,10 @@ public class PinboardPosterBuild extends Project {
}
@BuildCommand(summary = "Generates JaCoCo Reports")
public void jacoco() throws IOException {
public void jacoco() throws Exception {
new JacocoReportOperation()
.fromProject(this)
.sourceFiles(srcMainKotlin)
.execute();
}
@ -169,6 +187,12 @@ 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,8 +1,7 @@
/*
* PinConfig.kt
*
* Copyright (c) 2017-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
* Copyright (c) 2017-2025, 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:
@ -38,48 +37,74 @@ import java.time.ZonedDateTime
*
* Supports of all the [Pinboard API Parameters](https://pinboard.in/api/#posts_add).
*/
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
) {
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
/**
* Configures the parameters to add a pin.
*
* @param url The URL of the bookmark.
* @param description The title of the bookmark.
*/
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 }
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
fun build() = PinConfig(
url,
description,
extended,
tags,
dt,
replace,
shared,
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)
override fun equals(other: Any?): Boolean {
if (this === other) return true
@ -115,7 +140,5 @@ class PinConfig private constructor(
return "Builder(url='$url', description='$description', extended='$extended'," +
"tags=${tags.contentToString()}, dt=$dt, replace=$replace, shared=$shared, toRead=$toRead)"
}
}
}

View file

@ -1,8 +1,7 @@
/*
* PinboardPoster.kt
*
* Copyright (c) 2017-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
* Copyright (c) 2017-2025, 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:

View file

@ -1,8 +1,7 @@
/*
* PinboardPosterTest.kt
*
* Copyright (c) 2017-2023, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
* Copyright (c) 2017-2025, 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:
@ -44,11 +43,13 @@ import kotlin.test.assertFalse
import kotlin.test.assertTrue
class PinboardPosterTest {
private val url = "http://www.example.com/?random=" + (1000..10000).random()
private val url = randomUrl()
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("")
@ -66,6 +67,7 @@ class PinboardPosterTest {
if (!isCi) {
poster.logger.level = Level.FINE
}
assertTrue(poster.validate(), "validate()")
assertTrue(poster.addPin(url, desc), "addPin($url, $desc)")
@ -82,7 +84,7 @@ class PinboardPosterTest {
assertTrue(poster.validate(), "validate()")
var config = PinConfig.Builder().url(url).description(desc).extended("extra")
var config = PinConfig.Builder(url, desc).extended("extra")
assertTrue(poster.addPin(config.build()), "apiToken: ${Constants.ENV_API_TOKEN}")
@ -98,13 +100,17 @@ class PinboardPosterTest {
assertTrue(e.message!!.contains("item already exists"))
}
config = config.replace(true).toRead(true)
config = config.description("Yet another test.").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