Skip to content

Commit

Permalink
Fix published dependencies (#37)
Browse files Browse the repository at this point in the history
Co-authored-by: Matyrobbrt <[email protected]>
  • Loading branch information
lukebemish and Matyrobbrt authored Aug 13, 2024
1 parent 5c322ce commit 660050a
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ java {
}

configurations {
shadow
shadow.extendsFrom(implementation)
include
include.extendsFrom(implementation)
}

dependencies {
implementation project(":api")
implementation "info.picocli:picocli:$picocli_version"
implementation 'org.slf4j:slf4j-simple:2.0.13'

shadow project(":parchment")
shadow project(":accesstransformers")
shadow project(':interfaceinjection')
include project(":parchment")
include project(":accesstransformers")
include project(':interfaceinjection')

testImplementation platform("org.junit:junit-bom:$junit_version")
testImplementation 'org.junit.jupiter:junit-jupiter'
Expand All @@ -45,7 +45,7 @@ test {
}

shadowJar {
configurations = [project.configurations.shadow]
configurations = [project.configurations.include]
mergeServiceFiles()
}

Expand All @@ -58,6 +58,24 @@ components.java.withVariantsFromConfiguration(configurations.shadowRuntimeElemen
skip()
}

abstract class ComponentMaker {
@Inject
abstract SoftwareComponentFactory getFactory()
}

final componentFactory = objects.newInstance(ComponentMaker).factory

final shadowComponent = componentFactory.adhoc("shadow")
project.components.add(shadowComponent)

tasks.named('shadowJar', Jar) {
archiveClassifier = ''
archiveBaseName ='jst-cli-bundle'
}

shadowComponent.addVariantsFromConfiguration(configurations.shadowRuntimeElements) {
it.mapToMavenScope("runtime")
}
tasks.register('sourcesBundleJar', Jar) {
it.archiveClassifier = 'sources'
it.archiveBaseName = 'jst-cli-bundle'
Expand Down Expand Up @@ -86,7 +104,7 @@ publishing {
create('bundle', MavenPublication) {
artifactId = 'jst-cli-bundle'

project.shadow.component(bundle)
from components.shadow
artifact(tasks.sourcesBundleJar)
artifact(tasks.javadocBundleJar)

Expand Down

0 comments on commit 660050a

Please sign in to comment.