<?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>
	<parent>
		<groupId>dev.openfeature.contrib</groupId>
		<artifactId>parent</artifactId>
		<version>0.0.2</version>
		<relativePath>../../pom.xml</relativePath>
	</parent>
	<groupId>dev.openfeature.contrib.providers</groupId>
	<artifactId>flagd</artifactId>
	<version>0.3.2</version> <!--x-release-please-version -->

	<name>flagd</name>
	<description>FlagD provider for Java</description>
	<url>https://openfeature.dev</url>

	<developers>
		<developer>
			<id>toddbaert</id>
			<name>Todd Baert</name>
			<organization>OpenFeature</organization>
			<url>https://openfeature.dev/</url>
		</developer>
	</developers>

	<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>