Skip to content

Commit

Permalink
Use rich version range for openrndr (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vechro authored Mar 4, 2023
1 parent 8af6b76 commit 4d0a41a
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

- name: Build OPENRNDR
working-directory: ./openrndr
run: ./gradlew publishToMavenLocal -Prelease.version=0.5.1-SNAPSHOT
run: ./gradlew publishToMavenLocal snapshot

- name: Build ORX
run: ./gradlew build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-screenshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

- name: Build OPENRNDR
working-directory: ./openrndr
run: ./gradlew publishToMavenLocal -Prelease.version=0.5.1-SNAPSHOT
run: ./gradlew publishToMavenLocal snapshot

- name: Build ORX
run: ./gradlew build
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/release-candidate-to-maven-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,19 @@ jobs:
release_candidate_to_maven_central:
runs-on: ubuntu-latest
steps:
- name: Get OPENRNDR release tag
run: echo "OPENRNDR_VERSION=$(git ls-remote --refs --tags https://github.com/openrndr/openrndr | cut --delimiter='/' --fields=3 | sort --version-sort | tail --lines=1)" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Build ORX
env:
OPENRNDR_VERSION: ${{ env.OPENRNDR_VERSION }}
run: ./gradlew -POPENRNDR.version=${{ env.OPENRNDR_VERSION }} -Prelease.useLastTag=true build
run: ./gradlew -Prelease.useLastTag=true build
- name: Decode
run: |
echo "${{secrets.SIGNING_SECRET_KEY_RING_FILE}}" > ~/.gradle/secring.gpg.b64
base64 -d ~/.gradle/secring.gpg.b64 > ~/.gradle/secring.gpg
- name: Publish
run: ./gradlew publishToSonatype -POPENRNDR.version=${{env.OPENRNDR_VERSION}} -Prelease.useLastTag=true -Psigning.keyId=${{secrets.SIGNING_KEY_ID}} -Psigning.password=openrndr -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg)
run: ./gradlew publishToSonatype -Prelease.useLastTag=true -Psigning.keyId=${{secrets.SIGNING_KEY_ID}} -Psigning.password=openrndr -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg)
env:
OSSRH_USERNAME: ${{secrets.OSSRH_USERNAME}}
OSSRH_PASSWORD: ${{secrets.OSSRH_PASSWORD}}
11 changes: 2 additions & 9 deletions .github/workflows/release-to-maven-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,19 @@ jobs:
release_to_maven_central:
runs-on: ubuntu-latest
steps:
- name: Get OPENRNDR release tag
run: echo "OPENRNDR_VERSION=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/openrndr/openrndr | cut --delimiter='/' --fields=3 | tail --lines=1)" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Build ORX
env:
OPENRNDR_VERSION: ${{ env.OPENRNDR_VERSION }}
run: ./gradlew -POPENRNDR.version=${{ env.OPENRNDR_VERSION }} -Prelease.useLastTag=true build
run: ./gradlew -Prelease.useLastTag=true build
- name: Decode
run: |
echo "${{secrets.SIGNING_SECRET_KEY_RING_FILE}}" > ~/.gradle/secring.gpg.b64
base64 -d ~/.gradle/secring.gpg.b64 > ~/.gradle/secring.gpg
- name: Publish
run: ./gradlew publishToSonatype -POPENRNDR.version=${{env.OPENRNDR_VERSION}} -Prelease.useLastTag=true -Psigning.keyId=${{secrets.SIGNING_KEY_ID}} -Psigning.password=openrndr -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg)
run: ./gradlew publishToSonatype -Prelease.useLastTag=true -Psigning.keyId=${{secrets.SIGNING_KEY_ID}} -Psigning.password=openrndr -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg)
env:
OSSRH_USERNAME: ${{secrets.OSSRH_USERNAME}}
OSSRH_PASSWORD: ${{secrets.OSSRH_PASSWORD}}
35 changes: 27 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# ORX (OPENRNDR EXTRA) 0.4
# ORX (OPENRNDR EXTRA)

