<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright © 2018-2025 Commonwealth Scientific and Industrial Research
  ~ Organisation (CSIRO) ABN 41 687 119 230.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>au.csiro.pathling</groupId>
    <artifactId>pathling</artifactId>
    <version>9.2.0</version>
    <relativePath>../pom.xml</relativePath>
  </parent>
  <artifactId>site</artifactId>
  <packaging>jar</packaging>

  <name>Pathling Site</name>
  <description>A website that contains documentation for Pathling.</description>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>install</id>
            <phase>initialize</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>bun</executable>
              <arguments>
                <argument>install</argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>build</id>
            <phase>compile</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>bun</executable>
              <arguments>
                <argument>run</argument>
                <argument>build</argument>
              </arguments>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <classesDirectory>${project.build.directory}/site</classesDirectory>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
          <filesets>
            <fileset>
              <directory>${project.basedir}</directory>
              <includes>
                <include>.docusaurus/**</include>
                <include>build/**</include>
              </includes>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>docs</id>
      <dependencies>
        <!-- This is the javadoc JAR that is built by the library-runtime module. -->
        <dependency>
          <groupId>au.csiro.pathling</groupId>
          <artifactId>library-api</artifactId>
          <classifier>javadoc</classifier>
        </dependency>
        <!-- This is the docs JAR that is built by the Python API module. -->
        <dependency>
          <groupId>au.csiro.pathling</groupId>
          <artifactId>python</artifactId>
          <classifier>docs</classifier>
        </dependency>
        <!-- This is the docs JAR that is built by the R API module. -->
        <dependency>
          <groupId>au.csiro.pathling</groupId>
          <artifactId>r</artifactId>
          <classifier>docs</classifier>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>unpack-java-docs</id>
                <phase>package</phase>
                <goals>
                  <goal>unpack-dependencies</goal>
                </goals>
                <configuration>
                  <includeGroupIds>au.csiro.pathling</includeGroupIds>
                  <includeArtifactIds>library-api</includeArtifactIds>
                  <includeClassifiers>javadoc</includeClassifiers>
                  <excludeTransitive>true</excludeTransitive>
                  <outputDirectory>${project.build.directory}/site/docs/java</outputDirectory>
                </configuration>
              </execution>
              <execution>
                <id>unpack-python-docs</id>
                <phase>package</phase>
                <goals>
                  <goal>unpack-dependencies</goal>
                </goals>
                <configuration>
                  <includeGroupIds>au.csiro.pathling</includeGroupIds>
                  <includeArtifactIds>python</includeArtifactIds>
                  <excludeTransitive>true</excludeTransitive>
                  <outputDirectory>${project.build.directory}/site/docs/python</outputDirectory>
                </configuration>
              </execution>
              <execution>
                <id>unpack-r-docs</id>
                <phase>package</phase>
                <goals>
                  <goal>unpack-dependencies</goal>
                </goals>
                <configuration>
                  <includeGroupIds>au.csiro.pathling</includeGroupIds>
                  <includeArtifactIds>r</includeArtifactIds>
                  <excludeTransitive>true</excludeTransitive>
                  <outputDirectory>${project.build.directory}/site/docs/r</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <configuration>
              <skip>true</skip>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>licenses</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-license</id>
                <phase>package</phase>
                <configuration>
                  <outputDirectory>${project.basedir}</outputDirectory>
                  <skip>true</skip>
                </configuration>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
