Skip to content

Commit

Permalink
Fix generateProjectData task not being wired with the Kotlin source…
Browse files Browse the repository at this point in the history
… set
  • Loading branch information
JavierSegoviaCordoba committed Feb 4, 2024
1 parent f496040 commit d671c4c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

### Fixed

- `generateProjectData` task not being wired with the Kotlin source set

### Updated

## [0.6.1] - 2024-02-04
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.javiersc.hubdle.project.extensions._internal

import org.gradle.api.NamedDomainObjectSet
import org.gradle.api.Project
import org.gradle.kotlin.dsl.findByType
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
Expand All @@ -17,8 +18,8 @@ internal val Project.kotlinSourceSetCommonMain: KotlinSourceSet?
it.name == "commonMain"
}

internal val Project.kotlinSourceSetMainOrCommonMain: KotlinSourceSet?
internal val Project.kotlinSourceSetMainOrCommonMain: NamedDomainObjectSet<KotlinSourceSet>?
get() =
extensions.findByType<KotlinProjectExtension>()?.sourceSets?.firstOrNull {
it.name == "main" || it.name == "commonMain"
extensions.findByType<KotlinProjectExtension>()?.sourceSets?.named { name ->
name == "main" || name == "commonMain"
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ constructor(
}

override fun Project.defaultConfiguration() {
configurable(priority = Priority.P1) {
configurable(priority = Priority.P4) {
GenerateProjectDataTask.register(project).configure { task ->
task.enabled = isFullEnabled.get()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,18 @@ constructor(

generateProjectDataTask.configure {
it.source(project.allKotlinSrcDirsWithoutBuild)
it.packageName.set(packageName)
it.projectDir.set(project.projectDir.absolutePath)
it.projectGroup.set(projectGroup)
it.projectName.set(projectName)
it.projectVersion.set(projectVersion)
it.rootDir.set(project.rootDir.absolutePath)
it.packageName.convention(packageName)
it.projectDir.convention(project.projectDir.absolutePath)
it.projectGroup.convention(projectGroup)
it.projectName.convention(projectName)
it.projectVersion.convention(projectVersion)
it.rootDir.convention(project.rootDir.absolutePath)
it.outputDir.convention(outputDir)
}
prepareKotlinIdeaImport.dependsOn(generateProjectDataTask)
project.kotlinSourceSetMainOrCommonMain?.kotlin?.srcDir(generateProjectDataTask)
project.kotlinSourceSetMainOrCommonMain?.configureEach { sourceSet ->
sourceSet.kotlin.srcDir(generateProjectDataTask)
}
return generateProjectDataTask
}
}
Expand Down

0 comments on commit d671c4c

Please sign in to comment.