Skip to content

Commit

Permalink
wip - fix uberjar and pom generation
Browse files Browse the repository at this point in the history
  • Loading branch information
alancai98 committed Apr 23, 2024
1 parent 9283b82 commit 2866017
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ abstract class PublishPlugin : Plugin<Project> {
project.extensions.configure<ShadowExtension> {
component(this@create)
}
// from(components["java"])
// artifact(tasks["shadowJar"])
artifactId = ext.artifactId
pom {
packaging = "jar"
Expand Down
11 changes: 9 additions & 2 deletions partiql-lang/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies {
api(Deps.ionElement)
api(Deps.ionJava)
api(Deps.ionSchema)
implementation(Deps.antlrRuntime)
shadow(Deps.antlrRuntime)
implementation(Deps.csv)
implementation(Deps.kotlinReflect)
implementation(Deps.kotlinxCoroutines)
Expand Down Expand Up @@ -69,12 +69,19 @@ val relocations = mapOf(
)

tasks.shadowJar {
archiveClassifier.set("shaded")
configurations = listOf(project.configurations.shadow.get())
for ((from, to) in relocations) {
relocate(from, to)
}
}

// Workaround for https://github.com/johnrengelman/shadow/issues/651
components.withType(AdhocComponentWithVariants::class.java).forEach { c ->
c.withVariantsFromConfiguration(project.configurations.shadowRuntimeElements.get()) {
skip()
}
}

publish {
artifactId = "partiql-lang-kotlin"
name = "PartiQL Lang Kotlin"
Expand Down
10 changes: 9 additions & 1 deletion partiql-parser/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies {
api(project(":partiql-ast"))
api(project(":partiql-types"))
implementation(Deps.ionElement)
implementation(Deps.antlrRuntime)
shadow(Deps.antlrRuntime)
}

val relocations = mapOf(
Expand All @@ -32,12 +32,20 @@ val relocations = mapOf(

tasks.shadowJar {
dependsOn(tasks.named("generateGrammarSource"))
configurations = listOf(project.configurations.shadow.get())
archiveClassifier.set("shaded")
for ((from, to) in relocations) {
relocate(from, to)
}
}

// Workaround for https://github.com/johnrengelman/shadow/issues/651
components.withType(AdhocComponentWithVariants::class.java).forEach { c ->
c.withVariantsFromConfiguration(project.configurations.shadowRuntimeElements.get()) {
skip()
}
}

tasks.generateGrammarSource {
val antlrPackage = "org.partiql.parser.antlr"
val antlrSources = "$buildDir/generated-src/${antlrPackage.replace('.', '/')}"
Expand Down

0 comments on commit 2866017

Please sign in to comment.