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

  <parent>
    <groupId>com.hubspot</groupId>
    <artifactId>boomslang-parent</artifactId>
    <version>0.1.1</version>
  </parent>

  <artifactId>boomslang</artifactId>
  <name>${project.groupId}:${project.artifactId}</name>

  <dependencies>
    <dependency>
      <groupId>com.dylibso.chicory</groupId>
      <artifactId>runtime</artifactId>
    </dependency>
    <dependency>
      <groupId>com.dylibso.chicory</groupId>
      <artifactId>wasi</artifactId>
    </dependency>
    <dependency>
      <groupId>com.dylibso.chicory</groupId>
      <artifactId>wasm</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
    </dependency>

    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <excludes>
          <exclude>python/stdlib.zip</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>package-no-python-runtime</id>
            <goals>
              <goal>jar</goal>
            </goals>
            <phase>package</phase>
            <configuration>
              <classifier>no-python-runtime</classifier>
              <excludes>
                <exclude>python/**</exclude>
                <exclude>python-overlay/**</exclude>
                <exclude>com/hubspot/boomslang/compiled/**</exclude>
              </excludes>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>aot</id>
      <activation>
        <file>
          <exists>${basedir}/src/main/resources/python/bin/boomslang.wasm</exists>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>com.dylibso.chicory</groupId>
            <artifactId>chicory-compiler-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>compile-python-wasm</id>
                <goals>
                  <goal>compile</goal>
                </goals>
                <configuration>
                  <wasmFile>src/main/resources/python/bin/boomslang.wasm</wasmFile>
                  <name>com.hubspot.boomslang.compiled.PythonWasm</name>
                  <interpreterFallback>WARN</interpreterFallback>
                  <targetSourceFolder>${project.build.directory}/generated-sources/annotations</targetSourceFolder>
                  <targetClassFolder>${project.build.outputDirectory}</targetClassFolder>
                  <targetWasmFolder>${project.build.outputDirectory}</targetWasmFolder>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
