<?xml version="1.0" encoding="US-ASCII"?>
<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">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.harctoolbox</groupId>
    <artifactId>IrpTransmogrifier</artifactId>
    <packaging>jar</packaging>
    <version>1.2.3</version>
    <name>${project.artifactId}</name>
    <licenses>
        <license>
            <name>GPL 3+</name>
            <url>https://www.gnu.org/licenses/gpl.html</url>
        </license>
    </licenses>
    <description>Parser for IRP notation protocols, with rendering, code generation, recognition applications.</description>
    <url>http://www.harctoolbox.org</url>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.nameLowercase>irptransmogrifier</project.nameLowercase>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <developers>
        <developer>
            <name>Bengt Martensson</name>
            <email>barf@bengt-martensson.de</email>
            <url>http://www.bengt-martensson.de</url>
            <roles>
                <role>Project leader and architect</role>
                <role>Developer</role>
            </roles>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com:bengtmartensson/IrpTransmogrifier.git</connection>
        <developerConnection>scm:git:ssh://github.com:bengtmartensson/IrpTransmogrifier.git</developerConnection>
        <url>https://github.com/bengtmartensson/IrpTransmogrifier/tree/master</url>
    </scm>

    <issueManagement>
        <system>GitHub Issues</system>
        <url>https://github.com/bengtmartensson/harctoolboxbundle/issues</url>
    </issueManagement>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/xdocs</directory>
            </resource>
            <resource>
                <directory>src/main/schemas</directory>
            </resource>
        </resources>
        <plugins><!-- Generate Version.java from Version.xml using mkVersion.xsl. -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>xml-maven-plugin</artifactId>
                <version>1.0.2</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>transform</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <transformationSets>
                        <transformationSet>
                            <dir>src/main/xml</dir>
                            <outputDir>${project.build.directory}/generated-sources/xml/org/harctoolbox/irp</outputDir>
                            <includes>
                                <include>Version.xml</include>
                            </includes>
                            <stylesheet>${project.build.directory}/../tools/mkVersion.xsl</stylesheet>
                            <parameters>
                                <parameter>
                                    <name>version</name>
                                    <value>${project.version}</value>
                                </parameter>
                                <parameter>
                                    <name>url</name>
                                    <value>${project.url}</value>
                                </parameter>
                                <parameter>
                                    <name>appName</name>
                                    <value>${project.artifactId}</value>
                                </parameter>
                            </parameters>
                            <fileMappers>
                                <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
                                    <targetExtension>.java</targetExtension>
                                </fileMapper>
                            </fileMappers>
                        </transformationSet>
                        <transformationSet>
                            <dir>src/main/resources</dir>
                            <outputDir>${project.build.directory}</outputDir>
                            <includes>
                                <include>IrpProtocols.xml</include>
                            </includes>
                            <stylesheet>src/main/resources/IrpProtocols2html.xsl</stylesheet>
                            <fileMappers>
                                <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
                                    <targetExtension>.html</targetExtension>
                                </fileMapper>
                            </fileMappers>
                        </transformationSet>
                        <transformationSet>
                            <dir>src/main/resources</dir>
                            <outputDir>${project.build.directory}</outputDir>
                            <includes>
                                <include>IrpProtocols.xml</include>
                            </includes>
                            <stylesheet>src/main/resources/IrpProtocols2md.xsl</stylesheet>
                            <fileMappers>
                                <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
                                    <targetExtension>.md</targetExtension>
                                </fileMapper>
                            </fileMappers>
                        </transformationSet>
                        <transformationSet>
                            <xincludeAware>true</xincludeAware>
                            <dir>src/main/xdocs</dir>
                            <outputDir>${project.build.directory}/generated-documents</outputDir>
                            <includes>
                                <include>${project.name}.xml</include>
                            </includes>
                            <stylesheet>tools/xdoc2html.xsl</stylesheet>
                            <fileMappers>
                                <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
                                    <targetExtension>.html</targetExtension>
                                </fileMapper>
                            </fileMappers>
                        </transformationSet>
                    </transformationSets>

                    <!-- Uncomment to use local versions of the schemas/DTDs -->
                    <!--catalogs>
                        <catalog>../schemas/catalog.xml</catalog>
                    </catalogs-->
                </configuration>

                <dependencies>
                    <dependency>
                        <groupId>xalan</groupId>
                        <artifactId>xalan</artifactId>
                        <version>2.7.2</version>
                    </dependency>
                </dependencies>
            </plugin>

            <!-- Generate target/generated-sources/antlr4/org/harctoolbox/IrpMaster/TODO[Parser,Lexer].java from
            src/main/antrlr4/Irp.g4 -->
            <plugin>
                <groupId>org.antlr</groupId>
                <artifactId>antlr4-maven-plugin</artifactId>
                <version>4.7.2</version>
                <executions>
                    <execution>
                        <id>antlr</id>
                        <goals>
                            <goal>antlr4</goal>
                        </goals>
                        <configuration>
                            <atn>true</atn>
                            <listener>true</listener>
                            <visitor>true</visitor>
                            <treatWarningsAsErrors>true</treatWarningsAsErrors>
                        </configuration>
                    </execution>

                </executions>
            </plugin>

            <!-- Binary tarballs from src/assembly*/ files. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.1.1</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>org.harctoolbox.irp.IrpTransmogrifier</mainClass>
                        </manifest>
                    </archive>
                    <!--finalName>${project.name}</finalName-->
                    <!--appendAssemblyId>true</appendAssemblyId-->
                    <descriptors>
                        <descriptor>src/assembly/jar-with-dependencies.xml</descriptor>
                        <descriptor>src/assembly/target.xml</descriptor>
                    </descriptors>
                    <!--descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                        <descriptorRef>bin</descriptorRef>
                    </descriptorRefs-->
                </configuration>
                <executions>
                    <execution>
                        <id>exec-bin</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <!-- Copy resources  in src/main/config to target dir. -->
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/config</directory>
                                    <filtering>true</filtering>
                                </resource>
                                <resource>
                                    <directory>src/main/resources</directory>
                                    <includes>
                                        <include>IrpProtocols.xml</include>
                                        <include>IrpProtocols2html.xsl</include>
                                    </includes>
                                    <filtering>false</filtering>
                                </resource>
                                <resource>
                                    <directory>src/main/xdocs</directory>
                                    <filtering>false</filtering>
                                    <includes>
                                        <include>${project.name}.xml</include>
                                    </includes>
                                </resource>
                                <resource>
                                    <directory>src/main/schemas</directory>
                                    <includes>
                                        <include>irp-protocols.xsd</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-resources-st</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/st</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/st</directory>
                                    <filtering>false</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-resources-xslt</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/xslt</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/xslt</directory>
                                    <filtering>false</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-remote-resources-plugin</artifactId>
                <version>1.6.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>bundle</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <resourcesDirectory>target</resourcesDirectory> <!-- Pretty awful, use while only one resourcesDirectory permitted -->
                    <includes>
                        <include>IrpProtocols.xml</include>
                        <include>IrpProtocols2html.xsl</include>
                        <include>IrpTransmogrifier.xml</include>
                        <include>irp-protocols.xsd</include>
                    </includes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-sources/xml</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <skipTests>false</skipTests>
                    <argLine>-Dfile.encoding=${project.build.sourceEncoding}</argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>net.nicoulaj.maven.plugins</groupId>
                <artifactId>checksum-maven-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>files</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <fileSets>
                        <fileSet>
                            <directory>${project.build.directory}</directory>
                            <includes>
                                <include>*.zip</include>
                            </includes>
                        </fileSet>
                    </fileSets>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.1.1</version>
                        <configuration>
                            <outputDirectory>${project.build.directory}/apidocs</outputDirectory>
                            <show>package</show> <!-- Document also package private classes -->
                            <aggregate>true</aggregate>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.2.0</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.8</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>buildSetup.exe</id>
            <activation>
                <file>
                    <exists>/usr/bin/chmod</exists> <!-- good enough for now :-) -->
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>1.6.0</version>
                        <executions>
                            <execution>
                                <id>make-wrapper-executable</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>chmod</executable>
                                    <workingDirectory>${project.build.directory}</workingDirectory>
                                    <arguments>
                                        <argument>0755</argument>
                                        <argument>${project.nameLowercase}.sh</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>org.antlr</groupId>
            <artifactId>antlr4</artifactId>
            <version>4.7.2</version>
            <exclusions>
                <exclusion>
                    <groupId>com.ibm.icu</groupId>
                    <artifactId>icu4j</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.glassfish</groupId>
                    <artifactId>javax.json</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.abego.treelayout</groupId>
                    <artifactId>org.abego.treelayout.core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.antlr</groupId>
            <artifactId>ST4</artifactId>
            <version>4.1</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.beust</groupId>
            <artifactId>jcommander</artifactId>
            <scope>compile</scope>
            <version>1.72</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.14.3</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
