<?xml version="1.0" encoding="UTF-8"?>
<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>com.vaadin</groupId>
    <artifactId>vaadin-root</artifactId>
    <version>8.25.0</version>
  </parent>
  <groupId>com.vaadin</groupId>
  <artifactId>vaadin-push</artifactId>
  <version>8.25.0</version>
  <name>vaadin-push</name>
  <description>Vaadin server push support</description>
  <url>https://vaadin.com/</url>
  <organization>
    <name>Vaadin Ltd</name>
  </organization>
  <licenses>
    <license>
      <name>Vaadin Commercial License</name>
      <url>https://vaadin.com/commercial-license-and-service-terms</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <developers>
    <developer>
      <id>hesara</id>
      <name>Henri Sara</name>
      <email>hesara@vaadin.com</email>
      <organization>Vaadin</organization>
      <organizationUrl>http://vaadin.com</organizationUrl>
      <timezone>+2</timezone>
    </developer>
  </developers>
  <scm>
    <connection>scm:git:git://github.com/vaadin/framework.git/vaadin-push</connection>
    <developerConnection>scm:git:git://github.com/vaadin/framework.git/vaadin-push</developerConnection>
    <url>https://github.com/vaadin/framework/vaadin-push</url>
  </scm>
  <distributionManagement>
    <repository>
      <id>vaadin-staging</id>
      <name>Vaadin release staging repository</name>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
    <snapshotRepository>
      <id>vaadin-snapshots</id>
      <name>Vaadin snapshot repository</name>
      <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
    </snapshotRepository>
  </distributionManagement>
  <dependencies>
    <dependency>
      <groupId>com.vaadin.external.atmosphere</groupId>
      <artifactId>atmosphere-runtime</artifactId>
      <version>2.4.30.vaadin6</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.vaadin.external.atmosphere.client</groupId>
      <artifactId>javascript</artifactId>
      <version>2.3.2.vaadin2</version>
      <type>war</type>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.vaadin</groupId>
      <artifactId>vaadin-shared</artifactId>
      <version>8.25.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>osgi.core</artifactId>
      <version>6.0.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>osgi.cmpn</artifactId>
      <version>6.0.0</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
  <repositories>
    <repository>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <id>vaadin-prereleases</id>
      <url>https://maven.vaadin.com/vaadin-prereleases/</url>
    </repository>
  </repositories>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>default-cli</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <property name="javascript.unpack" location="${project.build.directory}/temp" />
                <property name="vaadinPush.js" location="${project.build.outputDirectory}/VAADIN/vaadinPush.debug.js" />
                <property name="templates.dir" location="${project.build.sourceDirectory}/../templates" />
                <unzip src="${maven.dependency.com.vaadin.external.atmosphere.client.javascript.war.path}" dest="${javascript.unpack}">
                  <patternset>
                    <include name="**/atmosphere.js" />
                  </patternset>
                  <mapper type="flatten" />
                </unzip>
                <loadfile srcfile="${javascript.unpack}/atmosphere.js" property="atmosphere.js.contents" />
                <loadfile srcfile="${templates.dir}/vaadinPush.js.tpl" property="vaadinPush.js.contents">
                  <filterchain>
                    <replacetokens begintoken="@" endtoken="@">
                      <token value="${atmosphere.js.contents}" key="atmosphere.js" />
                    </replacetokens>
                  </filterchain>
                </loadfile>
                <echo file="${vaadinPush.js}">${vaadinPush.js.contents}</echo>
              </target>
            </configuration>
          </execution>
          <execution>
            <id>compresspush</id>
            <phase>compile</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <property name="vaadinPush.debug.js" location="${project.build.outputDirectory}/VAADIN/vaadinPush.debug.js" />
                <property name="vaadinPush-min.js" location="${project.build.outputDirectory}/VAADIN/vaadinPush.debug-min.js" />
                <property name="vaadinPush.js" location="${project.build.outputDirectory}/VAADIN/vaadinPush.js" />
                <move file="${vaadinPush-min.js}" tofile="${vaadinPush.js}" />
                <gzip destfile="${vaadinPush.debug.js}.gz" src="${vaadinPush.debug.js}" />
                <gzip destfile="${vaadinPush.js}.gz" src="${vaadinPush.js}" />
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>net.alchim31.maven</groupId>
        <artifactId>yuicompressor-maven-plugin</artifactId>
        <version>1.5.1</version>
        <executions>
          <execution>
            <id>minifyjs</id>
            <phase>process-resources</phase>
            <goals>
              <goal>compress</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <sourceDirectory>${project.build.outputDirectory}/VAADIN</sourceDirectory>
          <includes>
            <include>vaadinPush.debug.js</include>
          </includes>
          <outputDirectory>${project.build.outputDirectory}/VAADIN</outputDirectory>
        </configuration>
      </plugin>
      <plugin>
        <groupId>biz.aQute.bnd</groupId>
        <artifactId>bnd-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
            <index>false</index>
            <manifest>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            </manifest>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
