From 22ac024abb3680b298bef78052f5a13239513b29 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Fri, 29 May 2020 00:17:35 +0200 Subject: [trivial] typos in javadoc --- src/core/lombok/Singular.java | 2 +- src/core/lombok/experimental/WithBy.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/lombok/Singular.java b/src/core/lombok/Singular.java index 2ceaad58..08b53973 100644 --- a/src/core/lombok/Singular.java +++ b/src/core/lombok/Singular.java @@ -36,6 +36,6 @@ public @interface Singular { /** @return The singular name of this field. If it's a normal english plural, lombok will figure it out automatically. Otherwise, this parameter is mandatory. */ String value() default ""; - /** @return If true, the plural variant (which takes a collection and adds each element inside) will treat {@code null} as an empty collection, i.e. do nothing. If {@code false) (the default), it is null checked as if annotated with {@code @lombok.NonNull}. */ + /** @return If true, the plural variant (which takes a collection and adds each element inside) will treat {@code null} as an empty collection, i.e. do nothing. If {@code false} (the default), it is null checked as if annotated with {@code @lombok.NonNull}. */ boolean ignoreNullCollections() default false; } diff --git a/src/core/lombok/experimental/WithBy.java b/src/core/lombok/experimental/WithBy.java index 10155b91..6b16a5e6 100644 --- a/src/core/lombok/experimental/WithBy.java +++ b/src/core/lombok/experimental/WithBy.java @@ -76,7 +76,7 @@ import lombok.AccessLevel; * but with {@code @WithBy}, you'd write: * *
- *     movie = movie.withDirectorBy(d -> d.withBirthDateBy(bd -> bd.plusDays(1)));
+ *     movie = movie.withDirectorBy(d -> d.withBirthDateBy(bd -> bd.plusDays(1)));
  * 
