Skip to content
Merged
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
12 changes: 3 additions & 9 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

cancel-previous-runs:
name: Cancel Previous Runs
runs-on: [ ubuntu-20.04 ]
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
Expand All @@ -20,7 +20,7 @@ jobs:

check-commit-message:
name: Check Commit Message
runs-on: [ ubuntu-20.04 ]
runs-on: ubuntu-latest
steps:
- name: Check commit message line length
uses: gsactions/commit-message-checker@16fa2d5de096ae0d35626443bcd24f1e756cafee # v2.0.0
Expand All @@ -44,7 +44,7 @@ jobs:
gradle:
name: Gradle Build
needs: cancel-previous-runs
runs-on: [ ubuntu-20.04 ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -56,12 +56,6 @@ jobs:
# noinspection YAMLIncompatibleTypes
java-version: "21.0.1-graalce"

- name: Setup Java (11)
uses: renatoathaydes/setup-java-sdkman@2.1.1
with:
# noinspection YAMLIncompatibleTypes
java-version: "11.0.21-zulu"

- name: Setup Gradle
uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1 # v3.5.0

Expand Down
21 changes: 21 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension

plugins {
alias(libs.plugins.kotlin)
alias(libs.plugins.kotlin.kapt) apply false
alias(libs.plugins.spotless)
}

allprojects {
Expand All @@ -12,3 +15,21 @@ allprojects {
}
}
}

subprojects {
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
configure<KotlinJvmProjectExtension> {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(21))
vendor.set(JvmVendorSpec.GRAAL_VM)
}
}
}
}

spotless {
kotlinGradle {
ktfmt(libs.versions.ktfmt.get()).kotlinlangStyle()
targetExclude("build/generated/")
}
}
27 changes: 14 additions & 13 deletions data-class-fragment/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
alias(libs.plugins.kotlin)
alias(libs.plugins.kotlin.kapt)
alias(libs.plugins.spotless)
}

group = "org.example"

version = "unspecified"

repositories {
Expand All @@ -20,7 +23,10 @@ dependencies {
implementation(libs.logback.classic)

implementation(libs.kotlinpoet)
implementation(libs.kotlinpoet.ksp)
implementation(libs.kotlinpoet.metadata)
implementation(libs.ksp.api)
implementation(libs.arrowkt.core)
kapt(libs.auto.service)
annotationProcessor(libs.auto.service)
compileOnly(libs.auto.service)
Expand All @@ -29,25 +35,20 @@ dependencies {
testImplementation(libs.junit.jupiter.engine)
}

// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}

tasks.test {
useJUnitPlatform()
}
tasks.test { useJUnitPlatform() }

spotless {
kotlin {
toggleOffOn()
ktlint().setEditorConfigPath("$rootDir/.editorconfig")
targetExclude("build/generated/")
targetExclude("build/**/*")
ktfmt(libs.versions.ktfmt.get()).kotlinlangStyle()
}
kotlinGradle {
toggleOffOn()
ktlint()
ktfmt(libs.versions.ktfmt.get()).kotlinlangStyle()
}
}

tasks.withType<KotlinCompile> {
compilerOptions { freeCompilerArgs.addAll(listOf("-Xcontext-parameters")) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,56 +13,91 @@ sealed class DataClassProperty

sealed class Nullability {
data object Nullable : Nullability()

data object NotNull : Nullability()
}

class PropertyWithNullability<T, N : Nullability> : DataClassProperty()

class NestedPropertyWithNullability<T : DataClassFragment, N : Nullability> : DataClassProperty()
class ArrayPropertyWithNullability<T : DataClassProperty, N : Nullability, I : Iterable<*>> : DataClassProperty()

class ArrayPropertyWithNullability<T : DataClassProperty, N : Nullability, I : Iterable<*>> :
DataClassProperty()

class MapPropertyWithNullability<T : DataClassProperty, N : Nullability> : DataClassProperty()

// region Type Aliases for convenience
typealias Property<T> = PropertyWithNullability<T, Nullability.Nullable>

typealias PropertyNotNull<T> = PropertyWithNullability<T, Nullability.NotNull>

typealias StringProperty = Property<String>

typealias StringPropertyNotNull = PropertyNotNull<String>

typealias ShortProperty = Property<Short>

typealias ShortPropertyNotNull = PropertyNotNull<Short>

typealias IntProperty = Property<Int>

typealias IntPropertyNotNull = PropertyNotNull<Int>

typealias LongProperty = Property<Long>

typealias LongPropertyNotNull = PropertyNotNull<Long>

typealias DoubleProperty = Property<Double>

typealias DoublePropertyNotNull = PropertyNotNull<Double>

typealias FloatProperty = Property<Float>

typealias FloatPropertyNotNull = PropertyNotNull<Float>

typealias BooleanProperty = Property<Boolean>

typealias BooleanPropertyNotNull = PropertyNotNull<Boolean>

typealias ByteProperty = Property<Byte>

typealias BytePropertyNotNull = PropertyNotNull<Byte>

typealias BigDecimalProperty = Property<BigDecimal>

typealias BigDecimalPropertyNotNull = PropertyNotNull<BigDecimal>

typealias BigIntProperty = Property<BigInteger>

typealias BigIntPropertyNotNull = PropertyNotNull<BigInteger>

typealias DateProperty = Property<LocalDate>

typealias DatePropertyNotNull = PropertyNotNull<LocalDate>

typealias TimestampProperty = Property<Instant>

typealias TimestampPropertyNotNull = PropertyNotNull<Instant>

typealias NestedProperty<T> = NestedPropertyWithNullability<T, Nullability.Nullable>

typealias NestedPropertyNotNull<T> = NestedPropertyWithNullability<T, Nullability.NotNull>

typealias ListProperty<T> = ArrayPropertyWithNullability<T, Nullability.Nullable, List<*>>

typealias ListOfNestedProperty<T> = ListProperty<NestedProperty<T>>

typealias ListOfNestedPropertyNotNull<T> = ListPropertyNotNull<NestedPropertyNotNull<T>>

typealias ListPropertyNotNull<T> = ArrayPropertyWithNullability<T, Nullability.NotNull, List<*>>

typealias ListOfStringPropertyNotNull = ListPropertyNotNull<StringPropertyNotNull>

typealias SetProperty<T> = ArrayPropertyWithNullability<T, Nullability.Nullable, Set<*>>

typealias SetPropertyNotNull<T> = ArrayPropertyWithNullability<T, Nullability.NotNull, Set<*>>

typealias MapProperty<T> = MapPropertyWithNullability<T, Nullability.Nullable>

typealias MapPropertyNotNull<T> = MapPropertyWithNullability<T, Nullability.NotNull>
// endregion
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package sims.michael.gitjaspr.dataclassfragment
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.SOURCE)
annotation class GenerateDataClassFragmentDataClass(
val testDataDslFactoryFunctionName: String = "",
val testDataDslFactoryFunctionName: String = ""
) {

@Target(AnnotationTarget.PROPERTY)
Expand Down
Loading
Loading