<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">
  <parent>
    <artifactId>protostuff</artifactId>
    <groupId>io.protostuff</groupId>
    <version>1.2.0</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>protostuff-compiler</artifactId>
  <name>protostuff :: compiler</name>
  <description>compiler for .proto files (java/gwt/etc output)</description>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <mainClass>io.protostuff.compiler.CompilerMain</mainClass>
            </manifest>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.protostuff</groupId>
      <artifactId>protostuff-parser</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.antlr</groupId>
      <artifactId>stringtemplate</artifactId>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>jwd</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
              <descriptorRefs>
                <descriptorRef>jar-with-dependencies</descriptorRef>
              </descriptorRefs>
              <archive>
                <manifest>
                  <mainClass>io.protostuff.compiler.CompilerMain</mainClass>
                </manifest>
                <manifestEntries>
                  <implementation-version>${project.version}</implementation-version>
                  <url>${project.url}</url>
                </manifestEntries>
              </archive>
            </configuration>
            <executions>
              <execution>
                <id>make-assembly</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>jarjar</id>
                <phase>package</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <tasks>
                    <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" />
                    <jarjar jarfile="target/${project.build.finalName}-jarjar.jar">
                      <manifest>
                        <attribute name="Main-Class" value="io.protostuff.compiler.CompilerMain" />
                        <attribute name="implementation-version" value="${project.version}" />
                        <attribute name="url" value="${project.url}" />
                      </manifest>
                      <zipfileset src="target/${project.build.finalName}-jar-with-dependencies.jar" />
                      <keep pattern="io.protostuff.compiler.**" />
                    </jarjar>
                  </tasks>
                </configuration>
              </execution>
            </executions>
            <dependencies>
              <dependency>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>jarjar-maven-plugin</artifactId>
                <version>1.9</version>
              </dependency>
            </dependencies>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