Note that this is a yet unreleased version of ORX. The prior released version of ORX can be found in the [ORX 0.3 branch](https://github.com/openrndr/orx/tree/orx-0.3).

A growing library of assorted data structures, algorithms and utilities.
A growing library of assorted data structures, algorithms and utilities to
complement [OPENRNDR](https://github.com/openrndr/openrndr).

<!-- __orxListBegin__ -->

Expand Down Expand Up @@ -70,10 +69,30 @@ A growing library of assorted data structures, algorithms and utilities.

# Developer notes

## Create and use local builds of the library
## Publish and use local builds of the library in your applications

First, build and publish [OPENRNDR](https://github.com/openrndr/openrndr) to the local maven repository:

Run (or import in IntelliJ IDEA and edit the run configuration).
```sh
# In openrndr repository
./gradlew publishToMavenLocal snapshot
```

This command will build and publish a snapshot of the next version of the library. For example, if the current latest
release is 0.4.2, then it will create a release named "0.4.3-SNAPSHOT" and publish it to your local maven repository.
The exact version will be shown in the console output during the build process.

Now you can run the same command again but for this repository.

First build and publish OPENRNDR 0.4 SNAPSHOT (using `-Prelease.version=0.5.1-SNAPSHOT`) from the `openrndr-0.4` branch.
```sh
# In orx repository
./gradlew publishToMavenLocal snapshot
```

run `./gradlew publishToMavenLocal -Prelease.version=0.5.1-SNAPSHOT` (or import in IntelliJ IDEA and edit the run configuration)
It will automatically use the locally published snapshot of OPENRNDR for building ORX and will publish ORX to your local
maven repository with the same logic as before.

In an [`openrndr-template`](https://youtu.be/saAzoREfa90?t=787) based project set `orxUseSnapshot = true` in order to use the snapshot build.
Once that's done, you can use the local build of ORX in
your [openrndr-template](https://github.com/openrndr/openrndr-template) by specifying the version you published. In this
case, it would be "0.4.3-SNAPSHOT".
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ configure(allprojects.findAll { !doNotPublish.contains(it.name) && !multiplatfor
from components.java
versionMapping {
allVariants {
fromResolutionOf("default")
fromResolutionResult()
}
}
groupId = "org.openrndr.extra"
Expand Down
10 changes: 0 additions & 10 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ repositories {
mavenLocal()
}

val openrndrVersion: String =
(extra.properties["OPENRNDR.version"] as String? ?: System.getenv("OPENRNDR_VERSION"))?.removePrefix("v")
?: "0.5.1-SNAPSHOT"

configurations.all {
resolutionStrategy.eachDependency {
if (requested.group == "org.openrndr") useVersion(openrndrVersion)
}
}

dependencies {
implementation(libs.kotlin.gradle.plugin)
implementation(libs.dokka.gradle.plugin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@ package org.openrndr.extra.convention

addHostMachineAttributesToRuntimeConfigurations()

val openrndrVersion: String =
(extra.properties["OPENRNDR.version"] as String? ?: System.getenv("OPENRNDR_VERSION"))?.removePrefix("v")
?: "0.5.1-SNAPSHOT"

configurations.all {
resolutionStrategy.eachDependency {
if (requested.group == "org.openrndr") useVersion(openrndrVersion)
}
}

dependencies {
components {
all<LwjglRule>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package org.openrndr.extra.convention
import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URI

val libs = the<LibrariesForLibs>()

Expand All @@ -22,10 +21,10 @@ repositories {

group = "org.openrndr.extra"

val main by sourceSets.getting
val main: SourceSet by sourceSets.getting

@Suppress("UNUSED_VARIABLE")
val demo by sourceSets.creating
val demo: SourceSet by sourceSets.creating

dependencies {
implementation(libs.kotlin.stdlib)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import CollectScreenshotsTask
import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URI

val libs = the<LibrariesForLibs>()

Expand All @@ -31,15 +30,16 @@ kotlin {
jvm {
jvmToolchain(libs.versions.jvmTarget.get().toInt())
compilations {
val main by getting
val main by getting

@Suppress("UNUSED_VARIABLE")
val demo by creating {
associateWith(main)
tasks.register<CollectScreenshotsTask>("collectScreenshots") {
inputDir.set(output.classesDirs.singleFile)
runtimeDependencies.set(runtimeDependencyFiles)
outputDir.set(project.file(project.projectDir.toString() + "/images"))
dependsOn(compileKotlinTask)
dependsOn(compileTaskProvider)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kotlinApi = "1.8"
kotlinLanguage = "1.8"
kotlin = "1.8.10"
jvmTarget = "11"
openrndr = "0.0.0"
openrndr = { require = "[0.4.2, 1.0.0)" }
kotlinxCoroutines = "1.6.4"
kotlinLogging = "3.0.0"
kotlinxSerialization = "1.5.0-RC"
Expand Down

0 comments on commit 4d0a41a

Please sign in to comment.