*/ @Target({ElementType.FIELD, ElementType.TYPE}) -- cgit From 0bbedd092a1f0f506d106943b4b400c7986c5f36 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Fri, 29 May 2020 00:17:20 +0200 Subject: [build] rewriting the build system --- build.xml | 1158 +------------------- buildScripts/build-support.ant.xml | 113 ++ buildScripts/compile.ant.xml | 309 ++++++ buildScripts/create-eclipse-project.ant.xml | 182 +++ buildScripts/create-intellij-project.ant.xml | 59 + buildScripts/eclipse-debug-target.template | 35 - buildScripts/eclipse-p2.ant.xml | 43 +- buildScripts/eclipse-run-tests.template | 30 - buildScripts/info.ant.xml | 306 ++++++ ...t.java.openjdk.custom-javac11-11_2018-09-25.xml | 13 + ...t.java.openjdk.custom-javac13-13_2019-09-17.xml | 12 + ...ava.openjdk.custom-javac14-14-ea_2020-03-17.xml | 12 + .../net.java.openjdk.custom-javac8-1.8.0.xml | 12 + .../org.eclipse.custom-core.jobs-3.5.200.xml | 14 - .../org.eclipse.custom-core.jobs-3.5.300.xml | 14 - .../org.eclipse.custom-core.resources-3.7.0.xml | 14 - .../org.eclipse.custom-core.resources-3.8.100.xml | 14 - .../org.eclipse.custom-core.runtime-3.6.0.xml | 14 - .../org.eclipse.custom-core.runtime-3.9.0.xml | 14 - .../ivy-repo/org.eclipse.custom-ecj-3.6.2.xml | 14 - .../ivy-repo/org.eclipse.custom-ecj-4.3.1.xml | 14 - .../ivy-repo/org.eclipse.custom-ecj-I20140430.xml | 14 - .../org.eclipse.custom-equinox.common-3.6.0.xml | 14 - .../org.eclipse.custom-equinox.common-3.6.200.xml | 14 - .../ivy-repo/org.eclipse.custom-jdt.core-3.6.0.xml | 14 - .../ivy-repo/org.eclipse.custom-jdt.core-3.9.1.xml | 14 - .../ivy-repo/org.eclipse.custom-jdt.ui-3.6.0.xml | 14 - .../ivy-repo/org.eclipse.custom-jdt.ui-3.9.1.xml | 14 - .../ivy-repo/org.eclipse.custom-osgi-3.6.0.xml | 14 - .../ivy-repo/org.eclipse.custom-osgi-3.9.0.xml | 14 - buildScripts/ivy.xml | 139 ++- buildScripts/ivysettings.xml | 1 + buildScripts/mapstruct-old.ant.xml | 169 +++ buildScripts/maven.ant.xml | 126 +++ buildScripts/setup.ant.xml | 175 +++ buildScripts/tests.ant.xml | 177 +++ buildScripts/vm-finder.ant.xml | 191 ++++ buildScripts/website.ant.xml | 360 +++--- .../javac/apt/Javac9BaseFileObjectWrapper.java | 111 -- src/core/lombok/javac/apt/LombokFileObjects.java | 154 +-- src/core/lombok/javac/apt/LombokProcessor.java | 26 +- .../javac/apt/Javac9BaseFileObjectWrapper.java | 111 ++ src/core8/lombok/javac/apt/Javac9Compiler.java | 157 +++ src/stubs/java/lang/annotation/ElementType.java | 118 ++ src/stubsstubs/java/nio/file/Path.java | 4 + src/support/info.txt | 4 + src/support/log4j.properties | 6 + .../eclipseCreate/CreateEclipseDebugTarget.java | 177 +++ src/support/lombok/website/CompileChangelog.java | 147 +++ src/support/lombok/website/Domain.java | 26 + .../lombok/website/FetchCurrentVersion.java | 36 + src/support/lombok/website/WebsiteMaker.java | 430 ++++++++ src/utils/lombok/core/SpiLoadUtil.java | 4 +- src/website/log4j.properties | 6 - src/website/lombok/website/CompileChangelog.java | 147 --- .../lombok/website/FetchCurrentVersion.java | 37 - src/website/lombok/website/WebsiteMaker.java | 403 ------- ssh.knownHosts | 2 +- test/core/src/lombok/DirectoryRunner.java | 12 +- test/core/src/lombok/RunAllTests.java | 31 - test/core/src/lombok/RunTestsViaDelombok.java | 4 + test/core/src/lombok/RunTestsViaEcj.java | 20 +- test/core/src/lombok/TestBase.java | 31 + test/core/src/lombok/TestEclipse.java | 31 + test/core/src/lombok/TestJavac.java | 32 + .../src/lombok/transform/RunTransformTests.java | 31 - website/templates/all-versions.html | 4 +- 67 files changed, 3552 insertions(+), 2610 deletions(-) create mode 100644 buildScripts/build-support.ant.xml create mode 100644 buildScripts/compile.ant.xml create mode 100644 buildScripts/create-eclipse-project.ant.xml create mode 100644 buildScripts/create-intellij-project.ant.xml delete mode 100644 buildScripts/eclipse-debug-target.template delete mode 100644 buildScripts/eclipse-run-tests.template create mode 100644 buildScripts/info.ant.xml create mode 100644 buildScripts/ivy-repo/net.java.openjdk.custom-javac11-11_2018-09-25.xml create mode 100644 buildScripts/ivy-repo/net.java.openjdk.custom-javac13-13_2019-09-17.xml create mode 100644 buildScripts/ivy-repo/net.java.openjdk.custom-javac14-14-ea_2020-03-17.xml create mode 100644 buildScripts/ivy-repo/net.java.openjdk.custom-javac8-1.8.0.xml delete mode 100644 buildScripts/ivy-repo/org.eclipse.custom-core.jobs-3.5.200.xml delete mode 100644 buildScripts/ivy-repo/org.eclipse.custom-core.jobs-3.5.300.xml delete mode 100644 buildScripts/ivy-repo/org.eclipse.custom-core.resources-3.7.0.xml delete mode 100644 buildScripts/ivy-repo/org.eclipse.custom-core.resources-3.8.100.xml delete mode 100644 buildScripts/ivy-repo/org.eclipse.custom-core.runtime-3.6.0.xml delete mode 100644 buildScripts/ivy-repo/org.eclipse.custom-core.runtime-3.9.0.xml delete mode 100644 buildScripts/ivy-repo/org.eclipse.custom-ecj-3.6.2.xml delete mode 100644 buildScripts/ivy-repo/org.eclipse.custom-ecj-4.3.1.xml delete mode 100644 buildScripts/ivy-repo/org.eclipse.custom-ecj-I20140430.xml delete mode 100644 buildScripts/ivy-repo/org.eclipse.custom-equinox.common-3.6.0.xml delete mode 100644 buildScripts/ivy-repo/org.eclipse.custom-equinox.common-3.6.200.xml delete mode 100644 buildScripts/ivy-repo/org.eclipse.custom-jdt.core-3.6.0.xml delete mode 100644 buildScripts/ivy-repo/org.eclipse.custom-jdt.core-3.9.1.xml delete mode 100644 buildScripts/ivy-repo/org.eclipse.custom-jdt.ui-3.6.0.xml delete mode 100644 buildScripts/ivy-repo/org.eclipse.custom-jdt.ui-3.9.1.xml delete mode 100644 buildScripts/ivy-repo/org.eclipse.custom-osgi-3.6.0.xml delete mode 100644 buildScripts/ivy-repo/org.eclipse.custom-osgi-3.9.0.xml create mode 100644 buildScripts/mapstruct-old.ant.xml create mode 100644 buildScripts/maven.ant.xml create mode 100644 buildScripts/setup.ant.xml create mode 100644 buildScripts/tests.ant.xml create mode 100644 buildScripts/vm-finder.ant.xml delete mode 100644 src/core/lombok/javac/apt/Javac9BaseFileObjectWrapper.java create mode 100644 src/core8/lombok/javac/apt/Javac9BaseFileObjectWrapper.java create mode 100644 src/core8/lombok/javac/apt/Javac9Compiler.java create mode 100644 src/stubs/java/lang/annotation/ElementType.java create mode 100644 src/stubsstubs/java/nio/file/Path.java create mode 100644 src/support/info.txt create mode 100644 src/support/log4j.properties create mode 100644 src/support/lombok/eclipseCreate/CreateEclipseDebugTarget.java create mode 100644 src/support/lombok/website/CompileChangelog.java create mode 100644 src/support/lombok/website/Domain.java create mode 100644 src/support/lombok/website/FetchCurrentVersion.java create mode 100644 src/support/lombok/website/WebsiteMaker.java delete mode 100644 src/website/log4j.properties delete mode 100644 src/website/lombok/website/CompileChangelog.java delete mode 100644 src/website/lombok/website/FetchCurrentVersion.java delete mode 100644 src/website/lombok/website/WebsiteMaker.java delete mode 100644 test/core/src/lombok/RunAllTests.java create mode 100644 test/core/src/lombok/TestBase.java create mode 100644 test/core/src/lombok/TestEclipse.java create mode 100644 test/core/src/lombok/TestJavac.java delete mode 100644 test/transform/src/lombok/transform/RunTransformTests.java diff --git a/build.xml b/build.xml index f50d68f6..59e258d4 100644 --- a/build.xml +++ b/build.xml @@ -19,1155 +19,21 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --> - + This buildfile is part of projectlombok.org. It is the main entry point that contains the common tasks and can be called on to run the main aspects of all the sub-scripts. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A new version of ivyplusplus was required and has been downloaded. Rerun the script to continue. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Lombok version: ${lombok.version} (${lombok.fullversion}) - - - - - - - - - - - - - To compile lombok, you need JDK9 or higher; lombok requires this version because it's rather difficult to produce lombok builds that are compatible on JDK9 without at least building with JDK9. Sorry about that. - - - - -For compiling with Java9 'modulepath' an Ant version 1.9.7+ or 1.10.0+ is required. -Your current version is: - ${ant.version} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - lombok.launch.AnnotationProcessorHider$AnnotationProcessor -lombok.launch.AnnotationProcessorHider$ClaimingProcessor - - lombok.launch.AnnotationProcessorHider$AnnotationProcessor,isolating -lombok.launch.AnnotationProcessorHider$ClaimingProcessor,isolating - - - - - - - - - - - - - - - - ${releaseTimestamp} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ** WARNING ** The core lombok contributors all use eclipse to develop lombok. We have some ability on letting you work on lombok via intellij, but whether the generated project can be used in a modern intellij is currently unknown. Please do continue, but be aware that trying to work on lombok from intellij may run into problems. If you want to adopt 'work on lombok via intellij' as a task, we're open to it! - Press return to continue - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To add your eclipse installation's own plugins as dependencies, the build script needs to know where your eclipse is installed. Please enter this now (it's saved for future executions of this task). For example: - - /Applications/eclipse - C:\Program Files\eclipse - - - - Eclipse can't be found in this location; I expect that directory to contain a subdirectory called 'plugins'. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - You do not have the eclipse plugin '${pluginName}'. I expected it to be in your eclipse plugins directory (followed by an underscore and a version number). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Added to project classpath from your eclipse installation: ${pluginName}. -${sourceWarning} - - - - - - - - - - - - - - - - - - - - - - - - - - Testing ECJ using ECJ: ${ecj.loc} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - WARNING: If you wish to test JDK8 features in eclipse, there must be a JDK8 installation configured in your eclipse, and it must be called 'JavaSE-1.8'. - - - - - - - - - - - - - - Tests will now run against OpenJDK6 - - - - - - - - - - - - - - - Tests will now run against OpenJDK7 - - - - - - - - - - - - - - - Tests will now run against Oracle JDK7 - - - - - - - - - - - - - - - - Tests will now run against Oracle JDK8 - - - - - ERROR: No test environment set up. - -You need to set up a test environment, which consists of a version of javac, and a JRE runtime classpath ('rt.jar'). -Eventually, this environment concept will be extended to also include an ecj and/or eclipse to test against. - -You can let this ant script set them up for you: - -* ant setupJavaOpenJDK6TestEnvironment -* ant setupJavaOpenJDK7TestEnvironment -* ant setupJavaOracle7TestEnvironment -* ant setupJavaOracle8TestEnvironment - -These will set up test environments based on OpenJDK6 and OpenJDK7, and download all required files automatically. This will be a relatively large download. You can switch by running this command again; the downloads are cached so switching is fast. - -You can also create your own by writing a 'testenvironment.properties' file. The relevant properties are: - -* test.location.javac = /path/to/javac6.jar -* test.location.ecj = /path/to/ecj6.jar -* test.location.bootclasspath = /path/to/rt.jar -* test.location.name = RandomUsefulNameToIdentifyThisSetup -* test.javaversion = 6 - - - - - - - - - - - - - - - - - - - - - - - - Running test suite in JDK9+ mode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Running test suite in JDK6-8 mode - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lombok - ]]>v${lombok.version}
- Copyright © 2011-${javadoc.year} The Project Lombok Authors, licensed under the MIT licence.]]> -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The artifact has been published to staging. Now go to https://oss.sonatype.org/ and log in as Reinier, then doublecheck if all is well and 'release' it. - - - - - - - - - WARNING: You should now immediately run an edge release! - - - - - - - - - - - - - - - - - - - Aborted. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.projectlombok.testAp.TestAp - - - - - - - - - - - - - - - - Running in order: First Lombok, Then testAP - - - - - - - - - - - - Running in order: First TestAP, Then Lombok - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - lombok.mapstruct.NotifierHider$AstModificationNotifier - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + +
diff --git a/buildScripts/build-support.ant.xml b/buildScripts/build-support.ant.xml new file mode 100644 index 00000000..107f5f47 --- /dev/null +++ b/buildScripts/build-support.ant.xml @@ -0,0 +1,113 @@ + + + +This buildfile is part of projectlombok.org. It is responsible for tasks that help with setting up the build infrastructure. +None of these tasks are normally needed, unless modifying how the build works, such as updating dependencies. + + + + + + + + + + + + You need to specify the JDK9+ jdk whose jdk.compiler and java.compiler modules are to be converted. Use -Dtarget.jdk.ver=14 to automate this, or type a version in now (for example: 11): + + + + Aborted (no version entered) + + + + + Using VM at: ${target.jdk} + + + + You need to specify the JDK9+ jdk whose jdk.compiler and java.compiler modules are to be converted. Run ant with -Dtarget.jdk=/full/path/here to automate this, or type the path in now (for example: /Library/JavaVirtualMachines/jdk-14.jdk/Contents/Home): + + + + + + + + + + This tool converts javac as stored in jmods of JDK distributions; JDK8 and below doesn't ship like that, and you don't need this for 8 and below. + + + + ${target.javac.version.full} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <ivy-module version="2.0"> + <info organisation="net.java.openjdk.custom" module="javac${target.javac.shortversion}" revision="${target.javac.version}" publication="${target.javac.pubstamp}"> + <license name="GNU General Public License v2 with Classpath Exception" url="https://openjdk.java.net/legal/gplv2+ce.html" /> + <description homepage="https://openjdk.java.net" /> + </info> + <configurations> + <conf name="runtime" /> + </configurations> + <publications> + <artifact name="javac${target.javac.shortversion}-java.compiler" conf="runtime" url="https://projectlombok.org/ivyrepo/langtools/javac${target.javac.version}-java.compiler.jar" /> + <artifact name="javac${target.javac.shortversion}-jdk.compiler" conf="runtime" url="https://projectlombok.org/ivyrepo/langtools/javac${target.javac.version}-jdk.compiler.jar" /> + </publications> +</ivy-module> + File build/javac${target.javac.version}-java.compiler.jar and build/javac${target.javac.version}-jdk.compiler.jar are available for upload; custom ivy target made as GAV net.java.openjdk.custom::javac${target.javac.shortversion}::${target.javac.version} + + diff --git a/buildScripts/compile.ant.xml b/buildScripts/compile.ant.xml new file mode 100644 index 00000000..a68d6dc1 --- /dev/null +++ b/buildScripts/compile.ant.xml @@ -0,0 +1,309 @@ + + + +This buildfile is part of projectlombok.org. It takes care of compiling and building lombok itself. + + + + + + + + + + + + + + + + + + + Lombok version: ${lombok.version} (${lombok.fullversion}) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + lombok.launch.AnnotationProcessorHider$AnnotationProcessor +lombok.launch.AnnotationProcessorHider$ClaimingProcessor + + lombok.launch.AnnotationProcessorHider$AnnotationProcessor,isolating +lombok.launch.AnnotationProcessorHider$ClaimingProcessor,isolating + + + + + + + + + + + + + + + + + + + + + + + ${release.timestamp} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/buildScripts/create-eclipse-project.ant.xml b/buildScripts/create-eclipse-project.ant.xml new file mode 100644 index 00000000..93eed3b0 --- /dev/null +++ b/buildScripts/create-eclipse-project.ant.xml @@ -0,0 +1,182 @@ + + + +This buildfile is part of projectlombok.org. It creates the infrastructure needed to develop lombok on eclipse. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/buildScripts/create-intellij-project.ant.xml b/buildScripts/create-intellij-project.ant.xml new file mode 100644 index 00000000..abb8c589 --- /dev/null +++ b/buildScripts/create-intellij-project.ant.xml @@ -0,0 +1,59 @@ + + + +This buildfile is part of projectlombok.org. It creates the infrastructure needed to develop lombok on intellij. + + + + ** WARNING ** The core lombok contributors all use eclipse to develop lombok. This script will attempt to set up your lombok directory up as intellij project; whether can be used in a modern intellij is currently unknown. Please do continue, but be aware that trying to work on lombok from intellij may run into problems. If you want to adopt 'work on lombok via intellij' as a task, we're open to it! + NOT IMPLEMENTED: The project should optimally be configured as a java1.6, using the rt.jar in lib/openjdk6_rt.jar as boot basis, to ensure lombok remains 1.6 compatible. + NOT IMPLEMENTED: Ability to run tests targeted at a specific jvm/javac/ecj/eclipse release; the relevant entrypoint test classes are lombok.RunBaseAndJavacTests and lombok.RunEclipseTests - you can run the eclipse tests even on intellij; an eclipse installation is not required. + Press return to continue + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/buildScripts/eclipse-debug-target.template b/buildScripts/eclipse-debug-target.template deleted file mode 100644 index 78e01575..00000000 --- a/buildScripts/eclipse-debug-target.template +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/buildScripts/eclipse-p2.ant.xml b/buildScripts/eclipse-p2.ant.xml index db33b674..75f6c4eb 100644 --- a/buildScripts/eclipse-p2.ant.xml +++ b/buildScripts/eclipse-p2.ant.xml @@ -19,25 +19,23 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --> - + This buildfile is part of projectlombok.org. It is responsible for building the eclipse P2 update site. - - - + - - - - + + + public class Epoch {public static void main(String[] args) {System.out.print(System.currentTimeMillis());}} + + - - + @@ -111,10 +109,25 @@ This buildfile is part of projectlombok.org. It is responsible for building the - - - public class Epoch {public static void main(String[] args) {System.out.print(System.currentTimeMillis());}} - - + + + + + + + + + diff --git a/buildScripts/eclipse-run-tests.template b/buildScripts/eclipse-run-tests.template deleted file mode 100644 index 0c00c236..00000000 --- a/buildScripts/eclipse-run-tests.template +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/buildScripts/info.ant.xml b/buildScripts/info.ant.xml new file mode 100644 index 00000000..55fea8af --- /dev/null +++ b/buildScripts/info.ant.xml @@ -0,0 +1,306 @@ + + + + +Dear contributor, + +For full instructions and information on what this project contains, run: + + > ant help + +If you want to get started quickly: + +1. Run `ant eclipse`. +2. Start up eclipse (https://www.eclipse.org/). +3. In the menu: File > Import... > Existing Project Into Workspace +4. Browse to this directory and import it: + (${basedir}) +5. In eclipse: Run > Debug configurations... > + then pick one of the configs named `Lombok test`. +6. Run `ant dist`. + +Have fun! + + + + +Just want to get started quickly? Run: + + > ant quickstart + +--- + +Lombok is specced to run on a wide array of underlying platforms: + +* Any JVM from 1.6 up to the upcoming next official release. +* Javac, from 1.6 up to the upcoming next official release. +* ECJ, from ecj 4.4.2 (2015/java8) up to the upcoming next official release. +* Eclipse, from eclipse-oxygen up to the upcoming next official release. + +The build is a little more complicated to cater to these requirements. + +This build script can perform the following tasks: +* IDE + Create project files so that you can work on lombok in eclipse or intellij. + Includes creating debuggable test targets. +* compile + Turn java files into class files. +* test + Run the tests against the various combinations of VM, Javac, eclipse and ecj + we support, including finding suitable VMs to run them on. +* packaging + Create the lombok 'everything' jar, that can serve as eclipse agent, as + installer, as library you include on the classpath with javac, and which + does not inject its transitive dependencies into your project namespace. +* website + Builds the website and documentation (projectlombok.org) from templates, + including creating the version history page and changelog, and deploying + builds to the website (and the maven repo hosted there). +* p2 + We host an experimental eclipse marketplace installer. + +For more info on any of these sections, run for example `ant help.IDE`. + +If you're new to lombok, you should start with `ant help.IDE`, +then move on to `ant help.test`. + + + + +We strongly suggest you use eclipse to develop lombok. +Experimentally, developing with intellij is possible as well. + +IDE support consists of two features: +1. Generate project files so that this directory can be imported as project. +2. Generate debug/run launch files so you can debug lombok in your IDE. + + > ant eclipse + > ant intellij + +These commands generate project files and download all dependencies required +to develop Project Lombok in the named IDE. Run these commands first, then +import this directory as project in your IDE. + + > ant eclipse.testtarget.eclipse + > ant eclipse.testtarget.ecj + > ant eclipse.testtarget.javac + +These 3 commands generate launch targets (these appear in your debug menu), +for testing the stated platform (eclipse, ecj, or javac) and will ask you +which version of the VM and the relevant platform are to be targeted by +these tests. Note that `ant eclipse` already generates default test targets, +you don't need these unless you're specifically testing lombok behaviour on +some specific version of the JVM or a target platform. + +NB: No debug/launch targets are currently generated for intellij. +Got the know how? We'd love a contribution! + + + + +The build compilation system is self contained and generally invoked by the +other jobs this build script can do; you rarely need to mess with it. + +The compilation is quite complicated; parts of lombok are injected into +for example eclipse at runtime via an agent mechanism. To produce the bytecode +that is to be injected, we need to compile against various different versions +of the core java libraries as well as eclipse/ecj. To make this process smooth +and fast, lombok has a 'stubs' concept: We have signature-only versions of +various classes of other libraries. We compile these first, then we compile +the rest of lombok with these stub classes on the classpath, and then we +package lombok without the stubs. + +Various bits of lombok are targeted at different versions, and therefore, +different parts of lombok are compiled with different `-release` targets. + + > ant compile + +Compiles lombok itself + + > ant compile.support + +Compiles code that isn't part of the lombok distribution, but which is used +for other jobs; For example, eclipse debug target generation, and fetching +the current lombok stable release version number on offer at +the projectlombok.org website involve java code. + + + + +Lombok is shipped as an 'everything' jar; it is a stand-alone java app, +with both a GUI and a command line interface, it's an agent, it's an +annotation processor, and it's a module. + +In addition, lombok is a compile-time only dependency, designed to be included +in every project a lombok user has. Therefore, we don't want any of the +lombok classes that you aren't meant to use directly to be visible, +showing up in auto-complete dialogs. Starting with JDK9, the module system's +'export' feature does a lot of this, but we also want to avoid contaminating +things on JDK8 and below. As a consequence, lombok uses a classloader system, +and most classes are included in the jar with a different name, not as +.class files, thus avoiding contaminating the namespace. + +The packaging targets take care of setting up the file rename as well as +registering all the various manifest and file entries needed so that lombok +can be an everything jar. + + > ant dist + +packages the lombok build into a single jar. + + > ant maven + > ant maven.publish + +'maven' packages the lombok build ready to upload to mavencentral (sonatype). +'maven.publish' also sends this via the lombok server to oss.sonatype.org. + + + + + + +Lombok tests need to be run against a targeted platform. + + > ant test.javacCurrent + > ant test.javac6 + > ant test.javac8 + > ant test.javac11 + > ant test.javac14 + +This runs the test suite that tests lombok on javac, as well as testing +the delombok feature. + +`javacCurrent` runs the tests on the JVM running this build: ${ant.java.version} + +`javac6` and `javac8` are run on the JVM running this build, by downloading +the complete java runtime classes from those versions, including javac, and +using module limits to exclude your VM's own javac. + +You _DO NOT_ need an installed JDK1.6 or JDK1.8 to run these. + +`javac11`, `javac14`, etc require that you have a JDK of that version +installed on your system. The build will automatically find such a JDK in most +cases; alternatively, the system will ask you to provide a path to them. +The tests are then run by invoking that VM to run them. + +You can force a particular VM by making a file named `jvm.locations`, and putting +in it, for example: + + j11 = /Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home + +Or just enter the path your VM installation when prompted, and the build will +automatically create this file for you to remember your choice. + + > ant test.eclipse-oxygen + > ant test.eclipse-202006 + +This runs the test suite that tests lombok on eclipse/ecj. + +The tests are run on your current VM (${ant.java.version}), fetching +the relevant bits of the chosen eclipse release to test against. + + > ant test + +Runs the 'default' targets for all supported platforms. This should catch +most problems. + + > ant test.broad + +Runs tests against a selection of versions designed to catch virtually all +problems. Doesn't quite test _every_ supported combination. + + > ant test.compile + +Compiles the test suite; generally invoked by the other test targets; +you don't need to explicitly invoke this yourself. + + + + +This build also builds the website, which is a static site generated via +freemarker templates. Parts of the site build also involve other custom +software, such as building the 'all available versions' page by checking +the available versions on the live website, compiling markdown +(as used by the changelog) into html, and generated color-coded syntax +in HTML for the example snippets. + + > ant changelog.build + +Turns the changelog at doc/changelog.markdown into +build/website/changelog.html. + + > ant website.build + > ant website.pack + > ant website.publish + +'build' Builds the website (by for example applying freemarker templates) into +build/website. +'pack' bzips this up, ready to ship to the server. +'publish' sends this to the server and runs a script to deploy. + + > ant latest-changes.build + +Makes a changelog variant that lists only the newest changes; it is included +in the distribution for convenience. + + > ant javadoc.build + > ant javadoc.pack + > ant javadoc.publish + +'build' Builds the javadoc into build/api. +'pack' bzips this up, ready to ship to the server. +'publish' sends this to the server and runs a script to deploy. + + > ant edge.pack + > ant edge.publish + +'pack' creates a bzip with all relevant files needed to deploy a new edge +release to the server: A fresh build of the lombok everything jar, plus the +maven repo update so that the edge release can be fetched as a maven dep, +and an update to the download-edge page listing the latest changes included +in the edge release. + +'publish' sends this to the server, runs a script server-side to deploy the +content, and updates a git tag on success. + + + + +This is still an experimental feature. + +We ship lombok as an eclipse plugin. The plugin isn't much of a plugin; the +install script of the plugin fulfills the same role as lombok's installer +(which is: add a line configuring lombok as an agent during eclipse bootup), +and the uninstall script removes it. + + > ant eclipsep2.build + > ant eclipsep2.pack + > ant eclipsep2.publish + +'build' generates the various files required to appear as an eclipse plugin, +and makes the jar(s). +'pack' makes a bzip ready to ship to a server. +'publish' ships it and runs a script server-side to put these files in the +right place; requires SSH access to the server. + + diff --git a/buildScripts/ivy-repo/net.java.openjdk.custom-javac11-11_2018-09-25.xml b/buildScripts/ivy-repo/net.java.openjdk.custom-javac11-11_2018-09-25.xml new file mode 100644 index 00000000..67b594da --- /dev/null +++ b/buildScripts/ivy-repo/net.java.openjdk.custom-javac11-11_2018-09-25.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/buildScripts/ivy-repo/net.java.openjdk.custom-javac13-13_2019-09-17.xml b/buildScripts/ivy-repo/net.java.openjdk.custom-javac13-13_2019-09-17.xml new file mode 100644 index 00000000..af861d7e --- /dev/null +++ b/buildScripts/ivy-repo/net.java.openjdk.custom-javac13-13_2019-09-17.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/buildScripts/ivy-repo/net.java.openjdk.custom-javac14-14-ea_2020-03-17.xml b/buildScripts/ivy-repo/net.java.openjdk.custom-javac14-14-ea_2020-03-17.xml new file mode 100644 index 00000000..175de028 --- /dev/null +++ b/buildScripts/ivy-repo/net.java.openjdk.custom-javac14-14-ea_2020-03-17.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/buildScripts/ivy-repo/net.java.openjdk.custom-javac8-1.8.0.xml b/buildScripts/ivy-repo/net.java.openjdk.custom-javac8-1.8.0.xml new file mode 100644 index 00000000..f02df135 --- /dev/null +++ b/buildScripts/ivy-repo/net.java.openjdk.custom-javac8-1.8.0.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/buildScripts/ivy-repo/org.eclipse.custom-core.jobs-3.5.200.xml b/buildScripts/ivy-repo/org.eclipse.custom-core.jobs-3.5.200.xml deleted file mode 100644 index 077f4f47..00000000 --- a/buildScripts/ivy-repo/org.eclipse.custom-core.jobs-3.5.200.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/buildScripts/ivy-repo/org.eclipse.custom-core.jobs-3.5.300.xml b/buildScripts/ivy-repo/org.eclipse.custom-core.jobs-3.5.300.xml deleted file mode 100644 index f4002ee8..00000000 --- a/buildScripts/ivy-repo/org.eclipse.custom-core.jobs-3.5.300.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/buildScripts/ivy-repo/org.eclipse.custom-core.resources-3.7.0.xml b/buildScripts/ivy-repo/org.eclipse.custom-core.resources-3.7.0.xml deleted file mode 100644 index b1ddf043..00000000 --- a/buildScripts/ivy-repo/org.eclipse.custom-core.resources-3.7.0.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/buildScripts/ivy-repo/org.eclipse.custom-core.resources-3.8.100.xml b/buildScripts/ivy-repo/org.eclipse.custom-core.resources-3.8.100.xml deleted file mode 100644 index eac7fe7b..00000000 --- a/buildScripts/ivy-repo/org.eclipse.custom-core.resources-3.8.100.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/buildScripts/ivy-repo/org.eclipse.custom-core.runtime-3.6.0.xml b/buildScripts/ivy-repo/org.eclipse.custom-core.runtime-3.6.0.xml deleted file mode 100644 index a5fe9784..00000000 --- a/buildScripts/ivy-repo/org.eclipse.custom-core.runtime-3.6.0.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/buildScripts/ivy-repo/org.eclipse.custom-core.runtime-3.9.0.xml b/buildScripts/ivy-repo/org.eclipse.custom-core.runtime-3.9.0.xml deleted file mode 100644 index 0e06d062..00000000 --- a/buildScripts/ivy-repo/org.eclipse.custom-core.runtime-3.9.0.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/buildScripts/ivy-repo/org.eclipse.custom-ecj-3.6.2.xml b/buildScripts/ivy-repo/org.eclipse.custom-ecj-3.6.2.xml deleted file mode 100644 index 7da4c2ce..00000000 --- a/buildScripts/ivy-repo/org.eclipse.custom-ecj-3.6.2.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/buildScripts/ivy-repo/org.eclipse.custom-ecj-4.3.1.xml b/buildScripts/ivy-repo/org.eclipse.custom-ecj-4.3.1.xml deleted file mode 100644 index 8d0a8f0c..00000000 --- a/buildScripts/ivy-repo/org.eclipse.custom-ecj-4.3.1.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/buildScripts/ivy-repo/org.eclipse.custom-ecj-I20140430.xml b/buildScripts/ivy-repo/org.eclipse.custom-ecj-I20140430.xml deleted file mode 100644 index 193f8a27..00000000 --- a/buildScripts/ivy-repo/org.eclipse.custom-ecj-I20140430.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/buildScripts/ivy-repo/org.eclipse.custom-equinox.common-3.6.0.xml b/buildScripts/ivy-repo/org.eclipse.custom-equinox.common-3.6.0.xml deleted file mode 100644 index 69d18ae4..00000000 --- a/buildScripts/ivy-repo/org.eclipse.custom-equinox.common-3.6.0.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/buildScripts/ivy-repo/org.eclipse.custom-equinox.common-3.6.200.xml b/buildScripts/ivy-repo/org.eclipse.custom-equinox.common-3.6.200.xml deleted file mode 100644 index d0a128ec..00000000 --- a/buildScripts/ivy-repo/org.eclipse.custom-equinox.common-3.6.200.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/buildScripts/ivy-repo/org.eclipse.custom-jdt.core-3.6.0.xml b/buildScripts/ivy-repo/org.eclipse.custom-jdt.core-3.6.0.xml deleted file mode 100644 index 2c46df18..00000000 --- a/buildScripts/ivy-repo/org.eclipse.custom-jdt.core-3.6.0.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/buildScripts/ivy-repo/org.eclipse.custom-jdt.core-3.9.1.xml b/buildScripts/ivy-repo/org.eclipse.custom-jdt.core-3.9.1.xml deleted file mode 100644 index 946aa65a..00000000 --- a/buildScripts/ivy-repo/org.eclipse.custom-jdt.core-3.9.1.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/buildScripts/ivy-repo/org.eclipse.custom-jdt.ui-3.6.0.xml b/buildScripts/ivy-repo/org.eclipse.custom-jdt.ui-3.6.0.xml deleted file mode 100644 index 6dcf54f0..00000000 --- a/buildScripts/ivy-repo/org.eclipse.custom-jdt.ui-3.6.0.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/buildScripts/ivy-repo/org.eclipse.custom-jdt.ui-3.9.1.xml b/buildScripts/ivy-repo/org.eclipse.custom-jdt.ui-3.9.1.xml deleted file mode 100644 index e57bad7a..00000000 --- a/buildScripts/ivy-repo/org.eclipse.custom-jdt.ui-3.9.1.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/buildScripts/ivy-repo/org.eclipse.custom-osgi-3.6.0.xml b/buildScripts/ivy-repo/org.eclipse.custom-osgi-3.6.0.xml deleted file mode 100644 index 7cca0e05..00000000 --- a/buildScripts/ivy-repo/org.eclipse.custom-osgi-3.6.0.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/buildScripts/ivy-repo/org.eclipse.custom-osgi-3.9.0.xml b/buildScripts/ivy-repo/org.eclipse.custom-osgi-3.9.0.xml deleted file mode 100644 index 83e009eb..00000000 --- a/buildScripts/ivy-repo/org.eclipse.custom-osgi-3.9.0.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/buildScripts/ivy.xml b/buildScripts/ivy.xml index 1d8fc26b..14530f06 100644 --- a/buildScripts/ivy.xml +++ b/buildScripts/ivy.xml @@ -1,64 +1,63 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + @@ -66,6 +65,40 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/buildScripts/ivysettings.xml b/buildScripts/ivysettings.xml index bafdc801..765dad02 100644 --- a/buildScripts/ivysettings.xml +++ b/buildScripts/ivysettings.xml @@ -4,6 +4,7 @@ + diff --git a/buildScripts/mapstruct-old.ant.xml b/buildScripts/mapstruct-old.ant.xml new file mode 100644 index 00000000..cf14dd93 --- /dev/null +++ b/buildScripts/mapstruct-old.ant.xml @@ -0,0 +1,169 @@ + + + +This buildfile is part of projectlombok.org. It contains leftover tasks from the previous version +of the build that are related to mapstruct. We will clean this up or remove it soon. + + + + + + + + + + + + org.projectlombok.testAp.TestAp + + + + + + + + + + + + + + + + Running in order: First Lombok, Then testAP + + + + + + + + + + + + Running in order: First TestAP, Then Lombok + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + lombok.mapstruct.NotifierHider$AstModificationNotifier + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/buildScripts/maven.ant.xml b/buildScripts/maven.ant.xml new file mode 100644 index 00000000..329eacec --- /dev/null +++ b/buildScripts/maven.ant.xml @@ -0,0 +1,126 @@ + + + +This buildfile is part of projectlombok.org. It makes maven-compatible repositories. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The artifact has been published to staging. Now go to https://oss.sonatype.org/ and log in as Reinier, then doublecheck if all is well and 'release' it. + + + + + + + + + + + + + + + + + + + + + + + + mvn is not on your path and/or MAVEN_HOME is not set. Add mvn to your path or set MAVEN_HOME to continue. + + + + + + diff --git a/buildScripts/setup.ant.xml b/buildScripts/setup.ant.xml new file mode 100644 index 00000000..c72517c8 --- /dev/null +++ b/buildScripts/setup.ant.xml @@ -0,0 +1,175 @@ + + + +This buildfile is part of projectlombok.org. It sets up the build itself. + + + + + + + + + + + + + + + + + Your ssh.configuration file is corrupted; delete it and rerun this script. + + + + + + + + + + + + + + + The keyfile configured in your ${ssh.configuration.file} file does not exist. + + + + + + + + + + + + + + + + Aborted + + File ${ssh.keyfile} does not exist + + + + + + + + Your connection info has been written to ${ssh.configuration.file} and will be remembered for future invocations. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A new version of ivyplusplus was required and has been downloaded. Rerun the script to continue. + + + + + + + + + + + To ensure stable builds and avoid accessing API that was not available in JDK6, most of lombok is set up to build against OpenJDK6's runtime, which will now be downloaded... + + + + + + To test java8, we need a java8 runtime, which will now be downloaded... + + + + + + + + Supply ant with -Ddeps.conf=confname to pick the configuration you want to fetch + + + + + + + + + + + + + + + + + + + + + + + + + + ant needs to be at least v1.10.0 or higher to build lombok. Your version is: ${ant.version} + + + + + lombok must be compiled on jdk11 or later. Your version is: ${ant.java.version} + + + + + diff --git a/buildScripts/tests.ant.xml b/buildScripts/tests.ant.xml new file mode 100644 index 00000000..67edf28a --- /dev/null +++ b/buildScripts/tests.ant.xml @@ -0,0 +1,177 @@ + + + +This buildfile is part of projectlombok.org. It takes care of compiling and running tests. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + run ecj11 with a test file to confirm agent injection works: OK + + + + --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED + --add-opens jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED + --add-opens jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED + --add-opens jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED + --add-opens jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED + --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED + --add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED + --add-opens jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED + + --limit-modules java.base,jdk.unsupported + + + + + + + + + + + Running TestJavac on JVM${ant.java.version}, with lowest supported javac: 1.6. + + + + + + + + + + + + + + + + Running TestJavac on JVM${ant.java.version}, with javac: 1.8. + + + + + + + + + + + + + + + + + + + Running TestJavac with JVM ${jvm.loc.@{version}}. + + + + + + + + + + + + + + + + + + + + + + + Running TestJavac on JVM${ant.java.version}, with the javac built into your VM distributon. + + + + + + + + + + + + + + + Running TestEclipse on eclipse-@{version} on JVM${ant.java.version}. + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/buildScripts/vm-finder.ant.xml b/buildScripts/vm-finder.ant.xml new file mode 100644 index 00000000..2b2c4c4c --- /dev/null +++ b/buildScripts/vm-finder.ant.xml @@ -0,0 +1,191 @@ + + + +This buildfile is part of projectlombok.org. It contains platform specific code to find installed JVMs. + + + + + + + + + + + + + + + + + + + + + + + + + + + . + +ERROR: You explicitly specified the home of JVM${find-vm.version} as: ${jvm.loc} in the ${jvm.locations.file} file. +However, ${jvm.loc}/bin/${exe.java} does not exist or is not executable. Please fix the entry in jvm.locations, or delete it +and rerun the build; this build is capable of finding VMs automatically on many platforms. + + + + + Set property find-vm.version first + + + + + + + + + + + + + Set property find-vm.version first + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Set property find-vm.version first + A JVM${find-vm.version} is required to run the request tests. + this script can automatically find VMs on mac and windows but did not find a suitable VM. + + + + + aborted + . + +ERROR: That does not appear to be a valid location; ${jvm.loc}/bin/${exe.java} should exist. + + + + + + + + + That does not appear to be a valid JVM${find-vm.version} - perhaps it isn't the right version? + + + + + + + + + + + Your choice of VM has been written to ${jvm.locations.file} and will be remembered for future invocations. + + + + + + + + + JVM ${find-vm.version} cannot be found + + + + + + + + + + + + + + + diff --git a/buildScripts/website.ant.xml b/buildScripts/website.ant.xml index b6212b37..15bca92d 100644 --- a/buildScripts/website.ant.xml +++ b/buildScripts/website.ant.xml @@ -1,5 +1,5 @@ + + - - + + + - + - - + + + - - Supply lombok.version - - - - Version: ${lombok.version} - Full: ${lombok.fullversion} - - - - Supply lombok.fullversion - - - - - - - - - - + + Live version: ${lombok.version.live} + Live full versionstring : ${lombok.fullversion.live} - + - - - + + + + - - - - - - - - - - + + + - + - + - - + + + @@ -144,71 +103,175 @@ such as applying the templates to produce the website, converting the changelog - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - + + + + - + - - + - + + + + + + + + + + + + Welcome to the lombok javadoc. If you're just looking to learn more about using lombok + You probably want to look at the feature documentation. Otherwise, + check the lombok package. If you're trying to extend lombok or + write your own plugins, the other packages are what you're looking for. + ]]> + + + + + + + + +
Lombok - ]]>v${lombok.version}
+ Copyright © 2009-${javadoc.year} The Project Lombok Authors, licensed under the MIT licence.]]> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + - - + + + File dist/javadoc.tar.bz2 is available - - - + - + - - + + + @@ -217,13 +280,42 @@ such as applying the templates to produce the website, converting the changelog - + + + + + + + + + + + + + + + + + + - - + + + @@ -239,27 +331,7 @@ such as applying the templates to produce the website, converting the changelog - - ssh.username and ssh.keyfile should be set. - - - - - - - - + + @@ -291,59 +364,4 @@ such as applying the templates to produce the website, converting the changelog - - - - - - - - Welcome to the lombok javadoc. If you're just looking to learn more about using lombok - You probably want to look at the feature documentation. Otherwise, - check the lombok package. If you're trying to extend lombok or - write your own plugins, the other packages are what you're looking for. - ]]> - - - - - - - - - -
Lombok - ]]>v${lombok.version}
- Copyright © 2009-${javadoc.year} The Project Lombok Authors, licensed under the MIT licence.]]> -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/core/lombok/javac/apt/Javac9BaseFileObjectWrapper.java b/src/core/lombok/javac/apt/Javac9BaseFileObjectWrapper.java deleted file mode 100644 index f71be366..00000000 --- a/src/core/lombok/javac/apt/Javac9BaseFileObjectWrapper.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2010-2018 The Project Lombok Authors. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package lombok.javac.apt; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Reader; -import java.io.Writer; -import java.net.URI; -import java.nio.file.Path; - -import javax.lang.model.element.Modifier; -import javax.lang.model.element.NestingKind; - -import com.sun.tools.javac.file.BaseFileManager; - -class Javac9BaseFileObjectWrapper extends com.sun.tools.javac.file.PathFileObject { - private final LombokFileObject delegate; - - public Javac9BaseFileObjectWrapper(BaseFileManager fileManager, Path path, LombokFileObject delegate) { - super(fileManager, path); - this.delegate = delegate; - } - - @Override public boolean isNameCompatible(String simpleName, Kind kind) { - return delegate.isNameCompatible(simpleName, kind); - } - - @Override public URI toUri() { - return delegate.toUri(); - } - - @SuppressWarnings("all") - @Override public String getName() { - return delegate.getName(); - } - - @Override public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { - return delegate.getCharContent(ignoreEncodingErrors); - } - - @Override public InputStream openInputStream() throws IOException { - return delegate.openInputStream(); - } - - @Override public Reader openReader(boolean ignoreEncodingErrors) throws IOException { - return delegate.openReader(ignoreEncodingErrors); - } - - @Override public Writer openWriter() throws IOException { - return delegate.openWriter(); - } - - @Override public OutputStream openOutputStream() throws IOException { - return delegate.openOutputStream(); - } - - @Override public long getLastModified() { - return delegate.getLastModified(); - } - - @Override public boolean delete() { - return delegate.delete(); - } - - @Override public Kind getKind() { - return delegate.getKind(); - } - - @Override public NestingKind getNestingKind() { - return delegate.getNestingKind(); - } - - @Override public Modifier getAccessLevel() { - return delegate.getAccessLevel(); - } - - @Override public boolean equals(Object obj) { - if (!(obj instanceof Javac9BaseFileObjectWrapper)) return false; - return delegate.equals(((Javac9BaseFileObjectWrapper)obj).delegate); - } - - @Override public int hashCode() { - return delegate.hashCode(); - } - - @Override public String toString() { - return delegate.toString(); - } -} \ No newline at end of file diff --git a/src/core/lombok/javac/apt/LombokFileObjects.java b/src/core/lombok/javac/apt/LombokFileObjects.java index f6643db3..880ef1fd 100644 --- a/src/core/lombok/javac/apt/LombokFileObjects.java +++ b/src/core/lombok/javac/apt/LombokFileObjects.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2019 The Project Lombok Authors. + * Copyright (C) 2010-2020 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -22,23 +22,15 @@ package lombok.javac.apt; -import java.io.IOException; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.net.URI; -import java.nio.file.Path; -import java.nio.file.Paths; import java.util.Arrays; -import java.util.Iterator; import java.util.List; -import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; -import javax.tools.FileObject; import javax.tools.JavaFileManager; import javax.tools.JavaFileObject; -import javax.tools.JavaFileObject.Kind; - -import com.sun.tools.javac.file.BaseFileManager; import lombok.core.DiagnosticsReceiver; import lombok.permit.Permit; @@ -116,22 +108,20 @@ final class LombokFileObjects { if (jfmClassName.equals("com.sun.tools.javac.file.JavacFileManager")) { try { Class superType = Class.forName("com.sun.tools.javac.file.BaseFileManager"); - if (superType.isInstance(jfm)) { - return new Java9Compiler(jfm); - } + if (superType.isInstance(jfm)) return java9Compiler(jfm); } catch (Throwable e) {} return Compiler.JAVAC7; } if (KNOWN_JAVA9_FILE_MANAGERS.contains(jfmClassName)) { try { - return new Java9Compiler(jfm); + return java9Compiler(jfm); } catch (Throwable e) {} } try { if (Class.forName("com.sun.tools.javac.file.PathFileObject") == null) throw new NullPointerException(); - return new Java9Compiler(jfm); + return java9Compiler(jfm); } catch (Throwable e) {} try { if (Class.forName("com.sun.tools.javac.file.BaseFileObject") == null) throw new NullPointerException(); @@ -156,122 +146,24 @@ final class LombokFileObjects { return compiler.wrap(new InterceptingJavaFileObject(delegate, fileName, diagnostics, compiler.getDecoderMethod())); } - static class Java9Compiler implements Compiler { - private final BaseFileManager fileManager; - - public Java9Compiler(JavaFileManager jfm) { - fileManager = asBaseFileManager(jfm); - } - - @Override public JavaFileObject wrap(LombokFileObject fileObject) { - Path p; try { - p = toPath(fileObject); - } catch (Exception e) { - p = null; - } - - // J9BFOW extends javac's internal file base impl of javax.tools.JavaFileObject. - // J9JFOW just straight implements it. Probably J9JFOW is fine, but we decided to extend java's internal impl possibly for a reason. - // Some exotic build environments don't _have_ file objects and crash with FileNotFoundEx, so if that happens, let's try the alternative. - if (p != null) return new Javac9BaseFileObjectWrapper(fileManager, p, fileObject); - return new Javac9JavaFileObjectWrapper(fileObject); - } - - @Override public Method getDecoderMethod() { + private static Constructor j9CompilerConstructor = null; + private static Compiler java9Compiler(JavaFileManager jfm) { + try { + if (j9CompilerConstructor == null) j9CompilerConstructor = Class.forName("lombok.javac.apt.Java9Compiler").getConstructor(JavaFileManager.class); + return (Compiler) j9CompilerConstructor.newInstance(jfm); + } catch (ClassNotFoundException e) { return null; - } - - private static Path toPath(LombokFileObject fileObject) { - URI uri = fileObject.toUri(); - if (uri.getScheme() == null) { - uri = URI.create("file:///" + uri); - } - try { - return Paths.get(uri); - } catch (IllegalArgumentException e) { - throw new IllegalArgumentException("Problems in URI '" + uri + "' (" + fileObject.toUri() + ")", e); - } - } - - private static BaseFileManager asBaseFileManager(JavaFileManager jfm) { - if (jfm instanceof BaseFileManager) { - return (BaseFileManager) jfm; - } - return new FileManagerWrapper(jfm); - } - - static class FileManagerWrapper extends BaseFileManager { - JavaFileManager manager; - - public FileManagerWrapper(JavaFileManager manager) { - super(null); - this.manager = manager; - } - - @Override - public int isSupportedOption(String option) { - return manager.isSupportedOption(option); - } - - @Override - public ClassLoader getClassLoader(Location location) { - return manager.getClassLoader(location); - } - - @Override - public Iterable list(Location location, String packageName, Set kinds, boolean recurse) throws IOException { - return manager.list(location, packageName, kinds, recurse); - } - - @Override - public String inferBinaryName(Location location, JavaFileObject file) { - return manager.inferBinaryName(location, file); - } - - @Override - public boolean isSameFile(FileObject a, FileObject b) { - return manager.isSameFile(a, b); - } - - @Override - public boolean handleOption(String current, Iterator remaining) { - return manager.handleOption(current, remaining); - } - - @Override - public boolean hasLocation(Location location) { - return manager.hasLocation(location); - } - - @Override - public JavaFileObject getJavaFileForInput(Location location, String className, Kind kind) throws IOException { - return manager.getJavaFileForInput(location, className, kind); - } - - @Override - public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling) throws IOException { - return manager.getJavaFileForOutput(location, className, kind, sibling); - } - - @Override - public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException { - return manager.getFileForInput(location, packageName, relativeName); - } - - @Override - public FileObject getFileForOutput(Location location, String packageName, String relativeName, FileObject sibling) throws IOException { - return manager.getFileForOutput(location, packageName, relativeName, sibling); - } - - @Override - public void flush() throws IOException { - manager.flush(); - } - - @Override - public void close() throws IOException { - manager.close(); - } + } catch (NoSuchMethodException e) { + return null; + } catch (InvocationTargetException e) { + Throwable t = e.getCause(); + if (t instanceof RuntimeException) throw (RuntimeException) t; + if (t instanceof Error) throw (Error) t; + throw new RuntimeException(t); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } catch (InstantiationException e) { + throw new RuntimeException(e); } } } diff --git a/src/core/lombok/javac/apt/LombokProcessor.java b/src/core/lombok/javac/apt/LombokProcessor.java index c32e09d5..852e5de6 100644 --- a/src/core/lombok/javac/apt/LombokProcessor.java +++ b/src/core/lombok/javac/apt/LombokProcessor.java @@ -24,6 +24,7 @@ package lombok.javac.apt; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; import java.util.ArrayList; @@ -42,7 +43,6 @@ import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; import javax.lang.model.SourceVersion; import javax.lang.model.element.Element; -import javax.lang.model.element.QualifiedNameable; import javax.lang.model.element.TypeElement; import javax.tools.Diagnostic.Kind; import javax.tools.JavaFileManager; @@ -371,7 +371,7 @@ public class LombokProcessor extends AbstractProcessor { private String getModuleNameFor(Element element) { while (element != null) { - if (element.getKind().name().equals("MODULE")) return ModuleNameOracle.getModuleName(element); + if (element.getKind().name().equals("MODULE")) return getModuleName(element); Element n = element.getEnclosingElement(); if (n == element) return null; element = n; @@ -379,12 +379,24 @@ public class LombokProcessor extends AbstractProcessor { return null; } - // QualifiedNameable is a java7 thing, so to remain compatible with java6, shove this into an inner class to avoid the ClassNotFoundError. - private static class ModuleNameOracle { - static String getModuleName(Element element) { - if (!(element instanceof QualifiedNameable)) return null; - String name = ((QualifiedNameable) element).getQualifiedName().toString().trim(); + private static Class qualifiedNamableClass = null; + private static Method qualifiedNamableQualifiedNameMethod = null; + // QualifiedNameable isn't in java 6, so to remain compatible with java6, use reflection. + private static String getModuleName(Element element) { + try { + if (qualifiedNamableClass == null) qualifiedNamableClass = Class.forName("javax.lang.model.element.QualifiedNamable"); + if (!qualifiedNamableClass.isInstance(element)) return null; + if (qualifiedNamableQualifiedNameMethod == null) qualifiedNamableQualifiedNameMethod = qualifiedNamableClass.getMethod("getQualifiedName"); + String name = qualifiedNamableQualifiedNameMethod.invoke(element).toString().trim(); return name.isEmpty() ? null : name; + } catch (ClassNotFoundException e) { + return null; + } catch (NoSuchMethodException e) { + return null; + } catch (InvocationTargetException e) { + return null; + } catch (IllegalAccessException e) { + return null; } } diff --git a/src/core8/lombok/javac/apt/Javac9BaseFileObjectWrapper.java b/src/core8/lombok/javac/apt/Javac9BaseFileObjectWrapper.java new file mode 100644 index 00000000..f71be366 --- /dev/null +++ b/src/core8/lombok/javac/apt/Javac9BaseFileObjectWrapper.java @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2010-2018 The Project Lombok Authors. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package lombok.javac.apt; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import java.net.URI; +import java.nio.file.Path; + +import javax.lang.model.element.Modifier; +import javax.lang.model.element.NestingKind; + +import com.sun.tools.javac.file.BaseFileManager; + +class Javac9BaseFileObjectWrapper extends com.sun.tools.javac.file.PathFileObject { + private final LombokFileObject delegate; + + public Javac9BaseFileObjectWrapper(BaseFileManager fileManager, Path path, LombokFileObject delegate) { + super(fileManager, path); + this.delegate = delegate; + } + + @Override public boolean isNameCompatible(String simpleName, Kind kind) { + return delegate.isNameCompatible(simpleName, kind); + } + + @Override public URI toUri() { + return delegate.toUri(); + } + + @SuppressWarnings("all") + @Override public String getName() { + return delegate.getName(); + } + + @Override public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { + return delegate.getCharContent(ignoreEncodingErrors); + } + + @Override public InputStream openInputStream() throws IOException { + return delegate.openInputStream(); + } + + @Override public Reader openReader(boolean ignoreEncodingErrors) throws IOException { + return delegate.openReader(ignoreEncodingErrors); + } + + @Override public Writer openWriter() throws IOException { + return delegate.openWriter(); + } + + @Override public OutputStream openOutputStream() throws IOException { + return delegate.openOutputStream(); + } + + @Override public long getLastModified() { + return delegate.getLastModified(); + } + + @Override public boolean delete() { + return delegate.delete(); + } + + @Override public Kind getKind() { + return delegate.getKind(); + } + + @Override public NestingKind getNestingKind() { + return delegate.getNestingKind(); + } + + @Override public Modifier getAccessLevel() { + return delegate.getAccessLevel(); + } + + @Override public boolean equals(Object obj) { + if (!(obj instanceof Javac9BaseFileObjectWrapper)) return false; + return delegate.equals(((Javac9BaseFileObjectWrapper)obj).delegate); + } + + @Override public int hashCode() { + return delegate.hashCode(); + } + + @Override public String toString() { + return delegate.toString(); + } +} \ No newline at end of file diff --git a/src/core8/lombok/javac/apt/Javac9Compiler.java b/src/core8/lombok/javac/apt/Javac9Compiler.java new file mode 100644 index 00000000..c02e5929 --- /dev/null +++ b/src/core8/lombok/javac/apt/Javac9Compiler.java @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2010-2020 The Project Lombok Authors. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package lombok.javac.apt; + +import java.io.IOException; +import java.lang.reflect.Method; +import java.net.URI; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Iterator; +import java.util.Set; + +import javax.tools.FileObject; +import javax.tools.JavaFileManager; +import javax.tools.JavaFileObject; +import javax.tools.JavaFileObject.Kind; + +import com.sun.tools.javac.file.BaseFileManager; + +class Java9Compiler implements lombok.javac.apt.LombokFileObjects.Compiler { + private final BaseFileManager fileManager; + + public Java9Compiler(JavaFileManager jfm) { + fileManager = asBaseFileManager(jfm); + } + + @Override public JavaFileObject wrap(LombokFileObject fileObject) { + Path p; try { + p = toPath(fileObject); + } catch (Exception e) { + p = null; + } + + // J9BFOW extends javac's internal file base impl of javax.tools.JavaFileObject. + // J9JFOW just straight implements it. Probably J9JFOW is fine, but we decided to extend java's internal impl possibly for a reason. + // Some exotic build environments don't _have_ file objects and crash with FileNotFoundEx, so if that happens, let's try the alternative. + if (p != null) return new Javac9BaseFileObjectWrapper(fileManager, p, fileObject); + return new Javac9JavaFileObjectWrapper(fileObject); + } + + @Override public Method getDecoderMethod() { + return null; + } + + private static Path toPath(LombokFileObject fileObject) { + URI uri = fileObject.toUri(); + if (uri.getScheme() == null) { + uri = URI.create("file:///" + uri); + } + try { + return Paths.get(uri); + } catch (IllegalArgumentException e) { + throw new IllegalArgumentException("Problems in URI '" + uri + "' (" + fileObject.toUri() + ")", e); + } + } + + private static BaseFileManager asBaseFileManager(JavaFileManager jfm) { + if (jfm instanceof BaseFileManager) { + return (BaseFileManager) jfm; + } + return new FileManagerWrapper(jfm); + } + + static class FileManagerWrapper extends BaseFileManager { + JavaFileManager manager; + + public FileManagerWrapper(JavaFileManager manager) { + super(null); + this.manager = manager; + } + + @Override + public int isSupportedOption(String option) { + return manager.isSupportedOption(option); + } + + @Override + public ClassLoader getClassLoader(Location location) { + return manager.getClassLoader(location); + } + + @Override + public Iterable list(Location location, String packageName, Set kinds, boolean recurse) throws IOException { + return manager.list(location, packageName, kinds, recurse); + } + + @Override + public String inferBinaryName(Location location, JavaFileObject file) { + return manager.inferBinaryName(location, file); + } + + @Override + public boolean isSameFile(FileObject a, FileObject b) { + return manager.isSameFile(a, b); + } + + @Override + public boolean handleOption(String current, Iterator remaining) { + return manager.handleOption(current, remaining); + } + + @Override + public boolean hasLocation(Location location) { + return manager.hasLocation(location); + } + + @Override + public JavaFileObject getJavaFileForInput(Location location, String className, Kind kind) throws IOException { + return manager.getJavaFileForInput(location, className, kind); + } + + @Override + public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling) throws IOException { + return manager.getJavaFileForOutput(location, className, kind, sibling); + } + + @Override + public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException { + return manager.getFileForInput(location, packageName, relativeName); + } + + @Override + public FileObject getFileForOutput(Location location, String packageName, String relativeName, FileObject sibling) throws IOException { + return manager.getFileForOutput(location, packageName, relativeName, sibling); + } + + @Override + public void flush() throws IOException { + manager.flush(); + } + + @Override + public void close() throws IOException { + manager.close(); + } + } +} diff --git a/src/stubs/java/lang/annotation/ElementType.java b/src/stubs/java/lang/annotation/ElementType.java new file mode 100644 index 00000000..bbab9cda --- /dev/null +++ b/src/stubs/java/lang/annotation/ElementType.java @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.lang.annotation; + +/** + * The constants of this enumerated type provide a simple classification of the + * syntactic locations where annotations may appear in a Java program. These + * constants are used in {@link java.lang.annotation.Target Target} + * meta-annotations to specify where it is legal to write annotations of a + * given type. + * + *

The syntactic locations where annotations may appear are split into + * declaration contexts , where annotations apply to declarations, and + * type contexts , where annotations apply to types used in + * declarations and expressions. + * + *

The constants {@link #ANNOTATION_TYPE}, {@link #CONSTRUCTOR}, {@link + * #FIELD}, {@link #LOCAL_VARIABLE}, {@link #METHOD}, {@link #PACKAGE}, {@link + * #MODULE}, {@link #PARAMETER}, {@link #TYPE}, and {@link #TYPE_PARAMETER} + * correspond to the declaration contexts in JLS 9.6.4.1. + * + *

For example, an annotation whose type is meta-annotated with + * {@code @Target(ElementType.FIELD)} may only be written as a modifier for a + * field declaration. + * + *

The constant {@link #TYPE_USE} corresponds to the type contexts in JLS + * 4.11, as well as to two declaration contexts: type declarations (including + * annotation type declarations) and type parameter declarations. + * + *

For example, an annotation whose type is meta-annotated with + * {@code @Target(ElementType.TYPE_USE)} may be written on the type of a field + * (or within the type of the field, if it is a nested, parameterized, or array + * type), and may also appear as a modifier for, say, a class declaration. + * + *

The {@code TYPE_USE} constant includes type declarations and type + * parameter declarations as a convenience for designers of type checkers which + * give semantics to annotation types. For example, if the annotation type + * {@code NonNull} is meta-annotated with + * {@code @Target(ElementType.TYPE_USE)}, then {@code @NonNull} + * {@code class C {...}} could be treated by a type checker as indicating that + * all variables of class {@code C} are non-null, while still allowing + * variables of other classes to be non-null or not non-null based on whether + * {@code @NonNull} appears at the variable's declaration. + * + * @author Joshua Bloch + * @since 1.5 + * @jls 9.6.4.1 @Target + * @jls 4.1 The Kinds of Types and Values + */ +public enum ElementType { + /** Class, interface (including annotation type), or enum declaration */ + TYPE, + + /** Field declaration (includes enum constants) */ + FIELD, + + /** Method declaration */ + METHOD, + + /** Formal parameter declaration */ + PARAMETER, + + /** Constructor declaration */ + CONSTRUCTOR, + + /** Local variable declaration */ + LOCAL_VARIABLE, + + /** Annotation type declaration */ + ANNOTATION_TYPE, + + /** Package declaration */ + PACKAGE, + + /** + * Type parameter declaration + * + * @since 1.8 + */ + TYPE_PARAMETER, + + /** + * Use of a type + * + * @since 1.8 + */ + TYPE_USE, + + /** + * Module declaration. + * + * @since 9 + */ + MODULE +} diff --git a/src/stubsstubs/java/nio/file/Path.java b/src/stubsstubs/java/nio/file/Path.java new file mode 100644 index 00000000..5fb2e7ec --- /dev/null +++ b/src/stubsstubs/java/nio/file/Path.java @@ -0,0 +1,4 @@ +package java.nio.file; + +public class Path { +} diff --git a/src/support/info.txt b/src/support/info.txt new file mode 100644 index 00000000..1723bffe --- /dev/null +++ b/src/support/info.txt @@ -0,0 +1,4 @@ +These classes are not part of lombok itself, but used during the build. For example: +* Code to turn the changelog into HTML ready to ship to projectlombok.org +* Code to create eclipse debug targets + diff --git a/src/support/log4j.properties b/src/support/log4j.properties new file mode 100644 index 00000000..9cafcc3b --- /dev/null +++ b/src/support/log4j.properties @@ -0,0 +1,6 @@ +log4j.rootLogger=INFO, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n diff --git a/src/support/lombok/eclipseCreate/CreateEclipseDebugTarget.java b/src/support/lombok/eclipseCreate/CreateEclipseDebugTarget.java new file mode 100644 index 00000000..d3b314cb --- /dev/null +++ b/src/support/lombok/eclipseCreate/CreateEclipseDebugTarget.java @@ -0,0 +1,177 @@ +package lombok.eclipseCreate; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.regex.Pattern; + +public class CreateEclipseDebugTarget { + private Map args; + private StringBuilder launchContent = new StringBuilder(); + + private static class InvalidCommandLineException extends Exception { + InvalidCommandLineException(String msg) { + super(msg); + + } + InvalidCommandLineException(String msg, Throwable cause) { + super(msg, cause); + } + } + + public static void main(String[] args) throws Exception { + CreateEclipseDebugTarget instance = new CreateEclipseDebugTarget(); + try { + instance.args = parseArgs(args); + if (instance.args.isEmpty()) throw new InvalidCommandLineException(""); + instance.go(); + } catch (InvalidCommandLineException e) { + String msg = e.getMessage(); + if (!msg.isEmpty()) System.err.println("ERROR: " + msg); + if (e.getCause() != null) { + e.getCause().printStackTrace(); + } + printCommandLineHelp(); + System.exit(1); + } catch (IOException e) { + e.printStackTrace(); + System.exit(1); + } + } + + private void go() throws InvalidCommandLineException, IOException { + prologue(); + classpath(); + epilogue(); + String n = getArgString("name"); + File f = new File(n + ".launch").getCanonicalFile(); + + OutputStream out = new FileOutputStream(f); + try { + out.write(launchContent.toString().getBytes("UTF-8")); + } finally { + out.close(); + } + + System.out.println("Debug target created: " + f); + } + + private void prologue() throws InvalidCommandLineException { + String type = getArgString("testType"); + + launchContent.append("\n"); + launchContent.append("\n"); + launchContent.append("\t\n"); + launchContent.append("\t\t\n"); + launchContent.append("\t\n"); + launchContent.append("\t\n"); + launchContent.append("\t\t\n"); + launchContent.append("\t\n"); + + if (getArgBoolean("favorite")) { + launchContent.append("\t\n"); + launchContent.append("\t\t\n"); + launchContent.append("\t\n"); + } + + launchContent.append("\t\n"); + launchContent.append("\t\n"); + launchContent.append("\t\n"); + launchContent.append("\t\n"); + launchContent.append("\t\n"); + } + + private void classpath() throws InvalidCommandLineException { + launchContent.append("\t\n"); + + String self; try { + self = new File("..").getCanonicalPath(); + } catch (IOException e) { + throw new InvalidCommandLineException("Cannot obtain canonical path to parent directory", e); + } + + launchContent.append("\t\t\n"); + for (Map.Entry entry : args.entrySet()) { + if (!entry.getKey().startsWith("conf.")) continue; + String[] files = entry.getValue().split(Pattern.quote(File.pathSeparator)); + for (String file : files) { + String n; + try { + n = new File(file).getCanonicalPath(); + } catch (IOException e) { + throw new InvalidCommandLineException("Cannot obtain canonical path to dependency " + file, e); + } + if (n.startsWith(self)) { + launchContent.append("\t\t\n"); + } + } + } + launchContent.append("\t\t\n"); + launchContent.append("\t\n"); + } + + private void epilogue() throws InvalidCommandLineException { + String type = getArgString("testType"); + + launchContent.append("\t\n"); + String jvmTarget = getArgString("jvmTarget"); + launchContent.append("\t\n"); + launchContent.append("\t\n"); + launchContent.append("\t\n"); + launchContent.append("\t\n"); + launchContent.append(" entry : args.entrySet()) { + if (!entry.getKey().startsWith("conf.")) continue; + launchContent.append(File.pathSeparator).append(entry.getValue()); + } + launchContent.append(" -Ddelombok.bootclasspath=lib/openjdk6_rt.jar\"/>\n"); + launchContent.append("\n"); + } + + private String getArgString(String key) throws InvalidCommandLineException { + String v = args.get(key); + if (v == null) throw new InvalidCommandLineException("mandatory argument '" + key + "' missing"); + return v; + } + + private boolean getArgBoolean(String key) throws InvalidCommandLineException { + String v = args.get(key); + if (v == null) return false; + if (v.equalsIgnoreCase("false") || v.equalsIgnoreCase("f")) return false; + return true; + } + + private static void printCommandLineHelp() { + System.err.println("CreateEclipseDebugTarget\n" + + " name=Lombok-test BaseJavac 11 # Sets the name of the debug target to make\n" + + " testType=lombok.RunJavacAndBaseTests # The test class file that this debug target should run\n" + + " conf.test=foo:bar:baz # Where 'test' is an ivy conf name, and 'foo' is a path to a jar, relativized vs. current directory.\n" + + " favorite # Should the debug target be marked as favourite?\n" + + ""); + } + + private static Map parseArgs(String[] args) throws IllegalArgumentException { + Map map = new LinkedHashMap(); + + for (String arg : args) { + int idx = arg.indexOf('='); + String key = (idx == -1 ? arg : arg.substring(0, idx)).trim(); + String value = (idx == -1 ? "" : arg.substring(idx + 1)).trim(); + String existing = map.get(key); + if (existing != null) { + if (key.startsWith("conf.")) { + value = existing + File.pathSeparator + value; + } else { + throw new IllegalArgumentException("Duplicate argument not allowed: " + key); + } + } + map.put(key, value); + } + return map; + } +} \ No newline at end of file diff --git a/src/support/lombok/website/CompileChangelog.java b/src/support/lombok/website/CompileChangelog.java new file mode 100644 index 00000000..8912434e --- /dev/null +++ b/src/support/lombok/website/CompileChangelog.java @@ -0,0 +1,147 @@ +package lombok.website; + +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.StringReader; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.petebevin.markdown.MarkdownProcessor; + +public class CompileChangelog { + public static void main(String[] args) { + String fileIn = args[0]; + String fileOut = args[1]; + boolean edge = args.length > 3 && "-edge".equals(args[2]); + boolean latest = args.length > 3 && "-latest".equals(args[2]); + String version = args.length > 3 ? args[3] : null; + + try { + FileInputStream in = new FileInputStream(fileIn); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + + byte[] b = new byte[65536]; + while (true) { + int r = in.read(b); + if ( r == -1 ) break; + out.write(b, 0, r); + } + in.close(); + String markdown = new String(out.toByteArray(), "UTF-8"); + + String result; + if (edge) { + result = buildEdge(sectionByVersion(markdown, version)); + } else if (latest) { + result = buildLatest(sectionByVersion(markdown, version)); + } else { + result = markdownToHtml(sectionStartingAt(markdown, version)); + } + + FileOutputStream file = new FileOutputStream(fileOut); + file.write(result.getBytes("UTF-8")); + file.close(); + System.exit(0); + } catch (Throwable e) { + e.printStackTrace(); + System.exit(1); + } + } + + public static String getHtmlForEdge(File root, String edgeVersion) throws IOException { + File f = new File(root, "doc/changelog.markdown"); + String raw = readFile(f); + return buildEdge(sectionByVersion(raw, edgeVersion)); + } + + public static String getHtmlForLatest(File root, String latestVersion) throws IOException { + File f = new File(root, "doc/changelog.markdown"); + String raw = readFile(f); + return buildLatest(sectionByVersion(raw, latestVersion)); + } + + public static String getHtml(File root) throws IOException { + File f = new File(root, "doc/changelog.markdown"); + String raw = readFile(f); + return markdownToHtml(raw); + } + + public static String getHtmlStartingAtSection(File root, String version) throws IOException { + File f = new File(root, "doc/changelog.markdown"); + String raw = readFile(f); + return markdownToHtml(sectionStartingAt(raw, version)); + } + + private static String readFile(File f) throws IOException { + byte[] b = new byte[65536]; + FileInputStream in = new FileInputStream(f); + try { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + while (true) { + int r = in.read(b); + if ( r == -1 ) break; + out.write(b, 0, r); + } + in.close(); + return new String(out.toByteArray(), "UTF-8"); + } finally { + in.close(); + } + } + + private static String markdownToHtml(String markdown) { + return new MarkdownProcessor().markdown(markdown); + } + + private static String buildEdge(String section) { + String latest = section != null ? section : "* No changelog records for this edge release."; + return markdownToHtml(latest); + } + + private static String buildLatest(String section) { + String latest = section != null ? section : "* No changelog records for this release."; + String noIssueLinks = latest.replaceAll("\\[[^]]*[Ii]ssue[^]]*\\]\\([^)]*\\)", ""); + String noLinks = noIssueLinks.replaceAll("\\[([^]]*)\\]\\([^)]*\\)", "$1"); + return markdownToHtml(noLinks); + } + + private static String sectionStartingAt(String markdown, String version) { + if (version.toUpperCase().endsWith("-HEAD") || version.toUpperCase().endsWith("-EDGE")) { + version = version.substring(0, version.length() - 5); + } + + Pattern p = Pattern.compile("^.*###\\s*v(.*)$"); + BufferedReader br = new BufferedReader(new StringReader(markdown)); + StringBuilder out = new StringBuilder(); + int state = 0; + try { + for (String line = br.readLine(); line != null; line = br.readLine()) { + if (state < 2) { + Matcher m = p.matcher(line); + if (m.matches()) state = m.group(1).startsWith(version) ? 2 : 1; + } + if (state != 1) { + out.append(line); + out.append("\n"); + } + } + return out.toString(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private static String sectionByVersion(String markdown, String version) { + if (version.toUpperCase().endsWith("-HEAD") || version.toUpperCase().endsWith("-EDGE")) { + version = version.substring(0, version.length() - 5); + } + + Pattern p = Pattern.compile("(?is-m)^.*###\\s*v" + version + ".*?\n(.*?)(?:###\\s*v.*)?$"); + Matcher m = p.matcher(markdown); + return m.matches() ? m.group(1) : null; + } +} \ No newline at end of file diff --git a/src/support/lombok/website/Domain.java b/src/support/lombok/website/Domain.java new file mode 100644 index 00000000..103c7377 --- /dev/null +++ b/src/support/lombok/website/Domain.java @@ -0,0 +1,26 @@ +package lombok.website; + +import java.net.MalformedURLException; +import java.net.URL; + +public class Domain { + private static final String DEFAULT = "https://projectlombok.org/"; + private final String prefix; + + public Domain(String arg) { + if (arg == null || arg.isEmpty()) this.prefix = DEFAULT; + else { + if (!arg.contains("://")) arg = "https://" + arg; + if (!arg.endsWith("/")) arg += "/"; + this.prefix = arg; + } + } + + public String getPrefix() { + return prefix; + } + + public URL url(String path) throws MalformedURLException { + return new URL(prefix + path); + } +} diff --git a/src/support/lombok/website/FetchCurrentVersion.java b/src/support/lombok/website/FetchCurrentVersion.java new file mode 100644 index 00000000..ec8d833a --- /dev/null +++ b/src/support/lombok/website/FetchCurrentVersion.java @@ -0,0 +1,36 @@ +package lombok.website; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class FetchCurrentVersion { + private FetchCurrentVersion() {} + + private static final Pattern VERSION_PATTERN = Pattern.compile("^.*<\\s*span\\s+id\\s*=\\s*[\"'](currentVersion|currentVersionFull)[\"'](?:\\s+style\\s*=\\s*[\"']display\\s*:\\s*none;?[\"'])?\\s*>\\s*([^\t<]+)\\s*<\\s*/\\s*span\\s*>.*$"); + + public static void main(String[] args) throws IOException { + System.out.print(fetchVersionFromSite(args.length < 2 || args[1].equals("full"), new Domain(args.length < 1 ? "" : args[0]))); + } + + public static String fetchVersionFromSite(boolean fetchFull, Domain domain) throws IOException { + InputStream in = domain.url("download").openStream(); + try { + BufferedReader br = new BufferedReader(new InputStreamReader(in, "UTF-8")); + try { + for (String line = br.readLine(); line != null; line = br.readLine()) { + Matcher m = VERSION_PATTERN.matcher(line); + if (m.matches() && m.group(1).equals("currentVersionFull") == fetchFull) return m.group(2).replace(""", "\""); + } + throw new IOException("Expected a span with id 'currentVersion'"); + } finally { + br.close(); + } + } finally { + in.close(); + } + } +} diff --git a/src/support/lombok/website/WebsiteMaker.java b/src/support/lombok/website/WebsiteMaker.java new file mode 100644 index 00000000..d786e605 --- /dev/null +++ b/src/support/lombok/website/WebsiteMaker.java @@ -0,0 +1,430 @@ +package lombok.website; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.lang.reflect.Method; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.TimeZone; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import de.java2html.Java2Html; +import freemarker.cache.FileTemplateLoader; +import freemarker.cache.TemplateLoader; +import freemarker.core.HTMLOutputFormat; +import freemarker.template.Configuration; +import freemarker.template.Template; +import freemarker.template.TemplateExceptionHandler; + +public class WebsiteMaker { + private final String version, fullVersion; + private final File baseDir, outputDir; + + public WebsiteMaker(String version, String fullVersion, File baseDir, File outputDir) { + this.version = version; + this.fullVersion = fullVersion; + this.baseDir = baseDir; + this.outputDir = outputDir; + } + + private static final class VersionFinder { + public static String getVersion() { + return getVersion0("getVersion"); + } + + public static String getFullVersion() { + return getVersion0("getFullVersion"); + } + + private static String getVersion0(String mName) { + try { + Class c = Class.forName("lombok.core.Version"); + Method m = c.getMethod(mName); + return (String) m.invoke(null); + } catch (ClassNotFoundException e) { + System.err.println("You need to specify the version string, and the full version string, as first 2 arguments."); + System.exit(1); + return null; + } catch (Exception e) { + if (e instanceof RuntimeException) throw (RuntimeException) e; + throw new RuntimeException(e); + } + } + } + + private static void printAllVersions(Domain domain) throws Exception { + List> versions = readAllVersions(domain); + for (List v : versions) { + System.out.println(" " + v.get(1) + ""); + } + } + + private static void buildAll(Domain domain, String version, String fullVersion, String argIn, String argOut, boolean newRelease) throws Exception { + File in, out; + if (argIn == null) { + in = new File("."); + if (new File(in, "build.xml").isFile() && new File(in, "website").isDirectory()) in = new File(in, "website"); + } else { + in = new File(argIn); + } + + if (argOut == null) { + if (new File("./build.xml").isFile() && new File("./website").isDirectory() && new File("./build").isDirectory()) { + out = new File("./build/website"); + } else { + out = new File(in, "output"); + } + } else { + out = new File(argOut); + } + WebsiteMaker maker = new WebsiteMaker(version, fullVersion, in, out); + maker.buildWebsite(domain, newRelease); + } + + private static void buildChangelog(String version, String fullVersion, String argIn, String argOut) throws Exception { + File in, out; + if (argIn == null) { + in = new File("."); + if (new File(in, "build.xml").isFile() && new File(in, "website").isDirectory()) in = new File(in, "website"); + } else { + in = new File(argIn); + } + + if (argOut == null) { + if (new File("./build.xml").isFile() && new File("./website").isDirectory() && new File("./build").isDirectory()) { + out = new File("./build/website/changelog.html"); + } else { + out = new File(in, "output/changelog.html"); + } + } else { + out = new File(argOut); + } + WebsiteMaker maker = new WebsiteMaker(version, fullVersion, in, out.getParentFile()); + maker.buildChangelog(out); + } + + private static void buildDownloadEdge(String version, String fullVersion, String argIn, String argOut) throws Exception { + File in, out; + if (argIn == null) { + in = new File("."); + if (new File(in, "build.xml").isFile() && new File(in, "website").isDirectory()) in = new File(in, "website"); + } else { + in = new File(argIn); + } + + if (argOut == null) { + if (new File("./build.xml").isFile() && new File("./website").isDirectory() && new File("./build").isDirectory()) { + out = new File("./build/website-edge/download-edge.html"); + } else { + out = new File(in, "output/download-edge.html"); + } + } else { + out = new File(argOut); + } + WebsiteMaker maker = new WebsiteMaker(version, fullVersion, in, out.getParentFile()); + maker.buildDownloadEdge(out); + } + + private static void buildChangelogLatest(String version, String fullVersion, String argIn, String argOut) throws Exception { + File in, out; + if (argIn == null) { + in = new File("."); + if (new File(in, "build.xml").isFile() && new File(in, "website").isDirectory()) in = new File(in, "website"); + } else { + in = new File(argIn); + } + + if (argOut == null) { + if (new File("./build.xml").isFile() && new File("./website").isDirectory() && new File("./build").isDirectory()) { + out = new File("./build/latestchanges.html"); + } else { + out = new File(in, "output/latestchanges.html"); + } + } else { + out = new File(argOut); + } + WebsiteMaker maker = new WebsiteMaker(version, fullVersion, in, out.getParentFile()); + maker.buildChangelogLatest(out); + } + + public static void main(String[] args) throws Exception { + String version, fullVersion; + Domain domain = new Domain(args.length < 1 ? "" : args[0]); + + if (args.length < 3) { + version = VersionFinder.getVersion(); + fullVersion = VersionFinder.getFullVersion(); + } else { + version = args[1]; + fullVersion = args[2]; + } + + String argIn = args.length < 5 ? null : args[4]; + String argOut = args.length < 6 ? null : args[5]; + if (args.length < 4 || args[3].equalsIgnoreCase("all")) { + buildAll(domain, version, fullVersion, argIn, argOut, false); + } else if (args.length < 4 || args[3].equalsIgnoreCase("all-newrelease")) { + buildAll(domain, version, fullVersion, argIn, argOut, true); + } else if (args[3].equalsIgnoreCase("changelog")) { + buildChangelog(version, fullVersion, argIn, argOut); + } else if (args[3].equalsIgnoreCase("download-edge")) { + buildDownloadEdge(version, fullVersion, argIn, argOut); + } else if (args[3].equalsIgnoreCase("changelog-latest")) { + buildChangelogLatest(version, fullVersion, argIn, argOut); + } else if (args[3].equalsIgnoreCase("print-allversions")) { + printAllVersions(domain); + } else { + throw new IllegalArgumentException("4th argument must be one of 'all', 'changelog', 'download-edge', 'changelog-latest'"); + } + } + + private Configuration makeFreemarkerConfig() throws IOException { + Configuration freemarkerConfig = new Configuration(Configuration.VERSION_2_3_25); + freemarkerConfig.setEncoding(Locale.ENGLISH, "UTF-8"); + freemarkerConfig.setOutputEncoding("UTF-8"); + freemarkerConfig.setOutputFormat(HTMLOutputFormat.INSTANCE); + freemarkerConfig.setTemplateLoader(createLoader()); + freemarkerConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); + return freemarkerConfig; + } + + public void buildChangelog(File out) throws Exception { + Configuration freemarkerConfig = makeFreemarkerConfig(); + outputDir.mkdirs(); + convertChangelog(freemarkerConfig, out); + } + + public void buildChangelogLatest(File out) throws Exception { + outputDir.mkdirs(); + String htmlForLatest = CompileChangelog.getHtmlForLatest(baseDir.getParentFile(), version); + FileOutputStream fos = new FileOutputStream(out); + try { + BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8")); + bw.write(htmlForLatest); + bw.close(); + } finally { + fos.close(); + } + } + + public void buildDownloadEdge(File out) throws Exception { + Configuration freemarkerConfig = makeFreemarkerConfig(); + + outputDir.mkdirs(); + convertDownloadEdge(freemarkerConfig, out); + } + + public void buildHtAccess(File out) throws Exception { + Configuration freemarkerConfig = new Configuration(Configuration.VERSION_2_3_25); + freemarkerConfig.setEncoding(Locale.ENGLISH, "UTF-8"); + freemarkerConfig.setOutputEncoding("UTF-8"); + freemarkerConfig.setOutputFormat(HTMLOutputFormat.INSTANCE); + freemarkerConfig.setTemplateLoader(createLoader("extra")); + freemarkerConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); + + outputDir.mkdirs(); + convertHtAccess(freemarkerConfig, out); + } + + public void buildWebsite(Domain domain, boolean newRelease) throws Exception { + Configuration freemarkerConfig = makeFreemarkerConfig(); + + outputDir.mkdirs(); + convertTemplates(domain, freemarkerConfig, newRelease); + buildHtAccess(new File(outputDir, ".htaccess")); + } + + private TemplateLoader createLoader() throws IOException { + return createLoader("templates"); + } + + private TemplateLoader createLoader(String base) throws IOException { + return new FileTemplateLoader(new File(baseDir, base)); + } + + private void convertHtAccess(Configuration freemarker, File outFile) throws Exception { + Map dataModel = new HashMap(); + dataModel.put("setupPages", listHtmlNames(new File(outputDir, "setup"))); + dataModel.put("featurePages", listHtmlNames(new File(outputDir, "features"))); + dataModel.put("experimentalPages", listHtmlNames(new File(outputDir, "features/experimental"))); + Template template = freemarker.getTemplate("htaccess"); + FileOutputStream fileOut = new FileOutputStream(outFile); + try { + Writer wr = new BufferedWriter(new OutputStreamWriter(fileOut, "UTF-8")); + template.process(dataModel, wr); + wr.close(); + } finally { + fileOut.close(); + } + } + + private List listHtmlNames(File dir) { + List out = new ArrayList(); + for (String s : dir.list()) { + if (s.endsWith(".html") && !s.equals("index.html")) out.add(s.substring(0, s.length() - 5)); + } + return out; + } + + private void convertChangelog(Configuration freemarker, File outFile) throws Exception { + Map dataModel = createBasicDataModel(); + + Template template = freemarker.getTemplate("changelog.html"); + FileOutputStream fileOut = new FileOutputStream(outFile); + try { + Writer wr = new BufferedWriter(new OutputStreamWriter(fileOut, "UTF-8")); + template.process(dataModel, wr); + wr.close(); + } finally { + fileOut.close(); + } + } + + private void convertDownloadEdge(Configuration freemarker, File outFile) throws Exception { + Map dataModel = createBasicDataModel(); + + Template template = freemarker.getTemplate("_download-edge.html"); + FileOutputStream fileOut = new FileOutputStream(outFile); + try { + Writer wr = new BufferedWriter(new OutputStreamWriter(fileOut, "UTF-8")); + template.process(dataModel, wr); + wr.close(); + } finally { + fileOut.close(); + } + } + + private void convertTemplates(Domain domain, Configuration freemarker, boolean newRelease) throws Exception { + File basePagesLoc = new File(baseDir, "templates"); + Map dataModel = createBasicDataModel(); + dataModel.putAll(createExtendedDataModel(domain, newRelease)); + convertTemplates_(freemarker, "", basePagesLoc, outputDir, 0, dataModel); + } + + private void convertTemplates_(Configuration freemarker, String prefix, File from, File to, int depth, Map dataModel) throws Exception { + if (depth > 50) throw new IllegalArgumentException("50 levels is too deep: " + from); + + for (File f : from.listFiles()) { + if (f.isDirectory()) convertTemplates_(freemarker, prefix + f.getName() + "/", f, new File(to, f.getName()), depth + 1, dataModel); + if (!f.isFile() || f.getName().startsWith("_")) continue; + to.mkdirs(); + Template template = freemarker.getTemplate(prefix + f.getName()); + FileOutputStream fileOut = new FileOutputStream(new File(to, f.getName())); + try { + Writer wr = new BufferedWriter(new OutputStreamWriter(fileOut, "UTF-8")); + template.process(dataModel, wr); + wr.close(); + } finally { + fileOut.close(); + } + } + } + + private Map createBasicDataModel() throws IOException { + Map data = new HashMap(); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss 'UTC'"); + sdf.setTimeZone(TimeZone.getTimeZone("UTC")); + String currentTime = sdf.format(new Date()); + + data.put("version", version); + data.put("fullVersion", fullVersion); + data.put("timestampString", currentTime); + data.put("year", "" + new GregorianCalendar().get(Calendar.YEAR)); + data.put("changelog", CompileChangelog.getHtmlStartingAtSection(baseDir.getParentFile(), version)); + data.put("changelogEdge", CompileChangelog.getHtmlForEdge(baseDir.getParentFile(), version)); + + return data; + } + + private static final Pattern LOMBOK_LINK = Pattern.compile("^.*([^<]+).*$"); + private Map createExtendedDataModel(Domain domain, boolean newRelease) throws IOException { + Map data = new HashMap(); + + data.put("usages", new HtmlMaker(new File(baseDir, "usageExamples"))); + List> allVersions = readAllVersions(domain); + if (!newRelease && !allVersions.isEmpty()) allVersions.remove(0); // remove current version; it will be 're-added' as current version automatically. + data.put("linksToVersions", allVersions); + + return data; + } + + private static List> readAllVersions(Domain domain) throws IOException { + InputStream in = domain.url("all-versions.html").openStream(); + ArrayList> links = new ArrayList>(); + try { + BufferedReader br = new BufferedReader(new InputStreamReader(in, "UTF-8")); + for (String line = br.readLine(); line != null; line = br.readLine()) { + Matcher m = LOMBOK_LINK.matcher(line); + if (m.matches()) { + String url = m.group(1); + String name = m.group(2); + if (name.endsWith(" [Current Version]")) { + name = "lombok-" + name.substring(0, name.length() - " [Current Version]".length()) + ".jar"; + url = url.replace("lombok.jar", name); + } + links.add(Arrays.asList(name, url)); + } + } + } finally { + in.close(); + } + + return links; + } + + public static class HtmlMaker { + private final File usagesDir; + + HtmlMaker(File usagesDir) { + this.usagesDir = usagesDir; + } + + public String pre(String name) throws IOException { + return convert(new File(usagesDir, name + "Example_pre.jpage")); + } + + public String post(String name) throws IOException { + return convert(new File(usagesDir, name + "Example_post.jpage")); + } + + public String convert(File file) throws IOException { + String rawJava = readFully(file); + return Java2Html.convertToHtml(rawJava); + } + } + + public static String readFully(File file) throws IOException { + FileInputStream fis = new FileInputStream(file); + try { + InputStreamReader isr = new InputStreamReader(fis, "UTF-8"); + StringBuilder out = new StringBuilder(); + char[] b = new char[65536]; + while (true) { + int r = isr.read(b); + if (r == -1) break; + out.append(b, 0, r); + } + return out.toString(); + } finally { + fis.close(); + } + } +} diff --git a/src/utils/lombok/core/SpiLoadUtil.java b/src/utils/lombok/core/SpiLoadUtil.java index e685acd6..0feb7f12 100644 --- a/src/utils/lombok/core/SpiLoadUtil.java +++ b/src/utils/lombok/core/SpiLoadUtil.java @@ -129,9 +129,10 @@ public class SpiLoadUtil { private static void readServicesFromUrl(Collection list, URL url) throws IOException { InputStream in = url.openStream(); + BufferedReader r = null; try { if (in == null) return; - BufferedReader r = new BufferedReader(new InputStreamReader(in, "UTF-8")); + r = new BufferedReader(new InputStreamReader(in, "UTF-8")); while (true) { String line = r.readLine(); if (line == null) break; @@ -143,6 +144,7 @@ public class SpiLoadUtil { } } finally { try { + if (r != null) r.close(); if (in != null) in.close(); } catch (Throwable ignore) {} } diff --git a/src/website/log4j.properties b/src/website/log4j.properties deleted file mode 100644 index 9cafcc3b..00000000 --- a/src/website/log4j.properties +++ /dev/null @@ -1,6 +0,0 @@ -log4j.rootLogger=INFO, stdout - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target=System.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n diff --git a/src/website/lombok/website/CompileChangelog.java b/src/website/lombok/website/CompileChangelog.java deleted file mode 100644 index 8912434e..00000000 --- a/src/website/lombok/website/CompileChangelog.java +++ /dev/null @@ -1,147 +0,0 @@ -package lombok.website; - -import java.io.BufferedReader; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.StringReader; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import com.petebevin.markdown.MarkdownProcessor; - -public class CompileChangelog { - public static void main(String[] args) { - String fileIn = args[0]; - String fileOut = args[1]; - boolean edge = args.length > 3 && "-edge".equals(args[2]); - boolean latest = args.length > 3 && "-latest".equals(args[2]); - String version = args.length > 3 ? args[3] : null; - - try { - FileInputStream in = new FileInputStream(fileIn); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - - byte[] b = new byte[65536]; - while (true) { - int r = in.read(b); - if ( r == -1 ) break; - out.write(b, 0, r); - } - in.close(); - String markdown = new String(out.toByteArray(), "UTF-8"); - - String result; - if (edge) { - result = buildEdge(sectionByVersion(markdown, version)); - } else if (latest) { - result = buildLatest(sectionByVersion(markdown, version)); - } else { - result = markdownToHtml(sectionStartingAt(markdown, version)); - } - - FileOutputStream file = new FileOutputStream(fileOut); - file.write(result.getBytes("UTF-8")); - file.close(); - System.exit(0); - } catch (Throwable e) { - e.printStackTrace(); - System.exit(1); - } - } - - public static String getHtmlForEdge(File root, String edgeVersion) throws IOException { - File f = new File(root, "doc/changelog.markdown"); - String raw = readFile(f); - return buildEdge(sectionByVersion(raw, edgeVersion)); - } - - public static String getHtmlForLatest(File root, String latestVersion) throws IOException { - File f = new File(root, "doc/changelog.markdown"); - String raw = readFile(f); - return buildLatest(sectionByVersion(raw, latestVersion)); - } - - public static String getHtml(File root) throws IOException { - File f = new File(root, "doc/changelog.markdown"); - String raw = readFile(f); - return markdownToHtml(raw); - } - - public static String getHtmlStartingAtSection(File root, String version) throws IOException { - File f = new File(root, "doc/changelog.markdown"); - String raw = readFile(f); - return markdownToHtml(sectionStartingAt(raw, version)); - } - - private static String readFile(File f) throws IOException { - byte[] b = new byte[65536]; - FileInputStream in = new FileInputStream(f); - try { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - while (true) { - int r = in.read(b); - if ( r == -1 ) break; - out.write(b, 0, r); - } - in.close(); - return new String(out.toByteArray(), "UTF-8"); - } finally { - in.close(); - } - } - - private static String markdownToHtml(String markdown) { - return new MarkdownProcessor().markdown(markdown); - } - - private static String buildEdge(String section) { - String latest = section != null ? section : "* No changelog records for this edge release."; - return markdownToHtml(latest); - } - - private static String buildLatest(String section) { - String latest = section != null ? section : "* No changelog records for this release."; - String noIssueLinks = latest.replaceAll("\\[[^]]*[Ii]ssue[^]]*\\]\\([^)]*\\)", ""); - String noLinks = noIssueLinks.replaceAll("\\[([^]]*)\\]\\([^)]*\\)", "$1"); - return markdownToHtml(noLinks); - } - - private static String sectionStartingAt(String markdown, String version) { - if (version.toUpperCase().endsWith("-HEAD") || version.toUpperCase().endsWith("-EDGE")) { - version = version.substring(0, version.length() - 5); - } - - Pattern p = Pattern.compile("^.*###\\s*v(.*)$"); - BufferedReader br = new BufferedReader(new StringReader(markdown)); - StringBuilder out = new StringBuilder(); - int state = 0; - try { - for (String line = br.readLine(); line != null; line = br.readLine()) { - if (state < 2) { - Matcher m = p.matcher(line); - if (m.matches()) state = m.group(1).startsWith(version) ? 2 : 1; - } - if (state != 1) { - out.append(line); - out.append("\n"); - } - } - return out.toString(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - private static String sectionByVersion(String markdown, String version) { - if (version.toUpperCase().endsWith("-HEAD") || version.toUpperCase().endsWith("-EDGE")) { - version = version.substring(0, version.length() - 5); - } - - Pattern p = Pattern.compile("(?is-m)^.*###\\s*v" + version + ".*?\n(.*?)(?:###\\s*v.*)?$"); - Matcher m = p.matcher(markdown); - return m.matches() ? m.group(1) : null; - } -} \ No newline at end of file diff --git a/src/website/lombok/website/FetchCurrentVersion.java b/src/website/lombok/website/FetchCurrentVersion.java deleted file mode 100644 index d32c45dd..00000000 --- a/src/website/lombok/website/FetchCurrentVersion.java +++ /dev/null @@ -1,37 +0,0 @@ -package lombok.website; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.URL; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class FetchCurrentVersion { - private FetchCurrentVersion() {} - - private static final Pattern VERSION_PATTERN = Pattern.compile("^.*<\\s*span\\s+id\\s*=\\s*[\"'](currentVersion|currentVersionFull)[\"'](?:\\s+style\\s*=\\s*[\"']display\\s*:\\s*none;?[\"'])?\\s*>\\s*([^\t<]+)\\s*<\\s*/\\s*span\\s*>.*$"); - - public static void main(String[] args) throws IOException { - System.out.print(fetchVersionFromSite(args.length == 0 || args[0].equals("full"))); - } - - public static String fetchVersionFromSite(boolean fetchFull) throws IOException { - InputStream in = new URL("https://projectlombok.org/download").openStream(); - try { - BufferedReader br = new BufferedReader(new InputStreamReader(in, "UTF-8")); - try { - for (String line = br.readLine(); line != null; line = br.readLine()) { - Matcher m = VERSION_PATTERN.matcher(line); - if (m.matches() && m.group(1).equals("currentVersionFull") == fetchFull) return m.group(2).replace(""", "\""); - } - throw new IOException("Expected a span with id 'currentVersion'"); - } finally { - br.close(); - } - } finally { - in.close(); - } - } -} diff --git a/src/website/lombok/website/WebsiteMaker.java b/src/website/lombok/website/WebsiteMaker.java deleted file mode 100644 index 87d6dcc6..00000000 --- a/src/website/lombok/website/WebsiteMaker.java +++ /dev/null @@ -1,403 +0,0 @@ -package lombok.website; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.lang.reflect.Method; -import java.net.URL; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.TimeZone; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import de.java2html.Java2Html; -import freemarker.cache.FileTemplateLoader; -import freemarker.cache.TemplateLoader; -import freemarker.core.HTMLOutputFormat; -import freemarker.template.Configuration; -import freemarker.template.Template; -import freemarker.template.TemplateExceptionHandler; - -public class WebsiteMaker { - private final String version, fullVersion; - private final File baseDir, outputDir; - - public WebsiteMaker(String version, String fullVersion, File baseDir, File outputDir) { - this.version = version; - this.fullVersion = fullVersion; - this.baseDir = baseDir; - this.outputDir = outputDir; - } - - private static final class VersionFinder { - public static String getVersion() { - return getVersion0("getVersion"); - } - - public static String getFullVersion() { - return getVersion0("getFullVersion"); - } - - private static String getVersion0(String mName) { - try { - Class c = Class.forName("lombok.core.Version"); - Method m = c.getMethod(mName); - return (String) m.invoke(null); - } catch (ClassNotFoundException e) { - System.err.println("You need to specify the version string, and the full version string, as first 2 arguments."); - System.exit(1); - return null; - } catch (Exception e) { - if (e instanceof RuntimeException) throw (RuntimeException) e; - throw new RuntimeException(e); - } - } - } - - private static void buildAll(String version, String fullVersion, String argIn, String argOut) throws Exception { - File in, out; - if (argIn == null) { - in = new File("."); - if (new File(in, "build.xml").isFile() && new File(in, "website").isDirectory()) in = new File(in, "website"); - } else { - in = new File(argIn); - } - - if (argOut == null) { - if (new File("./build.xml").isFile() && new File("./website").isDirectory() && new File("./build").isDirectory()) { - out = new File("./build/website"); - } else { - out = new File(in, "output"); - } - } else { - out = new File(argOut); - } - WebsiteMaker maker = new WebsiteMaker(version, fullVersion, in, out); - maker.buildWebsite(); - } - - private static void buildChangelog(String version, String fullVersion, String argIn, String argOut) throws Exception { - File in, out; - if (argIn == null) { - in = new File("."); - if (new File(in, "build.xml").isFile() && new File(in, "website").isDirectory()) in = new File(in, "website"); - } else { - in = new File(argIn); - } - - if (argOut == null) { - if (new File("./build.xml").isFile() && new File("./website").isDirectory() && new File("./build").isDirectory()) { - out = new File("./build/website/changelog.html"); - } else { - out = new File(in, "output/changelog.html"); - } - } else { - out = new File(argOut); - } - WebsiteMaker maker = new WebsiteMaker(version, fullVersion, in, out.getParentFile()); - maker.buildChangelog(out); - } - - private static void buildDownloadEdge(String version, String fullVersion, String argIn, String argOut) throws Exception { - File in, out; - if (argIn == null) { - in = new File("."); - if (new File(in, "build.xml").isFile() && new File(in, "website").isDirectory()) in = new File(in, "website"); - } else { - in = new File(argIn); - } - - if (argOut == null) { - if (new File("./build.xml").isFile() && new File("./website").isDirectory() && new File("./build").isDirectory()) { - out = new File("./build/website-edge/download-edge.html"); - } else { - out = new File(in, "output/download-edge.html"); - } - } else { - out = new File(argOut); - } - WebsiteMaker maker = new WebsiteMaker(version, fullVersion, in, out.getParentFile()); - maker.buildDownloadEdge(out); - } - - private static void buildChangelogLatest(String version, String fullVersion, String argIn, String argOut) throws Exception { - File in, out; - if (argIn == null) { - in = new File("."); - if (new File(in, "build.xml").isFile() && new File(in, "website").isDirectory()) in = new File(in, "website"); - } else { - in = new File(argIn); - } - - if (argOut == null) { - if (new File("./build.xml").isFile() && new File("./website").isDirectory() && new File("./build").isDirectory()) { - out = new File("./build/latestchanges.html"); - } else { - out = new File(in, "output/latestchanges.html"); - } - } else { - out = new File(argOut); - } - WebsiteMaker maker = new WebsiteMaker(version, fullVersion, in, out.getParentFile()); - maker.buildChangelogLatest(out); - } - - public static void main(String[] args) throws Exception { - String version, fullVersion; - - if (args.length < 2) { - version = VersionFinder.getVersion(); - fullVersion = VersionFinder.getFullVersion(); - } else { - version = args[0]; - fullVersion = args[1]; - } - - if (args.length < 3 || args[2].equalsIgnoreCase("all")) { - buildAll(version, fullVersion, args.length < 4 ? null : args[3], args.length < 5 ? null : args[4]); - } else if (args[2].equalsIgnoreCase("changelog")) { - buildChangelog(version, fullVersion, args.length < 4 ? null : args[3], args.length < 5 ? null : args[4]); - } else if (args[2].equalsIgnoreCase("download-edge")) { - buildDownloadEdge(version, fullVersion, args.length < 4 ? null : args[3], args.length < 5 ? null : args[4]); - } else if (args[2].equalsIgnoreCase("changelog-latest")) { - buildChangelogLatest(version, fullVersion, args.length < 4 ? null : args[3], args.length < 5 ? null : args[4]); - } else { - throw new IllegalArgumentException("3rd argument must be one of 'all', 'changelog', 'download-edge', 'changelog-latest'"); - } - } - - private Configuration makeFreemarkerConfig() throws IOException { - Configuration freemarkerConfig = new Configuration(Configuration.VERSION_2_3_25); - freemarkerConfig.setEncoding(Locale.ENGLISH, "UTF-8"); - freemarkerConfig.setOutputEncoding("UTF-8"); - freemarkerConfig.setOutputFormat(HTMLOutputFormat.INSTANCE); - freemarkerConfig.setTemplateLoader(createLoader()); - freemarkerConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); - return freemarkerConfig; - } - - public void buildChangelog(File out) throws Exception { - Configuration freemarkerConfig = makeFreemarkerConfig(); - outputDir.mkdirs(); - convertChangelog(freemarkerConfig, out); - } - - public void buildChangelogLatest(File out) throws Exception { - outputDir.mkdirs(); - String htmlForLatest = CompileChangelog.getHtmlForLatest(baseDir.getParentFile(), version); - FileOutputStream fos = new FileOutputStream(out); - try { - BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8")); - bw.write(htmlForLatest); - bw.close(); - } finally { - fos.close(); - } - } - - public void buildDownloadEdge(File out) throws Exception { - Configuration freemarkerConfig = makeFreemarkerConfig(); - - outputDir.mkdirs(); - convertDownloadEdge(freemarkerConfig, out); - } - - public void buildHtAccess(File out) throws Exception { - Configuration freemarkerConfig = new Configuration(Configuration.VERSION_2_3_25); - freemarkerConfig.setEncoding(Locale.ENGLISH, "UTF-8"); - freemarkerConfig.setOutputEncoding("UTF-8"); - freemarkerConfig.setOutputFormat(HTMLOutputFormat.INSTANCE); - freemarkerConfig.setTemplateLoader(createLoader("extra")); - freemarkerConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); - - outputDir.mkdirs(); - convertHtAccess(freemarkerConfig, out); - } - - public void buildWebsite() throws Exception { - Configuration freemarkerConfig = makeFreemarkerConfig(); - - outputDir.mkdirs(); - convertTemplates(freemarkerConfig); - buildHtAccess(new File(outputDir, ".htaccess")); - } - - private TemplateLoader createLoader() throws IOException { - return createLoader("templates"); - } - - private TemplateLoader createLoader(String base) throws IOException { - return new FileTemplateLoader(new File(baseDir, base)); - } - - private void convertHtAccess(Configuration freemarker, File outFile) throws Exception { - Map dataModel = new HashMap(); - dataModel.put("setupPages", listHtmlNames(new File(outputDir, "setup"))); - dataModel.put("featurePages", listHtmlNames(new File(outputDir, "features"))); - dataModel.put("experimentalPages", listHtmlNames(new File(outputDir, "features/experimental"))); - Template template = freemarker.getTemplate("htaccess"); - FileOutputStream fileOut = new FileOutputStream(outFile); - try { - Writer wr = new BufferedWriter(new OutputStreamWriter(fileOut, "UTF-8")); - template.process(dataModel, wr); - wr.close(); - } finally { - fileOut.close(); - } - } - - private List listHtmlNames(File dir) { - List out = new ArrayList(); - for (String s : dir.list()) { - if (s.endsWith(".html") && !s.equals("index.html")) out.add(s.substring(0, s.length() - 5)); - } - return out; - } - - private void convertChangelog(Configuration freemarker, File outFile) throws Exception { - Map dataModel = createBasicDataModel(); - - Template template = freemarker.getTemplate("changelog.html"); - FileOutputStream fileOut = new FileOutputStream(outFile); - try { - Writer wr = new BufferedWriter(new OutputStreamWriter(fileOut, "UTF-8")); - template.process(dataModel, wr); - wr.close(); - } finally { - fileOut.close(); - } - } - - private void convertDownloadEdge(Configuration freemarker, File outFile) throws Exception { - Map dataModel = createBasicDataModel(); - - Template template = freemarker.getTemplate("_download-edge.html"); - FileOutputStream fileOut = new FileOutputStream(outFile); - try { - Writer wr = new BufferedWriter(new OutputStreamWriter(fileOut, "UTF-8")); - template.process(dataModel, wr); - wr.close(); - } finally { - fileOut.close(); - } - } - - private void convertTemplates(Configuration freemarker) throws Exception { - File basePagesLoc = new File(baseDir, "templates"); - Map dataModel = createBasicDataModel(); - dataModel.putAll(createExtendedDataModel()); - convertTemplates_(freemarker, "", basePagesLoc, outputDir, 0, dataModel); - } - - private void convertTemplates_(Configuration freemarker, String prefix, File from, File to, int depth, Map dataModel) throws Exception { - if (depth > 50) throw new IllegalArgumentException("50 levels is too deep: " + from); - - for (File f : from.listFiles()) { - if (f.isDirectory()) convertTemplates_(freemarker, prefix + f.getName() + "/", f, new File(to, f.getName()), depth + 1, dataModel); - if (!f.isFile() || f.getName().startsWith("_")) continue; - to.mkdirs(); - Template template = freemarker.getTemplate(prefix + f.getName()); - FileOutputStream fileOut = new FileOutputStream(new File(to, f.getName())); - try { - Writer wr = new BufferedWriter(new OutputStreamWriter(fileOut, "UTF-8")); - template.process(dataModel, wr); - wr.close(); - } finally { - fileOut.close(); - } - } - } - - private Map createBasicDataModel() throws IOException { - Map data = new HashMap(); - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss 'UTC'"); - sdf.setTimeZone(TimeZone.getTimeZone("UTC")); - String currentTime = sdf.format(new Date()); - - data.put("version", version); - data.put("fullVersion", fullVersion); - data.put("timestampString", currentTime); - data.put("year", "" + new GregorianCalendar().get(Calendar.YEAR)); - data.put("changelog", CompileChangelog.getHtmlStartingAtSection(baseDir.getParentFile(), version)); - data.put("changelogEdge", CompileChangelog.getHtmlForEdge(baseDir.getParentFile(), version)); - - return data; - } - - private static final Pattern LOMBOK_LINK = Pattern.compile("^.*([^<]+).*$"); - private Map createExtendedDataModel() throws IOException { - Map data = new HashMap(); - - data.put("usages", new HtmlMaker(new File(baseDir, "usageExamples"))); - InputStream in = new URL("https://projectlombok.org/all-versions.html").openStream(); - ArrayList> links = new ArrayList>(); - try { - BufferedReader br = new BufferedReader(new InputStreamReader(in, "UTF-8")); - for (String line = br.readLine(); line != null; line = br.readLine()) { - Matcher m = LOMBOK_LINK.matcher(line); - if (m.matches()) links.add(Arrays.asList(m.group(1), m.group(2))); - } - } finally { - in.close(); - } - - data.put("linksToVersions", links); - - return data; - } - - public static class HtmlMaker { - private final File usagesDir; - - HtmlMaker(File usagesDir) { - this.usagesDir = usagesDir; - } - - public String pre(String name) throws IOException { - return convert(new File(usagesDir, name + "Example_pre.jpage")); - } - - public String post(String name) throws IOException { - return convert(new File(usagesDir, name + "Example_post.jpage")); - } - - public String convert(File file) throws IOException { - String rawJava = readFully(file); - return Java2Html.convertToHtml(rawJava); - } - } - - public static String readFully(File file) throws IOException { - FileInputStream fis = new FileInputStream(file); - try { - InputStreamReader isr = new InputStreamReader(fis, "UTF-8"); - StringBuilder out = new StringBuilder(); - char[] b = new char[65536]; - while (true) { - int r = isr.read(b); - if (r == -1) break; - out.append(b, 0, r); - } - return out.toString(); - } finally { - fis.close(); - } - } -} diff --git a/ssh.knownHosts b/ssh.knownHosts index 873e852f..6cce7f01 100644 --- a/ssh.knownHosts +++ b/ssh.knownHosts @@ -1,2 +1,2 @@ projectlombok.org:22:ECDSA:X.509:MIIBMzCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA/////wAAAAEAAAAAAAAAAAAAAAD///////////////8wRAQg/////wAAAAEAAAAAAAAAAAAAAAD///////////////wEIFrGNdiqOpPns+u9VXaYhrxlHQawzFOw9jvOPD4n0mBLBEEEaxfR8uEsQkf4vOblY6RA8ncDfYEt6zOg9KE5RdiYwpZP40Li/hp/m47n60p8D54WK84zV2sxXs7LtkBoN79R9QIhAP////8AAAAA//////////+85vqtpxeehPO5ysL8YyVRAgEBA0IABKwMbAFQuRwz9+PnuBOlc1OqPAYVhg0VBTGQ1G5V6JVfb0CU5GH4NEFp+jEAoGCZNrghB0XLB3d3egfF06ihDgE= - +projectlombok.org:22:EdDSA:X.509:MCowBQYDK2VwAyEA450nCMycc70u7i0qetTrh9yl6+cOS6v4y8clPCnSIHs= diff --git a/test/core/src/lombok/DirectoryRunner.java b/test/core/src/lombok/DirectoryRunner.java index b8b1da43..e4792ca9 100644 --- a/test/core/src/lombok/DirectoryRunner.java +++ b/test/core/src/lombok/DirectoryRunner.java @@ -82,8 +82,16 @@ public class DirectoryRunner extends Runner { private static final FileFilter JAVA_FILE_FILTER = new FileFilter() { @Override public boolean accept(File file) { - return file.isFile() && file.getName().endsWith(".java") && - (DEBUG_FOCUS_ON_FILE.isEmpty() || DEBUG_FOCUS_ON_FILE.contains(file.getName())); + if (!file.isFile() || !file.getName().endsWith(".java")) return false; + boolean positiveFilter = false; + for (String dfof : DEBUG_FOCUS_ON_FILE) { + if (!dfof.endsWith(".java")) dfof = dfof + ".java"; + boolean invert = dfof.startsWith("!"); + if (invert) dfof = dfof.substring(1); + positiveFilter = positiveFilter || !invert; + if (file.getName().equals(dfof)) return !invert; + } + return !positiveFilter; } }; diff --git a/test/core/src/lombok/RunAllTests.java b/test/core/src/lombok/RunAllTests.java deleted file mode 100644 index 1ca76af5..00000000 --- a/test/core/src/lombok/RunAllTests.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2011-2015 The Project Lombok Authors. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package lombok; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; - -@RunWith(Suite.class) -@SuiteClasses({lombok.transform.RunTransformTests.class, lombok.bytecode.RunBytecodeTests.class, lombok.core.configuration.RunConfigurationTests.class, lombok.core.RunCoreTests.class}) -public class RunAllTests { -} diff --git a/test/core/src/lombok/RunTestsViaDelombok.java b/test/core/src/lombok/RunTestsViaDelombok.java index 0887de32..b766e7a4 100644 --- a/test/core/src/lombok/RunTestsViaDelombok.java +++ b/test/core/src/lombok/RunTestsViaDelombok.java @@ -29,16 +29,20 @@ import java.io.UnsupportedEncodingException; import java.util.Collection; import java.util.Locale; import java.util.Map; +import java.util.concurrent.atomic.AtomicBoolean; import lombok.delombok.Delombok; import lombok.javac.CapturingDiagnosticListener; +import lombok.javac.Javac; import lombok.javac.CapturingDiagnosticListener.CompilerMessage; public class RunTestsViaDelombok extends AbstractRunTests { private Delombok delombok = new Delombok(); + private static AtomicBoolean compilerVersionReported = new AtomicBoolean(); @Override public boolean transformCode(Collection messages, StringWriter result, final File file, String encoding, Map formatPreferences) throws Throwable { + if (!compilerVersionReported.getAndSet(true)) System.out.println("Javac version: " + Javac.getJavaCompilerVersion()); delombok.setVerbose(true); ChangedChecker cc = new ChangedChecker(); delombok.setFeedback(cc.feedback); diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java index 3efe38f5..77d1b75e 100644 --- a/test/core/src/lombok/RunTestsViaEcj.java +++ b/test/core/src/lombok/RunTestsViaEcj.java @@ -69,7 +69,8 @@ public class RunTestsViaEcj extends AbstractRunTests { warnings.put(CompilerOptions.OPTION_ReportUnusedLabel, "ignore"); warnings.put(CompilerOptions.OPTION_ReportUnusedImport, "ignore"); warnings.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, "ignore"); - warnings.put(CompilerOptions.OPTION_Source, "1." + Eclipse.getEcjCompilerVersion()); + int ecjVersion = Eclipse.getEcjCompilerVersion(); + warnings.put(CompilerOptions.OPTION_Source, (ecjVersion < 9 ? "1." : "") + ecjVersion); options.set(warnings); return options; } @@ -137,16 +138,13 @@ public class RunTestsViaEcj extends AbstractRunTests { } if (new File("bin").exists()) classpath.add("bin"); classpath.add("dist/lombok.jar"); - classpath.add("lib/oracleJDK8Environment/rt.jar"); - classpath.add("lib/test/commons-logging-commons-logging.jar"); - classpath.add("lib/test/org.slf4j-slf4j-api.jar"); - classpath.add("lib/test/org.slf4j-slf4j-ext.jar"); - classpath.add("lib/test/log4j-log4j.jar"); - classpath.add("lib/test/org.apache.logging.log4j-log4j-api.jar"); - classpath.add("lib/test/org.jboss.logging-jboss-logging.jar"); - classpath.add("lib/test/com.google.guava-guava.jar"); - classpath.add("lib/test/com.google.code.findbugs-findbugs.jar"); - classpath.add("lib/test/com.google.flogger-flogger.jar"); + classpath.add("lib/openjdk6_rt.jar"); + for (File f : new File("lib/test").listFiles()) { + String fn = f.getName(); + if (fn.length() < 4) continue; + if (!fn.substring(fn.length() - 4).toLowerCase().equals(".jar")) continue; + classpath.add("lib/test/" + fn); + } return new FileSystem(classpath.toArray(new String[0]), new String[] {file.getAbsolutePath()}, "UTF-8"); } } diff --git a/test/core/src/lombok/TestBase.java b/test/core/src/lombok/TestBase.java new file mode 100644 index 00000000..4b0c02f3 --- /dev/null +++ b/test/core/src/lombok/TestBase.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2011-2020 The Project Lombok Authors. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package lombok; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({lombok.core.configuration.RunConfigurationTests.class, lombok.core.RunCoreTests.class}) +public class TestBase { +} diff --git a/test/core/src/lombok/TestEclipse.java b/test/core/src/lombok/TestEclipse.java new file mode 100644 index 00000000..9fe798bc --- /dev/null +++ b/test/core/src/lombok/TestEclipse.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2011-2020 The Project Lombok Authors. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package lombok; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({lombok.transform.TestWithEcj.class}) +public class TestEclipse { +} diff --git a/test/core/src/lombok/TestJavac.java b/test/core/src/lombok/TestJavac.java new file mode 100644 index 00000000..340abb35 --- /dev/null +++ b/test/core/src/lombok/TestJavac.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2011-2020 The Project Lombok Authors. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package lombok; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +//@SuiteClasses({lombok.bytecode.RunBytecodeTests.class, lombok.transform.TestLombokFilesIdempotent.class, lombok.transform.TestSourceFiles.class, lombok.transform.TestWithDelombok.class}) +@SuiteClasses({lombok.transform.TestLombokFilesIdempotent.class}) +public class TestJavac { +} diff --git a/test/transform/src/lombok/transform/RunTransformTests.java b/test/transform/src/lombok/transform/RunTransformTests.java deleted file mode 100644 index 0afbc5d6..00000000 --- a/test/transform/src/lombok/transform/RunTransformTests.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2011-2012 The Project Lombok Authors. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package lombok.transform; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; - -@RunWith(Suite.class) -@SuiteClasses({TestLombokFilesIdempotent.class, TestSourceFiles.class, TestWithDelombok.class, TestWithEcj.class}) -public class RunTransformTests { -} diff --git a/website/templates/all-versions.html b/website/templates/all-versions.html index 0207b351..db48f664 100644 --- a/website/templates/all-versions.html +++ b/website/templates/all-versions.html @@ -6,9 +6,7 @@

-- cgit From 0f1c950b7700b476954c6e193e53d36ed34e2050 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Thu, 25 Jun 2020 22:10:15 +0200 Subject: [build] [mapstructBinding] --- build.xml | 1 + buildScripts/create-eclipse-project.ant.xml | 1 - buildScripts/create-intellij-project.ant.xml | 1 - buildScripts/mapstruct-old.ant.xml | 169 --------------------- buildScripts/mapstructBinding.ant.xml | 125 +++++++++++++++ buildScripts/website.ant.xml | 2 +- .../projectlombok/testAp/ExampleAnnotation.java | 10 -- src/testAP/org/projectlombok/testAp/TestAp.java | 77 ---------- src/useTestAP/UseTestAp.java | 13 -- 9 files changed, 127 insertions(+), 272 deletions(-) delete mode 100644 buildScripts/mapstruct-old.ant.xml create mode 100644 buildScripts/mapstructBinding.ant.xml delete mode 100644 src/testAP/org/projectlombok/testAp/ExampleAnnotation.java delete mode 100644 src/testAP/org/projectlombok/testAp/TestAp.java delete mode 100644 src/useTestAP/UseTestAp.java diff --git a/build.xml b/build.xml index 59e258d4..5a1a67a0 100644 --- a/build.xml +++ b/build.xml @@ -36,4 +36,5 @@ the common tasks and can be called on to run the main aspects of all the sub-scr +
diff --git a/buildScripts/create-eclipse-project.ant.xml b/buildScripts/create-eclipse-project.ant.xml index 93eed3b0..386ed3de 100644 --- a/buildScripts/create-eclipse-project.ant.xml +++ b/buildScripts/create-eclipse-project.ant.xml @@ -36,7 +36,6 @@ This buildfile is part of projectlombok.org. It creates the infrastructure neede - diff --git a/buildScripts/create-intellij-project.ant.xml b/buildScripts/create-intellij-project.ant.xml index abb8c589..865e8971 100644 --- a/buildScripts/create-intellij-project.ant.xml +++ b/buildScripts/create-intellij-project.ant.xml @@ -41,7 +41,6 @@ This buildfile is part of projectlombok.org. It creates the infrastructure neede - diff --git a/buildScripts/mapstruct-old.ant.xml b/buildScripts/mapstruct-old.ant.xml deleted file mode 100644 index cf14dd93..00000000 --- a/buildScripts/mapstruct-old.ant.xml +++ /dev/null @@ -1,169 +0,0 @@ - - - -This buildfile is part of projectlombok.org. It contains leftover tasks from the previous version -of the build that are related to mapstruct. We will clean this up or remove it soon. - - - - - - - - - - - - org.projectlombok.testAp.TestAp - - - - - - - - - - - - - - - - Running in order: First Lombok, Then testAP - - - - - - - - - - - - Running in order: First TestAP, Then Lombok - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - lombok.mapstruct.NotifierHider$AstModificationNotifier - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/buildScripts/mapstructBinding.ant.xml b/buildScripts/mapstructBinding.ant.xml new file mode 100644 index 00000000..c59b84da --- /dev/null +++ b/buildScripts/mapstructBinding.ant.xml @@ -0,0 +1,125 @@ + + + +This buildfile is part of projectlombok.org. It builds the mapstruct-lombok binding; we think the +version on mavencentral is the last version that is ever needed; the code itself is trivial and +exists as a separate dependency solely because it is itself dependent on both lombok and mapstruct. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + lombok.mapstruct.NotifierHider$AstModificationNotifier + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + mvn is not on your path and/or MAVEN_HOME is not set. Add mvn to your path or set MAVEN_HOME to continue. + + + + + + diff --git a/buildScripts/website.ant.xml b/buildScripts/website.ant.xml index 15bca92d..9efb2668 100644 --- a/buildScripts/website.ant.xml +++ b/buildScripts/website.ant.xml @@ -305,7 +305,7 @@ such as applying the templates to produce the website, converting the changelog knownHosts="ssh.knownHosts" /> - + diff --git a/src/testAP/org/projectlombok/testAp/ExampleAnnotation.java b/src/testAP/org/projectlombok/testAp/ExampleAnnotation.java deleted file mode 100644 index b419326b..00000000 --- a/src/testAP/org/projectlombok/testAp/ExampleAnnotation.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.projectlombok.testAp; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.CLASS) -@Target(ElementType.TYPE) -public @interface ExampleAnnotation {} diff --git a/src/testAP/org/projectlombok/testAp/TestAp.java b/src/testAP/org/projectlombok/testAp/TestAp.java deleted file mode 100644 index b5f20d21..00000000 --- a/src/testAP/org/projectlombok/testAp/TestAp.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2016 The Project Lombok Authors. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package org.projectlombok.testAp; - -import java.util.Set; - -import javax.annotation.processing.AbstractProcessor; -import javax.annotation.processing.ProcessingEnvironment; -import javax.annotation.processing.RoundEnvironment; -import javax.annotation.processing.SupportedAnnotationTypes; -import javax.lang.model.SourceVersion; -import javax.lang.model.element.Element; -import javax.lang.model.element.ElementKind; -import javax.lang.model.element.ExecutableElement; -import javax.lang.model.element.TypeElement; -import javax.lang.model.type.TypeMirror; - -@SupportedAnnotationTypes("org.projectlombok.testAp.ExampleAnnotation") -public final class TestAp extends AbstractProcessor { - private int roundCounter = 0; - private static final long START = System.currentTimeMillis(); - - private void log(String txt) { - System.out.printf("***[%3d]: %s\n", System.currentTimeMillis() - START, txt); - } - - @Override public void init(ProcessingEnvironment processingEnv) { - log("TestAP in init"); - super.init(processingEnv); - } - - @Override public boolean process(Set annotations, RoundEnvironment roundEnv) { - roundCounter++; - log("TestAP in round " + roundCounter); - boolean foundGetTest = false; - int annotatedElemCount = 0; - for (Element annotated : roundEnv.getElementsAnnotatedWith(ExampleAnnotation.class)) { - annotatedElemCount++; - for (Element child : annotated.getEnclosedElements()) { - if (child.getSimpleName().toString().equals("getTest") && child.getKind() == ElementKind.METHOD) foundGetTest = true; - if (child instanceof ExecutableElement) { - TypeMirror returnType = ((ExecutableElement) child).getReturnType(); - System.out.println("RETURN TYPE for " + child.getSimpleName() + ": " + returnType.getClass() + " -- " + returnType.toString()); - } - } - } - - if (foundGetTest) log("RESULT: POSITIVE -- found the getTest method"); - else if (annotatedElemCount > 0) log("RESULT: NEGATIVE -- found the example class but there's no getTest method in it according to the type mirror."); - else log("RESULT: AMBIVALENT -- The example class is not provided by 'getElementsAnnotatedWith' in this round. Not an issue, unless previously you got a NEGATIVE result."); - - return false; - } - - @Override public SourceVersion getSupportedSourceVersion() { - return SourceVersion.latestSupported(); - } -} diff --git a/src/useTestAP/UseTestAp.java b/src/useTestAP/UseTestAp.java deleted file mode 100644 index 2d7eab7b..00000000 --- a/src/useTestAP/UseTestAp.java +++ /dev/null @@ -1,13 +0,0 @@ -@org.projectlombok.testAp.ExampleAnnotation -//@lombok.experimental.Accessors(chain=true) -public class UseTestAp { - @lombok.Setter @lombok.Getter String test; - - public void confirmGetTestExists() { - System.out.println(getTest()); - } - - public UseTestAp returningSelf() { - return this; - } -} -- cgit From 966852e410cfd99e311eca98cee36c163629949e Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Thu, 25 Jun 2020 23:02:55 +0200 Subject: [bugfix] building would fail due to an invalid reference from src/utils to src/core. --- src/core/lombok/core/handlers/HandlerUtil.java | 9 +-------- src/utils/lombok/core/JavaIdentifiers.java | 11 +++++++++++ src/utils/lombok/eclipse/Eclipse.java | 4 ++-- src/utils/lombok/javac/Javac.java | 4 ++-- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/core/lombok/core/handlers/HandlerUtil.java b/src/core/lombok/core/handlers/HandlerUtil.java index 46ce3825..1c4437d7 100644 --- a/src/core/lombok/core/handlers/HandlerUtil.java +++ b/src/core/lombok/core/handlers/HandlerUtil.java @@ -745,13 +745,6 @@ public class HandlerUtil { return b.toString(); } - /** Matches any of the 8 primitive names, such as {@code boolean}. */ - private static final Pattern PRIMITIVE_TYPE_NAME_PATTERN = Pattern.compile("^(?:boolean|byte|short|int|long|float|double|char)$"); - - public static boolean isPrimitive(String typeName) { - return PRIMITIVE_TYPE_NAME_PATTERN.matcher(typeName).matches(); - } - /** Matches any of the 8 primitive wrapper names, such as {@code Boolean}. */ private static final Pattern PRIMITIVE_WRAPPER_TYPE_NAME_PATTERN = Pattern.compile("^(?:java\\.lang\\.)?(?:Boolean|Byte|Short|Integer|Long|Float|Double|Character)$"); @@ -759,7 +752,7 @@ public class HandlerUtil { // Modification in this code should be documented // 1. In the changelog this should be marked as an INPROBABLE BREAKING CHANGE, since the hashcode will change // 2. In the javadoc of EqualsAndHashcode.Include#rank - if (isPrimitive(typeName)) return 1000; + if (JavaIdentifiers.isPrimitive(typeName)) return 1000; if (PRIMITIVE_WRAPPER_TYPE_NAME_PATTERN.matcher(typeName).matches()) return 800; return 0; } diff --git a/src/utils/lombok/core/JavaIdentifiers.java b/src/utils/lombok/core/JavaIdentifiers.java index cbe90eed..906ae0e1 100644 --- a/src/utils/lombok/core/JavaIdentifiers.java +++ b/src/utils/lombok/core/JavaIdentifiers.java @@ -21,6 +21,8 @@ */ package lombok.core; +import java.util.regex.Pattern; + /** * Utility functions for validating potential java verifiers. */ @@ -54,4 +56,13 @@ public class JavaIdentifiers { public static boolean isKeyword(String keyword) { return KEYWORDS.contains(keyword); } + + /** Matches any of the 8 primitive names, such as {@code boolean}. */ + private static final Pattern PRIMITIVE_TYPE_NAME_PATTERN = Pattern.compile("^(?:boolean|byte|short|int|long|float|double|char)$"); + + public static boolean isPrimitive(String typeName) { + return PRIMITIVE_TYPE_NAME_PATTERN.matcher(typeName).matches(); + } + + } diff --git a/src/utils/lombok/eclipse/Eclipse.java b/src/utils/lombok/eclipse/Eclipse.java index 9ec63c79..31979955 100644 --- a/src/utils/lombok/eclipse/Eclipse.java +++ b/src/utils/lombok/eclipse/Eclipse.java @@ -29,7 +29,7 @@ import java.util.regex.Pattern; import lombok.core.ClassLiteral; import lombok.core.FieldSelect; -import lombok.core.handlers.HandlerUtil; +import lombok.core.JavaIdentifiers; import lombok.permit.Permit; import org.eclipse.jdt.internal.compiler.ast.ASTNode; @@ -164,7 +164,7 @@ public class Eclipse { */ public static boolean isPrimitive(TypeReference ref) { if (ref.dimensions() > 0) return false; - return HandlerUtil.isPrimitive(toQualifiedName(ref.getTypeName())); + return JavaIdentifiers.isPrimitive(toQualifiedName(ref.getTypeName())); } /** diff --git a/src/utils/lombok/javac/Javac.java b/src/utils/lombok/javac/Javac.java index 234c7f73..cec43705 100644 --- a/src/utils/lombok/javac/Javac.java +++ b/src/utils/lombok/javac/Javac.java @@ -57,7 +57,7 @@ import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; import lombok.core.ClassLiteral; import lombok.core.FieldSelect; -import lombok.core.handlers.HandlerUtil; +import lombok.core.JavaIdentifiers; import lombok.javac.JavacTreeMaker.TreeTag; import lombok.javac.JavacTreeMaker.TypeTag; import lombok.permit.Permit; @@ -133,7 +133,7 @@ public class Javac { * expression) represents a primitive type. */ public static boolean isPrimitive(JCExpression ref) { - return HandlerUtil.isPrimitive(ref.toString()); + return JavaIdentifiers.isPrimitive(ref.toString()); } /** -- cgit