<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>com.webcohesion.enunciate</groupId>
    <artifactId>enunciate-parent</artifactId>
    <version>2.8.0</version>
  </parent>

  <artifactId>enunciate-csharp-xml-client</artifactId>
  <name>Enunciate - C# XML Client Module</name>
  <description>The Enunciate C# XML client module generates the C# client code for accessing the XML components of the Web service API.</description>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <!--skipping tests by default, to be enabled by the 'enunciate-full-tests' profile-->
          <skip>true</skip>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.github.ekryd.echo-maven-plugin</groupId>
        <artifactId>echo-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>warn-limited-tests</id>
            <goals>
              <goal>echo</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <skip>${activate.full.tests}</skip>
          <level>WARNING</level>
          <message>You are compiling the ${project.artifactId} project without running the full test suite, which includes compiling and running the Enunciate-generated client-side code. In order to run the full suite, you will need to do a bunch of tricky environment setup. Enable the 'enunciate-full-tests' profile to start your path down the rabbit hole.</message>
        </configuration>
      </plugin>
      <plugin>
        <!--now we need to add the generated sources we're testing to the test classpath-->
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>add-test-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-test-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${basedir}/src/test/samples</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>enunciate-core</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>enunciate-jaxb</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>enunciate-jaxws</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>enunciate-jaxrs</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.freemarker</groupId>
      <artifactId>freemarker</artifactId>
    </dependency>

    <dependency>
      <groupId>joda-time</groupId>
      <artifactId>joda-time</artifactId>

      <!--for testing the xmladapters only-->
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>enunciate-rt-util</artifactId>
      <version>${project.version}</version>

      <scope>test</scope>
    </dependency>

  </dependencies>

  <profiles>
    <profile>
      <id>full-csharp-tests</id>
      <activation>
        <property>
          <name>activate.full.tests</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <executions>
              <execution>
                <id>require.gmcs.or.skip</id>
                <phase>validate</phase>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <requireProperty>
                      <property>gmcs.executable</property>
                      <message>
In order to build the C# module, you must have Mono installed. First install Mono
for your platform. (See http://www.mono-project.com/docs/getting-started/ and note
there's a Windows version of Mono, too.) Then you will need to provide the Enunciate
build with a handle to it as follows:

* The 'gmcs.executable' build property must provide the path to your 'gmcs' executable.

Recommended configuration in settings.xml:

&lt;settings&gt;
  &lt;profiles&gt;
    &lt;profile&gt;
      &lt;id&gt;mono-installed&lt;/id&gt;
      &lt;activation&gt;
        &lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
      &lt;/activation&gt;
      &lt;properties&gt;
        &lt;gmcs.executable&gt;gmcs&lt;/gmcs.executable&gt;
      &lt;/properties&gt;
    &lt;/profile&gt;
  &lt;/profiles&gt;
&lt;/settings&gt;</message>
                    </requireProperty>
                  </rules>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <!--
            we need to generate some C# client-side classes for testing purposes.
            we'll use the Enunciate ant task to do it.
            -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>enunciate</id>
                <phase>generate-test-resources</phase>
                <configuration>
                  <tasks>
                    <taskdef name="enunciate" classname="com.webcohesion.enunciate.EnunciateTask">
                      <classpath refid="maven.test.classpath" />
                    </taskdef>

                    <mkdir dir="${project.build.directory}/enunciate" />
                    <mkdir dir="${project.build.directory}/xmltests" />

                    <enunciate basedir="${basedir}/src/test/samples" configFile="${basedir}/src/test/samples/enunciate.xml" buildDir="${project.build.directory}/enunciate">
                      <include name="**/*.java" />
                      <classpath refid="maven.test.classpath" />
                    </enunciate>
                  </tasks>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.1.1</version>
            <executions>
              <execution>
                <id>compile-cs</id>
                <phase>test-compile</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <!--compile the C# tests using the csc executable. -->
                  <executable>${gmcs.executable}</executable>
                  <arguments>
                    <argument>/out:${project.build.directory}/enunciate/processxml.exe</argument>
                    <argument>/r:System.Web.Services</argument>
                    <argument>${project.build.directory}/enunciate/csharp-xml-client/src/shapes.cs</argument>
                    <argument>${project.build.testSourceDirectory}/../cs/ProcessXml.cs</argument>
                  </arguments>
                  <workingDirectory>${project.build.directory}</workingDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <skip>false</skip>
              <systemProperties>
                <property>
                  <name>skip.csharp.tests</name>
                  <value>${gmcs.executable}</value>
                </property>
                <property>
                  <name>processxml.exe</name>
                  <value>${project.build.directory}/enunciate/processxml.exe</value>
                </property>
                <property>
                  <name>xml.tempdir</name>
                  <value>${project.build.directory}/xmltests</value>
                </property>
              </systemProperties>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
