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

build: made indexing all published modules cleaner #24

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
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ class PublishPlugin : Plugin<Project> {
configurations.add(block)
}

val isEnabled get() = enabled && (evenWithChildren || project.childProjects.isEmpty())
val isPublished get() = enabled && (evenWithChildren || project.childProjects.isEmpty())
}

override fun apply(target: Project) {
target.extensions.add(Extension::class.java, "publish", Extension(target))
target.afterEvaluate {
target.extensions.getByType(Extension::class.java).let { extension ->
if (!extension.isEnabled) return@afterEvaluate
if (!extension.isPublished) return@afterEvaluate
log.debug("Enabling Maven Publications for project {}", target.name)
target.mavenPublish {
extension.configurations.forEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@ fun Project.mavenPublish(block: MavenPublication.() -> Unit) {
}
}
}

val Project.publishedProjects get() = rootProject.allprojects.filter {
it != project && it.plugins.hasPlugin(PublishPlugin::class.java) &&
it.extensions.getByType(PublishPlugin.Extension::class.java).isPublished
}

val Project.notation get() = "$group:$name:$version"
11 changes: 3 additions & 8 deletions telenor-boot-dependencies/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import io.tnboot.gradle.build.DependencyGroups
import io.tnboot.gradle.build.PublishPlugin
import io.tnboot.gradle.build.mavenPublish
import io.tnboot.gradle.build.notation
import io.tnboot.gradle.build.publishedProjects

plugins {
`java-platform`
Expand All @@ -16,13 +17,7 @@ val bom = DependencyGroups(
dependencies {
constraints {
bom.dependencies.forEach { add("api", it) }

rootProject.allprojects.filter {
it != project && it.plugins.hasPlugin(PublishPlugin::class.java) &&
it.extensions.getByType(PublishPlugin.Extension::class.java).isEnabled
}.forEach {
add("api", it)
}
publishedProjects.forEach { add("api", it.notation) }
}
}

Expand Down