Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
fetch-depth: 0
repository: openrndr/openrndr
path: ./openrndr
ref: master
ref: feature-variants

- name: Test glxinfo
run: |
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 @@ -22,7 +22,7 @@ jobs:
fetch-depth: 0
repository: openrndr/openrndr
path: ./openrndr
ref: master
ref: feature-variants

- name: Test glxinfo
run: |
Expand Down
7 changes: 7 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
`kotlin-dsl`
}

repositories {
gradlePluginPortal()
}
24 changes: 24 additions & 0 deletions build-logic/orx-convention/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
plugins {
`kotlin-dsl`
}

val preload: SourceSet by project.sourceSets.creating

repositories {
mavenCentral()
mavenLocal()
}
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
dependencies {
implementation(project(":orx-variant-plugin"))
implementation(libs.findLibrary("kotlin-gradle-plugin").get())
implementation(libs.findLibrary("dokka-gradle-plugin").get())
"preloadImplementation"(openrndr.application)
"preloadImplementation"(openrndr.orextensions)
}
kotlin {
compilerOptions {
freeCompilerArgs.add("-Xskip-metadata-version-check")
}
}
tasks.getByName("compileKotlin").dependsOn("compilePreloadKotlin")
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ abstract class CollectScreenshotsTask @Inject constructor() : DefaultTask() {

@TaskAction
fun execute(inputChanges: InputChanges) {
val preloadClass = File(project.rootProject.projectDir, "buildSrc/build/classes/kotlin/preload")
val preloadClass = File(project.rootProject.projectDir, "build-logic/orx-convention/build/classes/kotlin/preload")
require(preloadClass.exists()) {
"preload class not found: '${preloadClass.absolutePath}'"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import org.gradle.nativeplatform.MachineArchitecture
import org.gradle.nativeplatform.OperatingSystemFamily
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform

data class JvmNativeVariant(val targetName: String, val os: String, val arch: String)

val currentOperatingSystemName: String = DefaultNativePlatform.getCurrentOperatingSystem().toFamilyName()
val currentArchitectureName: String = DefaultNativePlatform.getCurrentArchitecture().name

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.openrndr.extra.convention

addHostMachineAttributesToRuntimeConfigurations()

Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package org.openrndr.extra.convention

import ScreenshotsHelper.collectScreenshots
import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.kotlin.dsl.the
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

val sharedLibs = extensions.getByType(VersionCatalogsExtension::class.java).named("sharedLibs")
val openrndr = extensions.getByType(VersionCatalogsExtension::class.java).named("openrndr")
val libs = the<LibrariesForLibs>()
val libs = extensions.getByType(VersionCatalogsExtension::class.java).named("libs")

val shouldPublish = project.name !in setOf("openrndr-demos", "orx-git-archiver-gradle")

Expand All @@ -34,10 +32,10 @@ repositories {

group = "org.openrndr.extra"

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

@Suppress("UNUSED_VARIABLE")
val demo: SourceSet by sourceSets.creating {
val demo: SourceSet by project.sourceSets.creating {
val skipDemos = setOf(
"openrndr-demos",
"orx-axidraw",
Expand All @@ -60,13 +58,11 @@ dependencies {
testRuntimeOnly(sharedLibs.findLibrary("slf4j-simple").get())
"demoImplementation"(main.output.classesDirs + main.runtimeClasspath)
"demoImplementation"(openrndr.findLibrary("application").get())
"demoImplementation"(libs.openrndr.extensions)
"demoImplementation"(openrndr.findLibrary("orextensions").get())

if (DefaultNativePlatform.getCurrentOperatingSystem().isMacOsX) {
"demoRuntimeOnly"(libs.openrndr.gl3.natives.macos.arm64)
}
"demoRuntimeOnly"(libs.openrndr.gl3.core)
"demoRuntimeOnly"(sharedLibs.findLibrary("slf4j.simple").get())
"demoRuntimeOnly"(openrndr.findLibrary("gl3").get())

"demoRuntimeOnly"(sharedLibs.findLibrary("slf4j-simple").get())
}

tasks {
Expand All @@ -88,20 +84,20 @@ tasks {
}
withType<KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.valueOf("JVM_${libs.versions.jvmTarget.get()}"))
jvmTarget.set(JvmTarget.valueOf("JVM_${libs.findVersion("jvmTarget").get().displayName.replace(".", "_")}"))
freeCompilerArgs.add("-Xexpect-actual-classes")
freeCompilerArgs.add("-Xjdk-release=${libs.versions.jvmTarget.get()}")
apiVersion.set(KotlinVersion.valueOf("KOTLIN_${libs.versions.kotlinApi.get().replace(".", "_")}"))
languageVersion.set(KotlinVersion.valueOf("KOTLIN_${libs.versions.kotlinLanguage.get().replace(".", "_")}"))
freeCompilerArgs.add("-Xjdk-release=${libs.findVersion("jvmTarget").get().displayName}")
apiVersion.set(KotlinVersion.valueOf("KOTLIN_${libs.findVersion("kotlinApi").get().displayName.replace(".", "_")}"))
languageVersion.set(KotlinVersion.valueOf("KOTLIN_${libs.findVersion("kotlinLanguage").get().displayName.replace(".", "_")}"))
}
}
}

java {
withJavadocJar()
withSourcesJar()
targetCompatibility = JavaVersion.valueOf("VERSION_${libs.versions.jvmTarget.get()}")
sourceCompatibility = JavaVersion.valueOf("VERSION_${libs.versions.jvmTarget.get()}")
targetCompatibility = JavaVersion.valueOf("VERSION_${libs.findVersion("jvmTarget").get().displayName}")
sourceCompatibility = JavaVersion.valueOf("VERSION_${libs.findVersion("jvmTarget").get().displayName}")
}

val isReleaseVersion = !(version.toString()).endsWith("SNAPSHOT")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.openrndr.extra.convention

import CollectScreenshotsTask
import org.gradle.accessors.dm.LibrariesForLibs

import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
Expand All @@ -11,7 +10,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

val libs = the<LibrariesForLibs>()
val libs = extensions.getByType(VersionCatalogsExtension::class.java).named("libs")
val sharedLibs = extensions.getByType(VersionCatalogsExtension::class.java).named("sharedLibs")
val openrndr = extensions.getByType(VersionCatalogsExtension::class.java).named("openrndr")

Expand All @@ -37,16 +36,16 @@ group = "org.openrndr.extra"

tasks.withType<KotlinCompilationTask<*>> {
compilerOptions {
apiVersion.set(KotlinVersion.valueOf("KOTLIN_${libs.versions.kotlinApi.get().replace(".", "_")}"))
languageVersion.set(KotlinVersion.valueOf("KOTLIN_${libs.versions.kotlinLanguage.get().replace(".", "_")}"))
apiVersion.set(KotlinVersion.valueOf("KOTLIN_${libs.findVersion("kotlinApi").get().displayName.replace(".", "_")}"))
languageVersion.set(KotlinVersion.valueOf("KOTLIN_${libs.findVersion("kotlinLanguage").get().displayName.replace(".", "_")}"))
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}

tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.fromTarget(libs.versions.jvmTarget.get()))
freeCompilerArgs.add("-Xjdk-release=${libs.versions.jvmTarget.get()}")
jvmTarget.set(JvmTarget.fromTarget(libs.findVersion("jvmTarget").get().displayName))
freeCompilerArgs.add("-Xjdk-release=${libs.findVersion("jvmTarget").get().displayName}")
}
}

Expand All @@ -65,9 +64,8 @@ kotlin {
dependsOn(compileTaskProvider)
}
dependencies {
if (DefaultNativePlatform.getCurrentOperatingSystem().isMacOsX) {
runtimeOnly(libs.openrndr.gl3.natives.macos.arm64)
}
runtimeOnly(openrndr.findLibrary("gl3").get())

}
}
}
Expand All @@ -91,14 +89,14 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.kotlin.stdlib)
implementation(libs.findLibrary("kotlin-stdlib").get())
implementation(sharedLibs.findLibrary("kotlin-logging").get())
}
}

val commonTest by getting {
dependencies {
implementation(libs.kotlin.test)
implementation(libs.findLibrary("kotlin-test").get())
}
}

Expand All @@ -113,7 +111,7 @@ kotlin {
dependencies {
implementation(openrndr.findLibrary("application").get())
implementation(openrndr.findLibrary("orextensions").get())
runtimeOnly(libs.openrndr.gl3.core)
runtimeOnly(openrndr.findLibrary("gl3").get())
runtimeOnly(sharedLibs.findLibrary("slf4j-simple").get())
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.openrndr.extra.convention

plugins {
id("orx-variant")
}
17 changes: 17 additions & 0 deletions build-logic/orx-variant-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
}


gradlePlugin {
plugins {
create("orxVariants") {
id = "orx-variant"
implementationClass = "org.openrndr.extra.variant.plugin.VariantPlugin"
}
}
}
Loading