<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 http://maven.apache.org/maven-v4_0_0.xsd">

  <parent>
    <groupId>org.gosu-lang.gosu</groupId>
    <artifactId>gosu-parent</artifactId>
    <version>1.18.13</version>
    <relativePath>../gosu-parent/pom.xml</relativePath>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  
  <artifactId>gosu-doc</artifactId>
  
  <name>Gosu :: Gosudoc</name>
  <description>Generates Javadoc-compatible documentation for Gosu projects</description>

  <dependencies>
    <dependency>
      <groupId>org.gosu-lang.gosu</groupId>
      <artifactId>gosu-core-api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.gosu-lang.gosu</groupId>
      <artifactId>gosu-core</artifactId>
      <version>${project.version}</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jsoup</groupId>
      <artifactId>jsoup</artifactId>
      <version>1.18.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <!-- reset source/test roots to defaults, before adding src/main/gosu and src/test/gosu using build-helper-maven-plugin -->
    <sourceDirectory>src/main/java</sourceDirectory>
    <testSourceDirectory>src/test/gosu</testSourceDirectory>
    <!-- the parent pom sets src/test/gosu as a resource root; if we don't undo this as below, all the tests will be copied to target/classes and packaged into the jar -->
    <resources>
      <resource>
        <directory>src/test/gosu</directory>
        <excludes>
          <exclude>**/*</exclude>
        </excludes>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/main/gosu</source>
              </sources>
            </configuration>
          </execution>
          <execution>
            <id>add-test-source</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>add-test-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/test/gosu</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
          <execution>
            <id>Compile Gosu sources</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
            <configuration>
              <compilerId>gosuc</compilerId>
              <compilerArgs>
                <arg>--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED</arg>
                <arg>--add-exports=jdk.javadoc/jdk.javadoc.internal.doclets.toolkit=ALL-UNNAMED</arg>
                <arg>--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
                <arg>--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
                <arg>--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
              </compilerArgs>
            </configuration>
          </execution>
          <execution>
            <id>Compile Gosu test sources</id>
            <phase>test-compile</phase>
            <goals>
              <goal>testCompile</goal>
            </goals>
            <configuration>
              <compilerId>gosuc</compilerId>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.gosu-lang.gosu</groupId>
            <artifactId>gosu-maven-compiler</artifactId>
            <version>${project.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <source>11</source>
          <target>11</target>
          <encoding>UTF-8</encoding>
          <compilerArgs>
            <arg>--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED</arg>
            <arg>--add-exports=jdk.javadoc/jdk.javadoc.internal.doclets.formats.html=ALL-UNNAMED</arg>
            <arg>--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
            <arg>--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
            <arg>--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
            <arg>--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
            <arg>--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
            <arg>--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
            <arg>--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
            <arg>--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
            <arg>--add-exports=jdk.compiler/com.sun.tools.javac.platform=ALL-UNNAMED</arg>
            <arg>--add-exports=jdk.compiler/com.sun.tools.doclint=ALL-UNNAMED</arg>
            <arg>--add-exports=java.base/sun.reflect.annotation=ALL-UNNAMED</arg>
          </compilerArgs>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <archive>
            <manifest>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            </manifest>
            <manifestEntries>
              <Contains-Sources>gs, gsx, gst</Contains-Sources>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.2.1</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>
