<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you 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 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.apache.seatunnel</groupId>
    <artifactId>seatunnel-engine</artifactId>
    <version>2.3.13</version>
  </parent>
  <groupId>org.apache.seatunnel</groupId>
  <artifactId>seatunnel-engine-ui</artifactId>
  <version>2.3.13</version>
  <name>SeaTunnel : Engine : UI</name>
  <licenses>
    <license>
      <name>The Apache License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>
  <properties>
    <deployed.dir>.deployed</deployed.dir>
    <dist.dir>../seatunnel-engine-server/src/main/resources/ui</dist.dir>
    <nodemodules.dir>node_modules</nodemodules.dir>
    <build.npm.version>8.1.2</build.npm.version>
    <skip.ui>false</skip.ui>
    <build.node.version>v16.13.2</build.node.version>
  </properties>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>3.1.0</version>
        <executions>
          <execution>
            <id>clean-rmdir</id>
            <phase>clean</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>${executable.rmdir}</executable>
              <workingDirectory>${basedir}</workingDirectory>
              <commandlineArgs>${args.rm.clean} ${dist.dir} ${nodemodules.dir} ${deployed.dir}</commandlineArgs>
              <successCodes>
                <successCode>0</successCode>
              </successCodes>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <version>1.10.3</version>
        <executions>
          <execution>
            <id>install node and npm</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>install-node-and-npm</goal>
            </goals>
          </execution>
          <execution>
            <id>npm install</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>npm</goal>
            </goals>
            <configuration>
              <arguments>install</arguments>
            </configuration>
          </execution>
          <execution>
            <id>npm run build</id>
            <phase>package</phase>
            <goals>
              <goal>npm</goal>
            </goals>
            <configuration>
              <arguments>run build</arguments>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <nodeVersion>${build.node.version}</nodeVersion>
          <npmVersion>${build.npm.version}</npmVersion>
          <skip>${skip.ui}</skip>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>windows</id>
      <activation>
        <os>
          <family>win</family>
        </os>
      </activation>
      <properties>
        <executable.npm>cmd</executable.npm>
        <executable.mkdir>cmd</executable.mkdir>
        <executable.rmdir>cmd</executable.rmdir>
        <executable.gzip>${basedir}\gzip-content.cmd</executable.gzip>
        <args.npm>/C npm</args.npm>
        <args.rm.clean>/C if exist "${dist.dir}" rmdir /S /Q "${dist.dir}" &amp;
                    if exist "${nodemodules.dir}" rmdir /S /Q "${nodemodules.dir}" &amp;
                    if exist "${deployed.dir}" rmdir /S /Q "${deployed.dir}"</args.rm.clean>
        <executable.brunch>cmd</executable.brunch>
        <args.shell>/C</args.shell>
        <envClassifier>win</envClassifier>
        <fileextension.shell>cmd</fileextension.shell>
        <dirsep>\</dirsep>
        <executable.shell>cmd</executable.shell>
        <args.mkdir>/C mkdir</args.mkdir>
        <node.executable>node.exe</node.executable>
        <args.brunch>/C brunch</args.brunch>
      </properties>
    </profile>
    <profile>
      <id>linux</id>
      <activation>
        <os>
          <family>unix</family>
        </os>
      </activation>
      <properties>
        <executable.npm>npm</executable.npm>
        <executable.mkdir>mkdir</executable.mkdir>
        <executable.rmdir>rm</executable.rmdir>
        <executable.gzip>gzip</executable.gzip>
        <args.npm></args.npm>
        <args.rm.clean>-rf ${dist.dir} ${nodemodules.dir} ${deployed.dir}</args.rm.clean>
        <executable.brunch>brunch</executable.brunch>
        <args.shell></args.shell>
        <envClassifier>linux</envClassifier>
        <fileextension.shell>sh</fileextension.shell>
        <dirsep>/</dirsep>
        <executable.shell>sh</executable.shell>
        <args.mkdir></args.mkdir>
        <node.executable>node</node.executable>
        <args.brunch></args.brunch>
      </properties>
    </profile>
  </profiles>
</project>
