Add Gradle task for building zip with dependencies
Some Spring Framework users and teams cannot use transitive dependency management tools like Maven, Gradle and Ivy. For them, a `distZip` task has been added to allow for creating a Spring Framework distribution from source that includes all optional and required runtime dependencies for all modules of the framework. This 'dist-with-deps' zip is not published to the SpringSource repository nor to the SpringSource community download page. It is strictly an optional task introduced as a convenience to the users mentioned above. Detailed instructions for building this zip locally have been added to the wiki and the README has been updated with a link to that new doc. Issue: SPR-6575
This commit is contained in:
		
							parent
							
								
									726655af50
								
							
						
					
					
						commit
						e5bbec7e2b
					
				| 
						 | 
				
			
			@ -15,9 +15,9 @@ The framework also serves as the foundation for
 | 
			
		|||
[Python](https://github.com/SpringSource/spring-python) variants are available as well.
 | 
			
		||||
 | 
			
		||||
## Downloading artifacts
 | 
			
		||||
Instructions on
 | 
			
		||||
[downloading Spring artifacts](https://github.com/SpringSource/spring-framework/wiki/Downloading-Spring-artifacts)
 | 
			
		||||
via Maven and other build systems are available via the project wiki.
 | 
			
		||||
See [downloading Spring artifacts](https://github.com/SpringSource/spring-framework/wiki/Downloading-Spring-artifacts)
 | 
			
		||||
for Maven repository information. Unable to use Maven or other transitive dependency management tools?
 | 
			
		||||
See [building a distribution with dependencies](https://github.com/SpringSource/spring-framework/wiki/Building-a-distribution-with-dependencies).
 | 
			
		||||
 | 
			
		||||
## Documentation
 | 
			
		||||
See the current [Javadoc](http://static.springsource.org/spring-framework/docs/current/api)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										32
									
								
								build.gradle
								
								
								
								
							
							
						
						
									
										32
									
								
								build.gradle
								
								
								
								
							| 
						 | 
				
			
			@ -640,7 +640,7 @@ configure(rootProject) {
 | 
			
		|||
        description = "Builds -${classifier} archive, containing all jars and docs, " +
 | 
			
		||||
                      "suitable for community download page."
 | 
			
		||||
 | 
			
		||||
        def baseDir = "${project.name}-${project.version}";
 | 
			
		||||
        ext.baseDir = "${project.name}-${project.version}";
 | 
			
		||||
 | 
			
		||||
        from('src/dist') {
 | 
			
		||||
            include 'readme.txt'
 | 
			
		||||
| 
						 | 
				
			
			@ -671,6 +671,36 @@ configure(rootProject) {
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Create an distribution that contains all dependencies (required and optional).
 | 
			
		||||
    // Not published by default; only for use when building from source.
 | 
			
		||||
    task depsZip(type: Zip, dependsOn: distZip) { zipTask ->
 | 
			
		||||
        group = 'Distribution'
 | 
			
		||||
        classifier = 'dist-with-deps'
 | 
			
		||||
        description = "Builds -${classifier} archive, containing everything " +
 | 
			
		||||
            "in the -${distZip.classifier} archive plus all runtime dependencies."
 | 
			
		||||
 | 
			
		||||
        from zipTree(distZip.archivePath)
 | 
			
		||||
 | 
			
		||||
        gradle.taskGraph.whenReady { taskGraph ->
 | 
			
		||||
            if (taskGraph.hasTask(":${zipTask.name}")) {
 | 
			
		||||
                def projectNames = rootProject.subprojects*.name
 | 
			
		||||
                def artifacts = new HashSet()
 | 
			
		||||
                subprojects.each { subproject ->
 | 
			
		||||
                    subproject.configurations.runtime.resolvedConfiguration.resolvedArtifacts.each { artifact ->
 | 
			
		||||
                        def dependency = artifact.moduleVersion.id
 | 
			
		||||
                        if (!projectNames.contains(dependency.name)) {
 | 
			
		||||
                            artifacts << artifact.file
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                zipTask.from(artifacts) {
 | 
			
		||||
                    into "${distZip.baseDir}/deps"
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    artifacts {
 | 
			
		||||
        archives docsZip
 | 
			
		||||
        archives schemaZip
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue