From 366f0d7892ec0be0e7294a6bc001e65f3067cc0f Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Mon, 16 Jan 2012 14:23:31 +0100 Subject: [PATCH] Generate -sources and -javadoc jars Each spring-* subproject now has sourcesJar and javadocJar tasks - Ignore subproject overview.html files for now (not all have one) - Ensure @author attribution occurs - Javadoc 'header' is project description spring-asm is a special case - source jar is created, but empty (to comply with entry rules for Maven Central) - add package-info.java explaining the nature of spring-asm this is nice, because it shows up in the public API docs now. - add SpringAsmInfo in the org.springframework.asm package as a placeholder allowing the generation of javadocs (see link to bug) - add explicit 'repackageAsm' Gradle task allowing for easy testing and merging of jar containing bundlor manifest as well as jar containing repackaged ASM classes. --- build.gradle | 57 +++++++++++++++++-- org.springframework.asm/build.gradle | 22 ------- .../springframework/asm/SpringAsmInfo.java | 31 ++++++++++ .../org/springframework/asm/package-info.java | 11 ++++ .../src/main/java/overview.html | 4 +- .../src/main/java/overview.html | 4 +- .../src/main/java/overview.html | 4 +- .../src/main/java/overview.html | 4 +- src/api/overview.html | 8 ++- 9 files changed, 108 insertions(+), 37 deletions(-) delete mode 100644 org.springframework.asm/build.gradle create mode 100644 org.springframework.asm/src/main/java/org/springframework/asm/SpringAsmInfo.java create mode 100644 org.springframework.asm/src/main/java/org/springframework/asm/package-info.java diff --git a/build.gradle b/build.gradle index eb19b31b84a..fd4f66bce77 100644 --- a/build.gradle +++ b/build.gradle @@ -53,21 +53,70 @@ configure(subprojects) { expand(copyright: new Date().format('yyyy'), version: project.version) } } -} -configure(subprojects - project(":spring-asm")) { + javadoc { + options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED + options.author = true + options.header = project.name + //options.overview = "${projectDir}/src/main/java/overview.html" + } task sourcesJar(type: Jar, dependsOn:classes) { classifier = 'sources' - from sourceSets.main.allSource + from sourceSets.main.allJava + } + + task javadocJar(type: Jar) { + classifier = 'javadoc' + from javadoc } artifacts { archives sourcesJar + archives javadocJar } } +project("spring-asm") { + description = 'Spring ASM' + asmVersion = '2.2.3' + + configurations { + asm + jarjar + } + dependencies { + asm "asm:asm:${asmVersion}@jar", "asm:asm-commons:${asmVersion}@jar" + jarjar 'com.googlecode.jarjar:jarjar:1.1' + } + + task repackageAsm(type: Jar) { jar -> + jar.baseName = "asm-repack" + jar.version = asmVersion + + doLast() { + project.ant { + taskdef name: "jarjar", classname: "com.tonicsystems.jarjar.JarJarTask", + classpath: configurations.jarjar.asPath + jarjar(destfile: archivePath, index: "true", filesetmanifest: "merge") { + configurations.asm.each { jarfile -> + zipfileset(src: jarfile) + } + rule(pattern: 'org.objectweb.asm.**', result: 'org.springframework.asm.@1') + } + } + } + } + + jar { + dependsOn repackageAsm + from(zipTree(repackageAsm.archivePath)) { + exclude 'META-INF/INDEX.LIST' + } + } +} + project('spring-core') { description = 'Spring Core' dependencies { @@ -374,8 +423,8 @@ project('spring-struts') { project('spring-aspects') { description = 'Spring Aspects' apply from: 'aspectJ.gradle' - compileJava.dependsOn project(":spring-orm").jar dependencies { + compile project(":spring-orm") aspects project(":spring-orm") ajc "org.aspectj:aspectjtools:1.6.8" compile "org.aspectj:aspectjrt:1.6.8" diff --git a/org.springframework.asm/build.gradle b/org.springframework.asm/build.gradle deleted file mode 100644 index 5a2170a64d2..00000000000 --- a/org.springframework.asm/build.gradle +++ /dev/null @@ -1,22 +0,0 @@ -description = 'Spring ASM' - -configurations { jarjar } -dependencies { jarjar 'com.googlecode.jarjar:jarjar:1.1' } -configurations { asm } -dependencies { asm 'asm:asm:2.2.3@jar', 'asm:asm-commons:2.2.3@jar' } - -jar << { - project.ant { - taskdef name: "jarjar", classname: "com.tonicsystems.jarjar.JarJarTask", classpath: configurations.jarjar.asPath - jarjar(destfile: archivePath, index: "true", filesetmanifest: "merge") { - configurations.asm.each { jarfile -> - zipfileset(src: jarfile) - } - rule(pattern: 'org.objectweb.asm.**', result: 'org.springframework.asm.@1') - } - } -} - -// TODO: integrate bundlor in jarjar routine -// TODO: create source jar -// TODO: review overall jarjar approach with Gradle team diff --git a/org.springframework.asm/src/main/java/org/springframework/asm/SpringAsmInfo.java b/org.springframework.asm/src/main/java/org/springframework/asm/SpringAsmInfo.java new file mode 100644 index 00000000000..115efb39897 --- /dev/null +++ b/org.springframework.asm/src/main/java/org/springframework/asm/SpringAsmInfo.java @@ -0,0 +1,31 @@ +/* + * Copyright 2002-2012 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.asm; + +/** + * Placeholder to allow Javadoc generation. Required because + * this bug + * does not allow the generation of Javadoc for packages having only a + * {@code package-info.java} file. + *

See package-level Javadoc for more + * information on {@code org.springframework.asm}. + * + * @author Chris Beams + * @since 3.2 + */ +public final class SpringAsmInfo { +} diff --git a/org.springframework.asm/src/main/java/org/springframework/asm/package-info.java b/org.springframework.asm/src/main/java/org/springframework/asm/package-info.java new file mode 100644 index 00000000000..80d6dc4a113 --- /dev/null +++ b/org.springframework.asm/src/main/java/org/springframework/asm/package-info.java @@ -0,0 +1,11 @@ +/** + * Spring's repackaging of {@code org.objectweb.asm.*} (for internal use only). + *

This repackaging technique avoids any potential conflicts with + * dependencies on ASM at the application level or from other third-party + * libraries and frameworks. + *

As this repackaging happens at the classfile level, sources and Javadoc + * are not available here. See the original ObjectWeb + * ASM 2.2.3 Javadoc + * for details when working with these classes. + */ +package org.springframework.asm; diff --git a/org.springframework.aspects/src/main/java/overview.html b/org.springframework.aspects/src/main/java/overview.html index 4edae8742ee..2dd5b092240 100644 --- a/org.springframework.aspects/src/main/java/overview.html +++ b/org.springframework.aspects/src/main/java/overview.html @@ -1,7 +1,7 @@

-The Spring Data Binding framework, an internal library used by Spring Web Flow. +Spring's AspectJ-based aspects.

- \ No newline at end of file + diff --git a/org.springframework.instrument.tomcat/src/main/java/overview.html b/org.springframework.instrument.tomcat/src/main/java/overview.html index 4edae8742ee..74446835682 100644 --- a/org.springframework.instrument.tomcat/src/main/java/overview.html +++ b/org.springframework.instrument.tomcat/src/main/java/overview.html @@ -1,7 +1,7 @@

-The Spring Data Binding framework, an internal library used by Spring Web Flow. +Spring's instrumentation agent for Tomcat.

- \ No newline at end of file + diff --git a/org.springframework.test/src/main/java/overview.html b/org.springframework.test/src/main/java/overview.html index 88946a7332c..96bde48963d 100644 --- a/org.springframework.test/src/main/java/overview.html +++ b/org.springframework.test/src/main/java/overview.html @@ -1,7 +1,7 @@

-Spring's test context framework. Also includes common Servlet and Portlet API mocks. +Spring's TestContext framework. Also includes common Servlet and Portlet API mocks.

- \ No newline at end of file + diff --git a/org.springframework.web.servlet/src/main/java/overview.html b/org.springframework.web.servlet/src/main/java/overview.html index 1d338776b41..e39ffe659a2 100644 --- a/org.springframework.web.servlet/src/main/java/overview.html +++ b/org.springframework.web.servlet/src/main/java/overview.html @@ -1,7 +1,7 @@

-Spring's MVC framework in its Servlet API version. Includes support for common view technologies. +Spring's MVC framework in its Servlet API version. Includes support for common view technologies.

- \ No newline at end of file + diff --git a/src/api/overview.html b/src/api/overview.html index 41c4086d0dd..2ca88cfaf34 100644 --- a/src/api/overview.html +++ b/src/api/overview.html @@ -1,5 +1,7 @@ - - This is the public API documentation for the Spring Framework. - + +

+This is the public API documentation for the Spring Framework. +

+