11import com.github.breadmoirai.githubreleaseplugin.GithubReleaseTask
22import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
33import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
4- import com.gradle.enterprise.gradleplugin.testretry.retry
54import org.gradle.api.tasks.testing.logging.TestExceptionFormat
65import org.gradle.api.tasks.testing.logging.TestLogEvent
76import org.jetbrains.kotlin.gradle.dsl.JvmTarget
@@ -63,61 +62,15 @@ configurations {
6362configurations[" compileOnly" ].extendsFrom(shadowImplementation)
6463configurations[" testImplementation" ].extendsFrom(shadowImplementation)
6564
66- sourceSets {
67- val adapter by creating {
68- }
69-
70- val adapter100 by creating {
71- compileClasspath + = adapter.output
72- }
73- val adapters = listOf (
74- adapter,
75- adapter100
76- )
77- val main by getting {
78- kotlin {
79- compileClasspath = adapters.map { it.output }.fold(compileClasspath) { a, b -> a + b }
80- runtimeClasspath = adapters.map { it.output }.fold(runtimeClasspath) { a, b -> a + b }
81- }
82- }
83-
84- val test by getting {
85- kotlin {
86- compileClasspath = adapters.map { it.output }.fold(compileClasspath) { a, b -> a + b }
87- runtimeClasspath = adapters.map { it.output }.fold(runtimeClasspath) { a, b -> a + b }
88- }
89- }
90- }
91-
92- val adapterSources = listOf (
93- sourceSets.named(" adapter" ),
94- sourceSets.named(" adapter100" )
95- )
96-
97- tasks.named<Jar >(" shadowJar" ).configure {
98- this .from(adapterSources.map { sourceSet -> sourceSet.map { it.output.classesDirs } })
99- manifest {
100- attributes(
101- " Implementation-Title" to project.name,
102- " Implementation-Version" to project.version,
103- " Implementation-Vendor" to project.group,
104- " Implementation-Vendor-Id" to project.group
105- )
106- }
107- }
108-
10965dependencies {
110- add(" adapterImplementation" , libs.commons.io)
111- add(" adapterImplementation" , libs.semver)
112-
113- add(" adapter100CompileOnly" , " com.pinterest.ktlint:ktlint-cli-reporter-core:1.0.0" )
114- add(" adapter100CompileOnly" , " com.pinterest.ktlint:ktlint-rule-engine:1.0.0" )
115- add(" adapter100CompileOnly" , " com.pinterest.ktlint:ktlint-ruleset-standard:1.0.0" )
116- add(" adapter100CompileOnly" , " com.pinterest.ktlint:ktlint-cli-reporter-baseline:1.0.0" )
117-
66+ compileOnly(" com.pinterest.ktlint:ktlint-cli-reporter-core:1.0.0" )
67+ compileOnly(" com.pinterest.ktlint:ktlint-rule-engine:1.0.0" )
68+ compileOnly(" com.pinterest.ktlint:ktlint-ruleset-standard:1.0.0" )
69+ compileOnly(" com.pinterest.ktlint:ktlint-cli-reporter-baseline:1.0.0" )
11870 compileOnly(libs.kotlin.gradle.plugin)
11971 compileOnly(libs.android.gradle.plugin)
12072 compileOnly(kotlin(" stdlib-jdk8" ))
73+
12174 shadowImplementation(libs.semver)
12275 shadowImplementation(libs.jgit)
12376 shadowImplementation(libs.commons.io)
@@ -131,18 +84,6 @@ dependencies {
13184 testImplementation(libs.archunit.junit5)
13285}
13386
134- kotlin {
135- // set up friend paths so that we can use internal classes across source sets
136- target.compilations.forEach {
137- if (it.name.startsWith(" adapter" )) {
138- if (it.name != " adapter" ) {
139- it.associateWith(target.compilations.getByName(" adapter" ))
140- }
141- target.compilations.getByName(" main" ).associateWith(it)
142- }
143- }
144- }
145-
14687tasks.withType<Test > {
14788 dependsOn(" publishToMavenLocal" )
14889 useJUnitPlatform()
@@ -162,7 +103,7 @@ tasks.withType<Test> {
162103 showStackTraces = true
163104 }
164105
165- retry {
106+ develocity.testRetry {
166107 val isCiServer = System .getenv().containsKey(" CI" )
167108 if (isCiServer) {
168109 maxRetries.set(2 )
@@ -179,6 +120,14 @@ tasks.withType<Test> {
179120
180121val relocateShadowJar = tasks.register<ConfigureShadowRelocation >(" relocateShadowJar" )
181122val shadowJarTask = tasks.named<ShadowJar >(" shadowJar" ) {
123+ manifest {
124+ attributes(
125+ " Implementation-Title" to project.name,
126+ " Implementation-Version" to project.version,
127+ " Implementation-Vendor" to project.group,
128+ " Implementation-Vendor-Id" to project.group
129+ )
130+ }
182131 // Enable package relocation in resulting shadow jar
183132 relocateShadowJar.get().apply {
184133 prefix = " $pluginGroup .shadow"
0 commit comments