Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ksp configuration in projects #849

Merged
merged 2 commits into from
Jan 16, 2024
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
22 changes: 7 additions & 15 deletions examples/masterdetail/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import com.google.devtools.ksp.gradle.KspTask
import com.google.devtools.ksp.gradle.KspTaskMetadata
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
Expand Down Expand Up @@ -32,18 +36,6 @@ kotlin {
}
}

/**
* KSP support - start
*/
dependencies {
add("kspCommonMainMetadata", project(":lenses-annotation-processor"))
}

kotlin.sourceSets.commonMain { kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin") }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>>().all {
if (name != "kspCommonMainKotlinMetadata") dependsOn("kspCommonMainKotlinMetadata")
}
// needed to work on Apple Silicon. Should be fixed by 1.6.20 (https://youtrack.jetbrains.com/issue/KT-49109#focus=Comments-27-5259190.0-0)
/**
* KSP support - end
*/
// KSP support for Lens generation
dependencies.kspCommonMainMetadata(project(":lenses-annotation-processor"))
kotlin.sourceSets.commonMain { tasks.withType<KspTaskMetadata> { kotlin.srcDir(destinationDirectory) } }
22 changes: 7 additions & 15 deletions examples/nestedmodel/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import com.google.devtools.ksp.gradle.KspTask
import com.google.devtools.ksp.gradle.KspTaskMetadata
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
Expand Down Expand Up @@ -31,18 +35,6 @@ kotlin {
}
}

/**
* KSP support - start
*/
dependencies {
add("kspCommonMainMetadata", project(":lenses-annotation-processor"))
}

kotlin.sourceSets.commonMain { kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin") }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>>().all {
if (name != "kspCommonMainKotlinMetadata") dependsOn("kspCommonMainKotlinMetadata")
}
// needed to work on Apple Silicon. Should be fixed by 1.6.20 (https://youtrack.jetbrains.com/issue/KT-49109#focus=Comments-27-5259190.0-0)
/**
* KSP support - end
*/
// KSP support for Lens generation
dependencies.kspCommonMainMetadata(project(":lenses-annotation-processor"))
kotlin.sourceSets.commonMain { tasks.withType<KspTaskMetadata> { kotlin.srcDir(destinationDirectory) } }
21 changes: 7 additions & 14 deletions examples/tictactoe/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import com.google.devtools.ksp.gradle.KspTask
import com.google.devtools.ksp.gradle.KspTaskMetadata
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
Expand Down Expand Up @@ -33,17 +37,6 @@ kotlin {
}
}

/**
* KSP support - start
*/
dependencies {
add("kspCommonMainMetadata", project(":lenses-annotation-processor"))
}

kotlin.sourceSets.commonMain { kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin") }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>>().all {
if (name != "kspCommonMainKotlinMetadata") dependsOn("kspCommonMainKotlinMetadata")
}
/**
* KSP support - end
*/
// KSP support for Lens generation
dependencies.kspCommonMainMetadata(project(":lenses-annotation-processor"))
kotlin.sourceSets.commonMain { tasks.withType<KspTaskMetadata> { kotlin.srcDir(destinationDirectory) } }
21 changes: 7 additions & 14 deletions examples/todomvc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import com.google.devtools.ksp.gradle.KspTask
import com.google.devtools.ksp.gradle.KspTaskMetadata
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
Expand Down Expand Up @@ -28,17 +32,6 @@ kotlin {
}
}

/**
* KSP support - start
*/
dependencies {
add("kspCommonMainMetadata", project(":lenses-annotation-processor"))
}

kotlin.sourceSets.commonMain { kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin") }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>>().all {
if (name != "kspCommonMainKotlinMetadata") dependsOn("kspCommonMainKotlinMetadata")
}
/**
* KSP support - end
*/
// KSP support for Lens generation
dependencies.kspCommonMainMetadata(project(":lenses-annotation-processor"))
kotlin.sourceSets.commonMain { tasks.withType<KspTaskMetadata> { kotlin.srcDir(destinationDirectory) } }
22 changes: 7 additions & 15 deletions examples/validation/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import com.google.devtools.ksp.gradle.KspTask
import com.google.devtools.ksp.gradle.KspTaskMetadata
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
Expand Down Expand Up @@ -32,18 +36,6 @@ kotlin {
}
}

/**
* KSP support - start
*/
dependencies {
add("kspCommonMainMetadata", project(":lenses-annotation-processor"))
}

kotlin.sourceSets.commonMain { kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin") }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>>().all {
if (name != "kspCommonMainKotlinMetadata") dependsOn("kspCommonMainKotlinMetadata")
}
// needed to work on Apple Silicon. Should be fixed by 1.6.20 (https://youtrack.jetbrains.com/issue/KT-49109#focus=Comments-27-5259190.0-0)
/**
* KSP support - end
*/
// KSP support for Lens generation
dependencies.kspCommonMainMetadata(project(":lenses-annotation-processor"))
kotlin.sourceSets.commonMain { tasks.withType<KspTaskMetadata> { kotlin.srcDir(destinationDirectory) } }
21 changes: 7 additions & 14 deletions headless-demo/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import com.google.devtools.ksp.gradle.KspTask
import com.google.devtools.ksp.gradle.KspTaskMetadata
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
kotlin("multiplatform")
id("com.google.devtools.ksp")
Expand Down Expand Up @@ -38,17 +42,6 @@ kotlin {
}
}

/**
* KSP support - start
*/
dependencies {
add("kspCommonMainMetadata", project(":lenses-annotation-processor"))
}
kotlin.sourceSets.commonMain { kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin") }

tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>>().all {
if (name != "kspCommonMainKotlinMetadata") dependsOn("kspCommonMainKotlinMetadata")
}
/**
* KSP support - end
*/
// KSP support for Lens generation
dependencies.kspCommonMainMetadata(project(":lenses-annotation-processor"))
kotlin.sourceSets.commonMain { tasks.withType<KspTaskMetadata> { kotlin.srcDir(destinationDirectory) } }
16 changes: 3 additions & 13 deletions www/src/pages/docs/10_Getting Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,9 @@ kotlin {
}
}

/**
* KSP support for Lens generation - start
*/
dependencies {
add("kspCommonMainMetadata", "dev.fritz2:lenses-annotation-processor:$fritz2Version")
}
kotlin.sourceSets.commonMain { kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin") }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>>().all {
if (name != "kspCommonMainKotlinMetadata") dependsOn("kspCommonMainKotlinMetadata")
}
/**
* KSP support - end
*/
// KSP support for Lens generation
dependencies.kspCommonMainMetadata("dev.fritz2:lenses-annotation-processor:$fritz2Version")
kotlin.sourceSets.commonMain { tasks.withType<KspTaskMetadata> { kotlin.srcDir(destinationDirectory) } }
```

## Organize Your Code
Expand Down