<!--
 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.

-->
<!--
Usage notes:

To build NTEventLogAppender.dll using MinGW, place mingw\bin on path for Windows or install mingw
package on other platforms.  Build will execute gcc and windres on Windows and
i586-mingw32msvc-gcc and i586-mingw32msvc-windres on other platforms.

To build NTEventLogAppender.dll using Microsoft tools, run the appropriate vcvars for the
target platform and specify -Dntdll_target=msbuild on the mvn command line.

-->
<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>
  <parent>
      <groupId>org.apache.log4j</groupId>
      <artifactId>log4j-modules</artifactId>
      <version>1.4.0-SNAPSHOT</version>
  </parent>
  <groupId>org.apache.log4j</groupId>
  <artifactId>log4j-nt</artifactId>
  <name>Apache Log4j-Windows NT Event Log Appender</name>
  <packaging>bundle</packaging>

  <properties>
    <tools.jar>${java.home}/../Classes/classes.jar</tools.jar>
    <m2_repo>${user.home}/.m2/repository</m2_repo>
    <ntdll_target>build</ntdll_target>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.apache.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <version>${project.version}</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.2</version>
        <executions>
          <!--   generate NTEventLogAppender.dll    -->
          <execution>
            <phase>process-classes</phase>
            <id>ntdll</id>
            <configuration>
              <tasks>
                <ant antfile="src/ntdll/build.xml" target="${ntdll_target}">
                  <property name="target.dir" location="target" />
                  <property name="classes.dir" location="target/classes" />
                  <property name="src.dir" location="src/ntdll" />
                  <property name="jni.include.dir" location="${java.home}/../include" />
                </ant>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <!--   create tests/output prior to test run    -->
          <execution>
            <phase>test-compile</phase>
            <id>mkdir_tests_output</id>
            <configuration>
              <tasks>
                <mkdir dir="tests/output" />
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <execution>
            <phase>clean</phase>
            <id>rmdir_tests_output</id>
            <configuration>
              <tasks>
                <delete dir="tests/output" />
                <delete dir="tests/classes" />
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <execution>
            <phase>test</phase>
            <id>runAll</id>
            <configuration>
              <tasks>
                 <ant dir="tests" target="runAll">
                  <property name="m2_repo" location="${m2_repo}" />
                  <property name="log4j.jar" location="target/classes" />
                  <property name="project.lib.home" location="target" />
                </ant>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <!--   release builds will put SVN tags into the SCM page, this changes it back to trunk  -->
          <execution>
            <phase>site</phase>
            <id>untag-site</id>
            <configuration>
              <tasks>
                <taskdef name="replaceregexp" classname="org.apache.tools.ant.taskdefs.optional.ReplaceRegExp" />
                <replaceregexp file="target/site/source-repository.html" match="/tags/[^ &quot;'&lt;]*" replace="/trunk" flags="g" />
                <replaceregexp match="-- Generated by (.*) on .*--" replace="-- Generated by \1 --" flags="g">
                  <fileset dir="target/site/apidocs" includes="**/*.html" />
                </replaceregexp>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <execution>
            <phase>post-site</phase>
            <id>post-site</id>
            <configuration>
              <tasks>
                <ant target="post-site" />
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <execution>
            <phase>site-deploy</phase>
            <id>site-deploy</id>
            <configuration>
              <tasks>
                <ant target="site-deploy" />
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>ant</groupId>
            <artifactId>ant-nodeps</artifactId>
            <version>1.6.5</version>
          </dependency>
          <dependency>
            <groupId>ant-contrib</groupId>
            <artifactId>ant-contrib</artifactId>
            <version>1.0b2</version>
          </dependency>
          <dependency>
            <groupId>ant</groupId>
            <artifactId>ant-junit</artifactId>
            <version>1.6.5</version>
          </dependency>
          <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
          </dependency>

        </dependencies>
      </plugin>
    </plugins>
  </build>
  
</project>