<?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" child.project.url.inherit.append.path="false" 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>io.airlift</groupId>
        <artifactId>airbase</artifactId>
        <version>202</version>
    </parent>

    <groupId>io.trino</groupId>
    <artifactId>trino-wasm-python</artifactId>
    <version>3.13-2</version>
    <packaging>jar</packaging>

    <name>${project.artifactId}</name>
    <description>WebAssembly Python host for Trino</description>
    <url>https://trino.io</url>

    <inceptionYear>2024</inceptionYear>

    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git://github.com/trinodb/trino-wasm-python.git</connection>
        <developerConnection>scm:git:git@github.com:trinodb/trino-wasm-python.git</developerConnection>
        <tag>3.13-2</tag>
        <url>https://github.com/trinodb/trino-wasm-python</url>
    </scm>

    <properties>
        <project.build.targetJdk>21</project.build.targetJdk>
        <air.maven.version>3.8.8</air.maven.version>
        <air.check.skip-spotbugs>true</air.check.skip-spotbugs>
        <air.check.skip-pmd>true</air.check.skip-pmd>
        <air.check.skip-jacoco>true</air.check.skip-jacoco>
        <air.javadoc.lint>all,-missing</air.javadoc.lint>
        <air.release.preparation-goals>clean verify -DskipTests</air.release.preparation-goals>

        <dep.chicory.version>1.0.0-M2</dep.chicory.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.dylibso.chicory</groupId>
                <artifactId>bom</artifactId>
                <version>1.0.0-M2</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.dylibso.chicory</groupId>
            <artifactId>runtime</artifactId>
        </dependency>

        <dependency>
            <groupId>com.dylibso.chicory</groupId>
            <artifactId>wasm</artifactId>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <failIfNoTests>false</failIfNoTests>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.5.0</version>
                <configuration>
                    <executable>${project.basedir}/build.sh</executable>
                    <arguments>
                        <argument>${wasmDebug}</argument>
                    </arguments>
                </configuration>
                <executions>
                    <execution>
                        <id>build-wasm</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>generate-sources</phase>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.dylibso.chicory</groupId>
                <artifactId>aot-maven-plugin-experimental</artifactId>
                <version>${dep.chicory.version}</version>
                <executions>
                    <execution>
                        <id>aot-python</id>
                        <goals>
                            <goal>wasm-aot-gen</goal>
                        </goals>
                        <configuration>
                            <name>io.trino.wasm.python.Python</name>
                            <wasmFile>${project.build.directory}/wasm/python-host-opt.wasm</wasmFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>wasm-debug</id>
            <properties>
                <wasmDebug>--debug</wasmDebug>
            </properties>
        </profile>
    </profiles>
</project>
