Browse Source

Fix spring-core jar task 'up-to-date'-ness

See gh-23729
pull/23921/head
François Guillot 5 years ago committed by Stephane Nicoll
parent
commit
2411b657ae
  1. 11
      spring-core/kotlin-coroutines/kotlin-coroutines.gradle
  2. 66
      spring-core/spring-core.gradle

11
spring-core/kotlin-coroutines/kotlin-coroutines.gradle

@ -2,6 +2,17 @@ description = "Spring Core Coroutines support"
apply plugin: "kotlin" apply plugin: "kotlin"
configurations {
classesOnlyElements {
canBeConsumed = true
canBeResolved = false
}
}
artifacts {
classesOnlyElements(compileKotlin.destinationDir)
}
dependencies { dependencies {
compile("org.jetbrains.kotlin:kotlin-reflect") compile("org.jetbrains.kotlin:kotlin-reflect")
compile("org.jetbrains.kotlin:kotlin-stdlib") compile("org.jetbrains.kotlin:kotlin-stdlib")

66
spring-core/spring-core.gradle

@ -1,3 +1,9 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id "com.github.johnrengelman.shadow" version "5.1.0"
}
description = "Spring Core" description = "Spring Core"
apply plugin: "kotlin" apply plugin: "kotlin"
@ -9,62 +15,30 @@ def cglibVersion = "3.3.0"
def objenesisVersion = "3.1" def objenesisVersion = "3.1"
configurations { configurations {
jarjar
cglib cglib
objenesis objenesis
coroutines { coroutines
transitive = false
}
} }
task cglibRepackJar(type: Jar) { repackJar -> task cglibRepackJar(type: ShadowJar) {
repackJar.baseName = "spring-cglib-repack" baseName = 'spring-cglib-repack'
repackJar.version = cglibVersion version = cglibVersion
configurations = [project.configurations.cglib]
doLast() { relocate 'net.sf.cglib', 'org.springframework.cglib'
project.ant { relocate 'org.objectweb.asm', 'org.springframework.asm'
taskdef name: "jarjar", classname: "org.pantsbuild.jarjar.JarJarTask",
classpath: configurations.jarjar.asPath
jarjar(destfile: repackJar.archivePath) {
configurations.cglib.each { originalJar ->
zipfileset(src: originalJar)
}
// Repackage net.sf.cglib => org.springframework.cglib
rule(pattern: "net.sf.cglib.**", result: "org.springframework.cglib.@1")
// As mentioned above, transform cglib's internal asm dependencies from
// org.objectweb.asm => org.springframework.asm. Doing this counts on the
// the fact that Spring and cglib depend on the same version of asm!
rule(pattern: "org.objectweb.asm.**", result: "org.springframework.asm.@1")
}
}
}
} }
task objenesisRepackJar(type: Jar) { repackJar -> task objenesisRepackJar(type: ShadowJar) {
repackJar.baseName = "spring-objenesis-repack" baseName = 'spring-objenesis-repack'
repackJar.version = objenesisVersion version = objenesisVersion
configurations = [project.configurations.objenesis]
doLast() { relocate 'org.objenesis', 'org.springframework.objenesis'
project.ant {
taskdef name: "jarjar", classname: "org.pantsbuild.jarjar.JarJarTask",
classpath: configurations.jarjar.asPath
jarjar(destfile: repackJar.archivePath) {
configurations.objenesis.each { originalJar ->
zipfileset(src: originalJar)
}
// Repackage org.objenesis => org.springframework.objenesis
rule(pattern: "org.objenesis.**", result: "org.springframework.objenesis.@1")
}
}
}
} }
dependencies { dependencies {
cglib("cglib:cglib:${cglibVersion}@jar") cglib("cglib:cglib:${cglibVersion}@jar")
objenesis("org.objenesis:objenesis:${objenesisVersion}@jar") objenesis("org.objenesis:objenesis:${objenesisVersion}@jar")
jarjar("org.pantsbuild:jarjar:1.7.2") coroutines(project(path: ":kotlin-coroutines", configuration: 'classesOnlyElements'))
coroutines(project(":kotlin-coroutines"))
compile(files(cglibRepackJar)) compile(files(cglibRepackJar))
compile(files(objenesisRepackJar)) compile(files(objenesisRepackJar))
compile(project(":spring-jcl")) compile(project(":spring-jcl"))
@ -107,5 +81,5 @@ jar {
include "org/springframework/objenesis/**" include "org/springframework/objenesis/**"
} }
from { configurations.coroutines.collect { it.isDirectory() ? it : zipTree(it) } } from configurations.coroutines
} }

Loading…
Cancel
Save