<?xml version="1.0" encoding="UTF-8"?>
<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.composum.platform</groupId>
        <artifactId>composum-platform-commons</artifactId>
        <version>1.5.0</version>
    </parent>

    <artifactId>composum-platform-commons-package</artifactId>
    <packaging>content-package</packaging>

    <name>Composum Platform Commons Package</name>
    <description>the commons features for the platform bundled as a package</description>

    <build>
        <resources>

            <resource>
                <directory>src/main/content/jcr_root</directory>
                <filtering>false</filtering>
                <excludes>
                    <exclude>**/.vlt*</exclude>
                    <exclude>**/.DS_Store</exclude>
                    <exclude>**/.gitignore</exclude>
                    <exclude>**/*.scss</exclude>
                </excludes>
            </resource>

            <resource>
                <directory>${basedir}/src/main/content/META-INF</directory>
                <targetPath>../vault-work/META-INF</targetPath>
            </resource>

            <resource>
                <directory>target/generated-css/jcr_root</directory>
                <excludes>
                    <exclude>**/*.map</exclude>
                    <exclude>**/mixins.css</exclude>
                    <exclude>**/variables.css</exclude>
                </excludes>
            </resource>

        </resources>
        <plugins>

            <!--
            <plugin>
                <groupId>nl.geodienstencentrum.maven</groupId>
                <artifactId>sass-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-css</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>update-stylesheets</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.samaxes.maven</groupId>
                <artifactId>minify-maven-plugin</artifactId>
            </plugin>
            -->

            <plugin>
                <groupId>com.day.jcr.vault</groupId>
                <artifactId>content-package-maven-plugin</artifactId>
                <configuration>

                    <group>${package.group}</group>
                    <properties>
                        <createdBy>${package.company}</createdBy>
                        <acHandling>Merge</acHandling>
                    </properties>

                    <filters>
                        <filter>
                            <root>/libs/composum/platform/commons</root>
                        </filter>
                        <filter>
                            <root>${sling.upload.path}</root>
                            <includes>
                                <include>.*/composum-platform-commons-bundle.*\.jar</include>
                                <include>.*/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-platformcommons.config</include>
                            </includes>
                        </filter>
                    </filters>

                    <embeddeds>
                        <embedded>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>composum-platform-commons-bundle</artifactId>
                            <target>${sling.upload.path}</target>
                        </embedded>
                    </embeddeds>

                </configuration>
            </plugin>

        </plugins>
    </build>
    <dependencies>

        <!-- Package Bundles -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>composum-platform-commons-bundle</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- Composum Core -->
        <dependency>
            <groupId>com.composum.nodes</groupId>
            <artifactId>composum-nodes-commons</artifactId>
        </dependency>

        <!-- Taglib support -->
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.scripting.jsp.taglib</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
        </dependency>

    </dependencies>
    <profiles>

        <profile>
            <id>installPackage</id>
            <activation>
                <property>
                    <name>deploy.package</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.day.jcr.vault</groupId>
                        <artifactId>content-package-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>install-content-package</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>install</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>
</project>
