spring 源码 https://spring.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
3.0 KiB

Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
12 years ago
import org.gradle.plugins.ide.eclipse.model.ProjectDependency
/**
* Will merge the distributions of the current project into mergeIntoProject. For
* example, to bundle spring-test-mvc in spring-test's jars. This script will perform the
* following steps:
* <ul>
* <li>Ensure that jar tasks of the project being merged from will execute the tasks of
* the project being merged into</li>
* <li>Add the project being merged into to the classpath of the project being merged
* from</li>
* <li>Update the pom.xml of the project being merged into to contain the entries from
* the project being merged from</li>
* </ul>
*
* Example Usage:
*
* ext.mergeIntoProject = project(':spring-test')
* apply from: "${rootProject.projectDir}/merge-dist.gradle"
*/
def mergeFromProject = project
// invoking a task on mergeFromProject will invoke the task with the same name on mergeIntoProject
def taskNamesToMerge = ['sourcesJar','jar','javadocJar','javadoc','install','artifactoryPublish']
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
12 years ago
taskNamesToMerge.each { taskName ->
def taskToRemove = mergeFromProject.tasks.findByPath(taskName)
if(taskToRemove) {
taskToRemove.enabled = false
taskToRemove.dependsOn mergeIntoProject."$taskName"
}
Add Spring MVC Test framework This commit adds the spring-test-mvc project [1] to the Spring Framework as part of the spring-test module. The sources are added as a root-level project called "spring-test-mvc" instead of under "spring-test" because the new sources need to be compiled with Servlet 3 while the current "spring-test" sources require Servlet 2.5 and the Eclipse IDE does not support having different classpaths for the same project. The Gradle build produces a single spring-test jar that contains sources from both "spring-test" and "spring-test-mvc". This merge is made possible through merge-dist.gradle as follows: - jar tasks of the "from" project execute tasks of the "to" project - "to" project is added to the classpath of the "from" project - "to" project pom is updated with entries from the "from" project For further details see documentation in merge-dist.gradle. Special thanks to everyone who contributed to the initial development of the Spring MVC Test framework: Arjen Poutsma <poutsma@mac.com> Craig Walls <cwalls@vmware.com> Frans Flippo <fransflippo@utopia.orange11.nl> Harry Lascelles <harry@firstbanco.com> Irfan <mail.urfi@gmail.com> Jörg Rathlev <joerg.rathlev@s24.com> Keesun Baik <whiteship2000@gmail.com> Keesun Baik <whiteship@epril.com> Matthew Reid <matthew.reid@nakedwines.com> Nils-Helge Garli Hegvik <Nils-Helge.Hegvik@telenor.com> Rob Winch <rwinch@vmware.com> Scott Frederick <sfrederick@vmware.com> Sven Filatov <sven.filatov@gmail.com> Thomas Bruyelle <thomas.bruyelle@gmail.com> youngm <youngm@gmail.com> [1]: https://github.com/SpringSource/spring-test-mvc Issue: SPR-9859, SPR-7951
12 years ago
}
// update mergeIntoProject artifacts to contain the mergeFromProject artifact contents
mergeIntoProject."sourcesJar" {
from mergeFromProject.sourcesJar.source
}
mergeIntoProject."jar" {
from mergeFromProject.jar.source
}
mergeIntoProject."javadoc" {
source += mergeFromProject.javadoc.source
classpath += mergeFromProject.javadoc.classpath
}
// GRADLE-1116
mergeFromProject.eclipse.classpath.file.whenMerged { classpath ->
classpath.entries.removeAll { entry -> entry.path.contains("/${mergeIntoProject.name}/build/") }
def dependency = new ProjectDependency("/${mergeIntoProject.name}", mergeIntoProject.path)
dependency.exported = true
classpath.entries.add(dependency)
}
// Update mergeIntoProject to contain additional configurations that contains all the dependencies from mergeFromProject
// so that Maven pom generation works
gradle.taskGraph.whenReady {
mergeFromProject.configurations.archives.artifacts.clear()
mergeFromProject.configurations.each { config->
def mapping = mergeFromProject.conf2ScopeMappings.getMapping([config])
if(mapping.scope) {
def newConfigName = mergeFromProject.name + "-"+ config.name
mergeIntoProject.configurations.add(newConfigName)
config.dependencies.each { dependency ->
mergeIntoProject.dependencies.add(newConfigName, dependency)
}
configure(mergeIntoProject.install.repositories.mavenInstaller.pom.scopeMappings) {
addMapping(mapping.priority + 100, mergeIntoProject.configurations."$newConfigName", mapping.scope)
}
mergeIntoProject.optionalDeps += mergeFromProject.optionalDeps
mergeIntoProject.providedDeps += mergeFromProject.providedDeps
}
}
}