Skip to content

Commit

Permalink
Resurrect embedded.gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
tianyu committed Jan 2, 2025
1 parent 056f4e6 commit 9c537a7
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ plugins {
id 'org.jetbrains.kotlin.jvm'
}

apply from: rootProject.file('gradle/utils/embedded.gradle')

gradlePlugin {
website = 'https://github.com/ShikaSD/kotlin-object-serialization-fix'
vcsUrl = 'https://github.com/ShikaSD/kotlin-object-serialization-fix.git'
Expand All @@ -24,5 +26,5 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation "org.jetbrains.kotlin:kotlin-gradle-plugin-api"

runtimeOnly(project(':kotlin-plugin'))
embedded project(':kotlin-plugin')
}
40 changes: 40 additions & 0 deletions gradle/utils/embedded.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
configurations {
embedded {
transitive = false
}
compileOnly.extendsFrom(embedded)
}

def embeddedProjects() {
return project.configurations.findByName('embedded')
.resolvedConfiguration
.resolvedArtifacts
.findAll { it.id.componentIdentifier instanceof ProjectComponentIdentifier }
.collect { project(it.id.componentIdentifier.projectPath) }
}

afterEvaluate {
dependencies {
embeddedProjects().collect { it.configurations.findByName("published") }
.forEach {
it.dependencies.forEach {
runtime "$it.group:$it.name:$it.version"
}
}
}

jar {
from project.configurations.embedded.collect {
zipTree(it)
}
}

tasks.getByName("sourcesJar") {
archiveClassifier = 'sources'
from embeddedProjects().collect { it.sourceSets.main.allSource }
}

artifacts {
archives sourcesJar
}
}

0 comments on commit 9c537a7

Please sign in to comment.