Skip to content

Commit

Permalink
Try to fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
cupertank committed Jul 10, 2024
1 parent fc03e2b commit 26e2f55
Showing 1 changed file with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,50 @@ class PrimitivesGradlePlugin : Plugin<Project> {

val primitivesExt = project.extensions.create(extensionName, PrimitivesExtension::class.java)

val primitivesTask = project.tasks.register(primitivesTaskName, PrimitivesTask::class.java) { primitivesTask ->
primitivesTask.generationPath.set(primitivesExt.generationPath)
}

project.afterEvaluate {
val primitivesTask = project.tasks.register(primitivesTaskName, PrimitivesTask::class.java) { primitivesTask ->
primitivesTask.generationPath.set(primitivesExt.generationPath)
}

val buildDependenciesTasks = project.tasks.named("buildNeeded").get().dependsOn.filterNot { it == "build" }.filterNotNull()
for (task in buildDependenciesTasks) {
primitivesTask.get().dependsOn(task)
}
}

kotlinExt.sourceSets.all { sourceSet ->
val sourceSetName = sourceSet.name
val fullPath = primitivesExt.generationPath.dir(sourceSetName)
kotlinExt.sourceSets.all { sourceSet ->
val sourceSetName = sourceSet.name
val fullPath = primitivesExt.generationPath.dir(sourceSetName)

sourceSet.kotlin.srcDir(fullPath)
sourceSet.kotlin.srcDir(fullPath)

//Support for Incremental compilation
primitivesTask.get().inputs
.files(sourceSet.kotlin.asFileTree)
.withPathSensitivity(PathSensitivity.ABSOLUTE)
.normalizeLineEndings()
.skipWhenEmpty()
}
//Support for Incremental compilation
primitivesTask.get().inputs
.files(sourceSet.kotlin.asFileTree)
.withPathSensitivity(PathSensitivity.ABSOLUTE)
.normalizeLineEndings()
.skipWhenEmpty()
}

fun configureCompilation(compilation: KotlinCompilation<*>) {
val targetTask = compilation.compileTaskProvider
fun configureCompilation(compilation: KotlinCompilation<*>) {
val targetTask = compilation.compileTaskProvider

targetTask.configure {
it.dependsOn(primitivesTask)
targetTask.configure {
it.dependsOn(primitivesTask)
}
}
}

if (kotlinExt is KotlinMultiplatformExtension) {
kotlinExt.targets.all { kotlinTarget ->
kotlinTarget.compilations.all { compilation ->
configureCompilation(compilation)
if (kotlinExt is KotlinMultiplatformExtension) {
kotlinExt.targets.all { kotlinTarget ->
kotlinTarget.compilations.all { compilation ->
configureCompilation(compilation)
}
}
}
}

if (kotlinExt is KotlinSingleTargetExtension<*>) {
kotlinExt.target.compilations.all { compilation ->
configureCompilation(compilation)
if (kotlinExt is KotlinSingleTargetExtension<*>) {
kotlinExt.target.compilations.all { compilation ->
configureCompilation(compilation)
}
}
}
}
Expand Down

0 comments on commit 26e2f55

Please sign in to comment.