<!--
 |  Copyright 2019 Adobe Systems Incorporated
 |
 |  Licensed 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.
-->
<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>

    <!-- ====================================================================== -->
    <!-- P A R E N T  P R O J E C T  D E S C R I P T I O N                      -->
    <!-- ====================================================================== -->
    <parent>
        <groupId>com.adobe.aem.commons</groupId>
        <artifactId>assetshare</artifactId>
        <version>2.4.4</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <!-- ====================================================================== -->
    <!-- P R O J E C T  D E S C R I P T I O N                                   -->
    <!-- ====================================================================== -->
    <artifactId>assetshare.all</artifactId>
    <packaging>content-package</packaging>
    <name>Asset Share Commons - All</name>
    <description>All package for Asset Share Commons</description>

    <!-- ====================================================================== -->
    <!-- B U I L D   D E F I N I T I O N                                        -->
    <!-- ====================================================================== -->
    <build>
        <finalName>asset-share-commons.all-${project.version}</finalName>
        <plugins>
            <!-- ====================================================================== -->
            <!-- V A U L T   P A C K A G E   P L U G I N S                              -->
            <!-- ====================================================================== -->
            <plugin>
                <groupId>org.apache.jackrabbit</groupId>
                <artifactId>filevault-package-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-generate-metadata</id>
                        <configuration>
                            <group>${package.group}</group>
                            <name>asset-share-commons.all</name>
                            <packageType>container</packageType>
                            <properties>
                                <cloudManagerTarget>all</cloudManagerTarget>
                            </properties>
                            <embeddeds>
                                <embedded>
                                    <groupId>com.adobe.aem.commons</groupId>
                                    <artifactId>assetshare.ui.apps</artifactId>
                                    <type>zip</type>
                                    <target>/apps/asset-share-commons-packages/application/install</target>
                                </embedded>
                                <embedded>
                                    <groupId>com.adobe.aem.commons</groupId>
                                    <artifactId>assetshare.ui.config</artifactId>
                                    <type>zip</type>
                                    <target>/apps/asset-share-commons-packages/container/install</target>
                                </embedded>
                                <embedded>
                                    <groupId>com.adobe.aem.commons</groupId>
                                    <artifactId>assetshare.core</artifactId>
                                    <target>/apps/asset-share-commons-packages/application/install</target>
                                </embedded>
                                <embedded>
                                    <groupId>com.adobe.aem.commons</groupId>
                                    <artifactId>assetshare.ui.content</artifactId>
                                    <type>zip</type>
                                    <target>/apps/asset-share-commons-packages/content/install</target>
                                </embedded>
                            </embeddeds>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.day.jcr.vault</groupId>
                <artifactId>content-package-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <executions>
                    <execution>
                        <id>auto-clean</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <!-- ====================================================================== -->
    <!-- P R O F I L E S                                                        -->
    <!-- ====================================================================== -->
    <profiles>
        <profile>
            <id>cloud</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <finalName>asset-share-commons.all-cloud-${project.version}</finalName>
                <plugins>
                    <plugin>
                        <groupId>org.apache.jackrabbit</groupId>
                        <artifactId>filevault-package-maven-plugin</artifactId>
                        <inherited>false</inherited>
                        <executions>
                            <execution>
                                <id>generate-metadata-cloud</id>
                                <goals>
                                    <goal>generate-metadata</goal>
                                </goals>
                                <configuration>
                                    <classifier>cloud</classifier>
                                    <group>${package.group}</group>
                                    <name>asset-share-commons.all-cloud</name>
                                    <packageType>container</packageType>
                                    <properties>
                                        <cloudManagerTarget>all</cloudManagerTarget>
                                    </properties>
                                    <embeddeds>
                                        <embedded>
                                            <groupId>com.adobe.aem.commons</groupId>
                                            <artifactId>assetshare.ui.apps</artifactId>
                                            <type>zip</type>
                                            <target>/apps/asset-share-commons-packages/application/install</target>
                                        </embedded>
                                        <embedded>
                                            <groupId>com.adobe.aem.commons</groupId>
                                            <artifactId>assetshare.ui.config</artifactId>
                                            <type>zip</type>
                                            <target>/apps/asset-share-commons-packages/container/install</target>
                                        </embedded>
                                        <embedded>
                                            <artifactId>assetshare.core</artifactId>
                                            <target>/apps/asset-share-commons-packages/application/install</target>
                                        </embedded>
                                        <embedded>
                                            <artifactId>assetshare.core.cloud</artifactId>
                                            <target>/apps/asset-share-commons-packages/application/install</target>
                                        </embedded>
                                        <embedded>
                                            <groupId>com.adobe.aem.commons</groupId>
                                            <artifactId>assetshare.ui.content</artifactId>
                                            <type>zip</type>
                                            <target>/apps/asset-share-commons-packages/content/install</target>
                                        </embedded>
                                        <!-- Remove ui.content.sample from all package, as it should not be installed as part of real uses of Asset Share commons -->
                                     </embeddeds>
                                </configuration>
                            </execution>
                            <execution>
                                <id>package-cloud</id>
                                <goals>
                                    <goal>package</goal>
                                </goals>
                                <configuration>
                                    <classifier>cloud</classifier>
                                </configuration>
                            </execution>
                            <execution>
                                <id>default-validate-package</id>
                                <configuration>
                                    <classifier>cloud</classifier>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>com.adobe.aem</groupId>
                        <artifactId>aemanalyser-maven-plugin</artifactId>
                        <version>1.4.10</version> <!-- Make sure to use the latest release -->
                        <executions>
                            <execution>
                                <id>aem-analyser</id>
                                <goals>
                                    <goal>project-analyse</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>com.adobe.aem.commons</groupId>
                    <artifactId>assetshare.core.cloud</artifactId>
                    <version>${project.version}</version>
                    <type>jar</type>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>autoInstallSinglePackage</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.day.jcr.vault</groupId>
                        <artifactId>content-package-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>install-package</id>
                                <goals>
                                    <goal>install</goal>
                                </goals>
                                <configuration>
                                    <targetURL>http://${aem.host}:${aem.port}/crx/packmgr/service.jsp</targetURL>
                                    <failOnError>true</failOnError>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>autoInstallSinglePackagePublish</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.day.jcr.vault</groupId>
                        <artifactId>content-package-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>install-package-publish</id>
                                <goals>
                                    <goal>install</goal>
                                </goals>
                                <configuration>
                                    <targetURL>http://${aem.publish.host}:${aem.publish.port}/crx/packmgr/service.jsp</targetURL>
                                    <failOnError>true</failOnError>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <!-- ====================================================================== -->
    <!-- D E P E N D E N C I E S                                                -->
    <!-- ====================================================================== -->
    <dependencies>
        <dependency>
            <groupId>com.adobe.aem.commons</groupId>
            <artifactId>assetshare.ui.apps</artifactId>
            <version>${project.version}</version>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>com.adobe.aem.commons</groupId>
            <artifactId>assetshare.ui.config</artifactId>
            <version>${project.version}</version>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>com.adobe.aem.commons</groupId>
            <artifactId>assetshare.ui.content</artifactId>
            <version>${project.version}</version>
            <type>zip</type>
        </dependency>
        <dependency>
            <groupId>com.adobe.aem.commons</groupId>
            <artifactId>assetshare.core</artifactId>
            <version>${project.version}</version>
            <type>jar</type>
        </dependency>
    </dependencies>
</project>
