@@ -54,6 +54,13 @@ configurations.all {
5454 cacheChangingModulesFor(0 , TimeUnit .SECONDS )
5555 cacheDynamicVersionsFor(0 , TimeUnit .SECONDS )
5656 }
57+
58+ // We use kotlin exclusively for tests
59+ // The kotlin plugin adds kotlin-stdlib dependencies to the main sourceSet, even if it doesn't use any kotlin
60+ // To avoid shipping dependencies we don't actually need, exclude them from the main sourceSet classpath but add them _back_ in for the test source sets
61+ if (name == " compileClasspath" || name == " runtimeClasspath" ) {
62+ exclude(group = " org.jetbrains.kotlin" )
63+ }
5764}
5865
5966val mockito1Version = " 1.10.19"
@@ -81,12 +88,11 @@ dependencies {
8188
8289 " beforeImplementation" (" junit:junit:latest.release" )
8390 " beforeImplementation" (" org.mockito:mockito-all:$mockito1Version " )
91+ " beforeImplementation" (" org.assertj:assertj-core:3.18.1" )
8492 " afterImplementation" (" org.junit.jupiter:junit-jupiter-api:latest.release" )
8593 " afterImplementation" (" org.junit.jupiter:junit-jupiter-params:latest.release" )
8694 " afterImplementation" (" org.mockito:mockito-core:latest.release" )
8795 " afterRuntimeOnly" (" org.junit.jupiter:junit-jupiter-engine:latest.release" )
88-
89-
9096}
9197
9298tasks.withType(KotlinCompile ::class .java).configureEach {
@@ -137,7 +143,7 @@ configure<PublishingExtension> {
137143 while (i < length) {
138144 (dependencyList.item(i) as org.w3c.dom.Element ).let { dependency ->
139145 if ((dependency.getElementsByTagName(" scope" )
140- .item(0 ) as org.w3c.dom.Element ).textContent == " provided" ) {
146+ .item(0 ) as org.w3c.dom.Element ).textContent == " provided" ) {
141147 dependencies.removeChild(dependency)
142148 i--
143149 length--
@@ -161,9 +167,9 @@ project.withConvention(ArtifactoryPluginConvention::class) {
161167 setContextUrl(" https://oss.jfrog.org/artifactory" )
162168 publisherConfig.let {
163169 val repository: PublisherConfig .Repository = it.javaClass
164- .getDeclaredField(" repository" )
165- .apply { isAccessible = true }
166- .get(it) as PublisherConfig .Repository
170+ .getDeclaredField(" repository" )
171+ .apply { isAccessible = true }
172+ .get(it) as PublisherConfig .Repository
167173
168174 repository.setRepoKey(" oss-snapshot-local" )
169175 repository.setUsername(project.findProperty(" bintrayUser" ))
@@ -175,7 +181,7 @@ tasks.withType<GenerateMavenPom> {
175181 doLast {
176182 // because pom.withXml adds blank lines
177183 destination.writeText(
178- destination.readLines().filter { it.isNotBlank() }.joinToString(" \n " )
184+ destination.readLines().filter { it.isNotBlank() }.joinToString(" \n " )
179185 )
180186 }
181187
@@ -191,28 +197,28 @@ tasks.withType<GenerateMavenPom> {
191197 }
192198
193199 fun reduceDependenciesAtIndent (indent : Int ):
194- (List <String >, ResolvedDependency ) -> List <String > =
195- { dependenciesAsList: List <String >, dep: ResolvedDependency ->
196- dependenciesAsList + listOf (" " .repeat(indent) + dep.module.id.toString()) + (
197- if (observedDependencies.add(dep)) {
198- dep.children
199- .sortedBy(gav)
200- .fold(emptyList(), reduceDependenciesAtIndent(indent + 2 ))
201- } else {
202- // this dependency subtree has already been printed, so skip it
203- emptyList()
204- }
205- )
206- }
200+ (List <String >, ResolvedDependency ) -> List <String > =
201+ { dependenciesAsList: List <String >, dep: ResolvedDependency ->
202+ dependenciesAsList + listOf (" " .repeat(indent) + dep.module.id.toString()) + (
203+ if (observedDependencies.add(dep)) {
204+ dep.children
205+ .sortedBy(gav)
206+ .fold(emptyList(), reduceDependenciesAtIndent(indent + 2 ))
207+ } else {
208+ // this dependency subtree has already been printed, so skip it
209+ emptyList()
210+ }
211+ )
212+ }
207213
208214 project.plugins.withType<InfoBrokerPlugin > {
209215 add(" Resolved-Dependencies" , runtimeClasspath
210- .resolvedConfiguration
211- .lenientConfiguration
212- .firstLevelModuleDependencies
213- .sortedBy(gav)
214- .fold(emptyList(), reduceDependenciesAtIndent(6 ))
215- .joinToString(" \n " , " \n " , " \n " + " " .repeat(4 )))
216+ .resolvedConfiguration
217+ .lenientConfiguration
218+ .firstLevelModuleDependencies
219+ .sortedBy(gav)
220+ .fold(emptyList(), reduceDependenciesAtIndent(6 ))
221+ .joinToString(" \n " , " \n " , " \n " + " " .repeat(4 )))
216222 }
217223 }
218224}
0 commit comments