|
| 1 | +# Contributing |
| 2 | + |
| 3 | +## System Requirements |
| 4 | + |
| 5 | +Java 18 is recommended for the tooling, plugins, etc. Maven 3.8+ is recommended. |
| 6 | + |
| 7 | +## Compilation target(s) |
| 8 | + |
| 9 | +As in the Java-SDK, we target Java 8. The parent POM configures this automatically. |
| 10 | + |
| 11 | +## Adding a module |
| 12 | + |
| 13 | +1. Create a [standard directory structure](https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html) in the appropriate folder (`hooks/`, `providers/`). |
| 14 | +1. Create a new `pom.xml` in the root of your new module. It must inherit from the parent POM, which implements the javadoc, testing, publishing, and other boilerplate. Be sure to add `<!--x-release-please-version -->` on the line specifying the module version, so our release tooling can update it (see sample pom below). |
| 15 | +1. Add the new package to `release-please-config.json`. |
| 16 | +1. Add the new module to the `<modules>...</modules>` section in the parent `pom.xml`. |
| 17 | +1. Add a `version.txt` file with a version matching that in your new `pom.xml`, e.g. `0.0.1`. |
| 18 | +1. If you care to release a pre 1.0.0 version, add the same version above to `.release-please-manifest.json`. Failing to do this will release a `1.0.0` initial release. |
| 19 | + |
| 20 | +Sample pom.xml: |
| 21 | + |
| 22 | +```xml |
| 23 | +<?xml version="1.0" encoding="UTF-8"?> |
| 24 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| 25 | + <modelVersion>4.0.0</modelVersion> |
| 26 | + <modelVersion>4.0.0</modelVersion> |
| 27 | + <parent> |
| 28 | + <groupId>dev.openfeature.contrib</groupId> |
| 29 | + <artifactId>parent</artifactId> |
| 30 | + <version><!-- current parent pom version --></version> |
| 31 | + <relativePath>../../pom.xml</relativePath> |
| 32 | + </parent> |
| 33 | + <!-- The group id MUST start with dev.openfeature, or publishing will fail. OpenFeature has verified ownership of this (reversed) domain. --> |
| 34 | + <groupId>dev.openfeature.contrib.${providers | hooks | etc}</groupId> |
| 35 | + <artifactId>module</artifactId> |
| 36 | + <version>0.0.1</version> <!--x-release-please-version --> |
| 37 | + |
| 38 | + <name>module</name> |
| 39 | + <description>Your module description</description> |
| 40 | + <url>https://openfeature.dev</url> |
| 41 | + |
| 42 | + <developers> |
| 43 | + <developer> |
| 44 | + <id>Your GitHub ID</id> |
| 45 | + <name>Your Name</name> |
| 46 | + <organization>OpenFeature</organization> |
| 47 | + <url>https://openfeature.dev/</url> |
| 48 | + </developer> |
| 49 | + </developers> |
| 50 | + |
| 51 | + <dependencies> |
| 52 | + <!-- dependencies your module needs (in addition to those inherited from parent) --> |
| 53 | + </dependencies> |
| 54 | + |
| 55 | + <build> |
| 56 | + <plugins> |
| 57 | + <!-- plugins your module needs (in addition to those inherited from parent) --> |
| 58 | + </plugins> |
| 59 | + </build> |
| 60 | + |
| 61 | +</project> |
| 62 | +``` |
| 63 | + |
| 64 | +## Documentation |
| 65 | + |
| 66 | +Any published modules must have documentation in their root directory, explaining the basic purpose of the module as well as installation and usage instructions. |
| 67 | +Instructions for how to develop a module should also be included (required system dependencies, instructions for testing locally, etc). |
| 68 | + |
| 69 | +## Testing |
| 70 | + |
| 71 | +Any published modules must have reasonable test coverage. |
| 72 | +The parent POM adds basic testing support for you. |
| 73 | + |
| 74 | +Use `mvn clean test` to test the entire project. |
| 75 | +Use `mvn --projects {MODULE PATH} clean test` to test just a single module. |
| 76 | + |
| 77 | +Use `mvn clean verify` to test/audit/lint the entire project. |
| 78 | +Use `mvn --projects {MODULE PATH} clean verify` to test/audit/lint just a single module. |
| 79 | + |
| 80 | +## Versioning and releasing |
| 81 | + |
| 82 | +As described in the [README](./README.md), this project uses release-please, and semantic versioning. |
| 83 | +Breaking changes should be identified by using a semantic PR title. |
| 84 | +Keep in mind, one version of the Java-SDK is used for all modules. |
| 85 | + |
| 86 | +### VS Code config |
| 87 | + |
| 88 | +To use vscode, install the standard [Java language support extension by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java). |
| 89 | + |
| 90 | +The following vscode settings are recommended (create a workspace settings file at .vscode/settings.json): |
| 91 | + |
| 92 | +```json |
| 93 | +{ |
| 94 | + "java.configuration.updateBuildConfiguration": "interactive", |
| 95 | + "java.autobuild.enabled": false, |
| 96 | + "java.checkstyle.configuration": "${workspaceFolder}/checkstyle.xml", |
| 97 | + "java.checkstyle.version": "10.3.2", |
| 98 | + "java.format.settings.url": "${workspaceFolder}/eclipse-java-google-style.xml", |
| 99 | + "java.format.enabled": false |
| 100 | +} |
| 101 | +``` |
0 commit comments