Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "providers/flagd/schemas"]
path = providers/flagd/schemas
url = https://github.com/open-feature/schemas.git
76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,82 @@ The project includes:

This repo uses _Release Please_ to release packages. Release Please sets up a running PR that tracks all changes for the library components, and maintains the versions according to [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/), generated when [PRs are merged](https://github.com/amannn/action-semantic-pull-request). When Release Please's running PR is merged, any changed artifacts are published.

## Developing

### Requirements

Though we target Java 8, Java 18 is recommended for the tooling, plugins, etc. Maven 3.8+ is recommended.

### Testing

Run `mvn verify` to test, generate javadoc, and check style. If this passes locally, the CI will generally pass.

### Adding a module

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/`).
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).
1. Add the new package to `release-please-config.json`.
1. Add the new module to the <modules>...</modules> section in the parent `pom.xml`.

Sample pom.xml:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>dev.openfeature.contrib</groupId>
<artifactId>java-sdk-contrib</artifactId>
<version>0.0.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<groupId>dev.openfeature.contrib.${providers | hooks | etc}</groupId>
<artifactId>module</artifactId>
<version>0.0.1</version> <!--x-release-please-version -->

<name>module</name>
<description>Your module description</description>
<url>https://openfeature.dev</url>

<developers>
<developer>
<id>Your GitHub ID</id>
<name>Your Name</name>
<organization>OpenFeature</organization>
<url>https://openfeature.dev/</url>
</developer>
</developers>

<dependencies>
<!-- dependencies your module needs (in addition to those inherited from parent) -->
</dependencies>

<build>
<plugins>
<!-- plugins your module needs (in addition to those inherited from parent) -->
</plugins>
</build>

</project>
```

### VS Code config

To use vscode, install the standard [Java language support extension by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java).

The following vscode settings are recommended (create a workspace settings file at .vscode/settings.json):

```json
{
"java.configuration.updateBuildConfiguration": "interactive",
"java.autobuild.enabled": false,
"java.checkstyle.configuration": "${workspaceFolder}/checkstyle.xml",
"java.checkstyle.version": "10.3.2",
"java.format.settings.url": "${workspaceFolder}/eclipse-java-google-style.xml",
"java.format.enabled": false
}
```

## License

Apache 2.0 - See [LICENSE](./LICENSE) for more information.
8 changes: 8 additions & 0 deletions checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0"?>

<!DOCTYPE suppressions PUBLIC "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN" "https://checkstyle.org/dtds/suppressions_1_2.dtd">

<suppressions>
<!-- don't check style of generated sources (GRPC bindings) -->
<suppress files="[\\/]generated-sources[\\/]" checks="[a-zA-Z0-9]*" />
</suppressions>
397 changes: 207 additions & 190 deletions checkstyle.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public OpenTelemetryHook() {

/**
* A test method...
*
* @return {boolean}
*/
public static boolean test() {
Expand Down
24 changes: 20 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,23 @@

<dependencies>
<dependency>
<!-- provided -->
<groupId>dev.openfeature</groupId>
<artifactId>javasdk</artifactId>
<version>0.0.3</version>
<!-- 0.1.0 or greater -->
<version>[0.1,)</version>
<!-- use the version provided at runtime -->
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<scope>provided</scope>
</dependency>
<!-- end provided -->

<!-- test -->
<dependency>
<groupId>org.mockito</groupId>
Expand Down Expand Up @@ -86,6 +98,7 @@
<version>1.8.1</version>
<scope>test</scope>
</dependency>
<!-- end test -->
</dependencies>

<build>
Expand Down Expand Up @@ -119,13 +132,13 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.31</version>
<version>10.3.2</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
Expand All @@ -136,7 +149,9 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<excludeRoots>${basedir}/target/generated-sources/</excludeRoots>
</configuration>
<executions>
<execution>
<id>run-pmd</id>
Expand Down Expand Up @@ -221,6 +236,7 @@
<version>3.4.0</version>
<configuration>
<failOnWarnings>true</failOnWarnings>
<excludePackageNames>dev.openfeature.flagd.grpc</excludePackageNames>
</configuration>
<executions>
<execution>
Expand Down
96 changes: 96 additions & 0 deletions providers/flagd/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,102 @@

<dependencies>
<!-- we inherent dev.openfeature.javasdk and the test dependencies from the parent pom -->

<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
<version>1.48.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.48.1</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.48.1</version>
</dependency>
<dependency>
<!-- necessary for Java 9+ -->
<groupId>org.apache.tomcat</groupId>
<artifactId>annotations-api</artifactId>
<version>6.0.53</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<!-- required for protobuf generation -->
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.6.2</version>
</extension>
</extensions>

<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>update-schemas-submodule</id>
<phase>validate</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<!-- run: git submodule update \-\-init \-\-recursive -->
<executable>git</executable>
<arguments>
<argument>submodule</argument>
<argument>update</argument>
<argument>--init</argument>
<argument>--recursive</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>copy-protobuf-definition</id>
<phase>validate</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<!-- run: cp schemas/protobuf/schema/v1/schema.proto src/main/proto/ -->
<executable>cp</executable>
<arguments>
<argument>schemas/protobuf/schema/v1/schema.proto</argument>
<argument>src/main/proto/</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.1</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.21.1:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.48.1:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
1 change: 1 addition & 0 deletions providers/flagd/schemas
Submodule schemas added at 910fa3
Loading