<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.atlassian.plugin.notifications</groupId>
        <artifactId>notifications-parent</artifactId>
        <version>9.0.0</version>
    </parent>

    <artifactId>notifications-module</artifactId>
    <packaging>atlassian-plugin</packaging>

    <name>Atlassian Notifications SPI Plugin</name>
    <description>Exports the API and provides common runtime components wiring the SPI.</description>

    <properties>
        <scriptsdir>${maven.multiModuleProjectDirectory}/scripts</scriptsdir>
        <npm.cmd>${scriptsdir}/npm.sh</npm.cmd>
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
        <exec-maven-plugin.version>3.1.1</exec-maven-plugin.version>
        <npm.install.skip>false</npm.install.skip>
        <npm.build.skip>false</npm.build.skip>
        <npm.build.script>build</npm.build.script>
        <npm.test.skip>false</npm.test.skip>
        <terser.script>minify</terser.script>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi-javaconfig</artifactId>
            <version>${atlassian.osgi.javaconfig.version}</version>
        </dependency>

        <dependency>
            <groupId>jakarta.inject</groupId>
            <artifactId>jakarta.inject-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.annotations</groupId>
            <artifactId>atlassian-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugin.notifications</groupId>
            <artifactId>notifications-api</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi-spring-extender</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.soy</groupId>
            <artifactId>soy-template-renderer-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.atlassian.fugue</groupId>
            <artifactId>fugue</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.core</groupId>
            <artifactId>atlassian-core</artifactId>
            <scope>provided</scope>
            <exclusions>
                <!-- CONFSERVER-79308. Exclusion can be removed after Jira upgrade -->
                <exclusion>
                    <groupId>commons-collections</groupId>
                    <artifactId>commons-collections</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.util.concurrent</groupId>
            <artifactId>atlassian-util-concurrent</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.ws.rs</groupId>
            <artifactId>jakarta.ws.rs-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-v2-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-v2-plugin</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.activeobjects</groupId>
            <artifactId>activeobjects-plugin</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.templaterenderer</groupId>
            <artifactId>atlassian-template-renderer-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.analytics</groupId>
            <artifactId>analytics-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.event</groupId>
            <artifactId>atlassian-event</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.core</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>amps-maven-plugin</artifactId>
                <version>${amps8.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                        <Bundle-SymbolicName>${atlassian.plugin.key}</Bundle-SymbolicName>
                        <Import-Package>
                            com.atlassian.sal.api*,
                            com.atlassian.sal.api.features*,
                            org.eclipse.gemini.blueprint.*
                            com.atlassian.plugin.osgi.bridge.external,
                            *
                        </Import-Package>
                        <Export-Package>
                            com.atlassian.plugin.notifications.api.medium;version="${project.version}",
                            com.atlassian.plugin.notifications.api.medium.util;version="${project.version}",
                            com.atlassian.plugin.notifications.api.medium.recipient;version="${project.version}",
                            com.atlassian.plugin.notifications.api.macros;version="${project.version}",
                            com.atlassian.plugin.notifications.api.notification;version="${project.version}",
                            com.atlassian.plugin.notifications.api.event;version="${project.version}",
                            com.atlassian.plugin.notifications.api.queue;version="${project.version}",
                            com.atlassian.plugin.notifications.api.template;version="${project.version}",
                            com.atlassian.plugin.notifications.api;version="${project.version}",
                            com.atlassian.plugin.notifications.spi.salext;version="${project.version}",
                            com.atlassian.plugin.notifications.spi;version="${project.version}"
                        </Export-Package>
                        <Spring-Context>*</Spring-Context>
                    </instructions>
                    <products>
                        <product>
                            <id>jira</id>
                            <version>${jira.version}</version>
                        </product>
                        <product>
                            <id>confluence</id>
                            <version>${confluence.version}</version>
                        </product>
                        <product>
                            <id>fecru</id>
                            <version>${fecru.version}</version>
                        </product>
                        <product>
                            <id>bitbucket</id>
                            <version>${stash.version}</version>
                        </product>
                        <product>
                            <id>bamboo</id>
                            <version>${bamboo.version}</version>
                        </product>
                        <product>
                            <id>refapp</id>
                            <version>${refapp.version}</version>
                            <libArtifacts>
                                <libArtifact>
                                    <groupId>org.apache.commons</groupId>
                                    <artifactId>commons-lang3</artifactId>
                                    <version>${commons-lang3.version}</version>
                                </libArtifact>
                            </libArtifacts>
                            <pluginArtifacts>
                                <pluginArtifact>
                                    <groupId>com.atlassian.activeobjects</groupId>
                                    <artifactId>activeobjects-plugin</artifactId>
                                    <version>${ao.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.activeobjects</groupId>
                                    <artifactId>activeobjects-refapp-spi</artifactId>
                                    <version>${ao.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.soy</groupId>
                                    <artifactId>soy-template-plugin</artifactId>
                                    <version>${soy-template-plugin.version}</version>
                                </pluginArtifact>
                            </pluginArtifacts>
                        </product>
                    </products>
                </configuration>
                <executions>
                    <execution>
                        <id>copy-fe-module-manifests</id>
                        <goals>
                            <goal>copy-fe-module-manifests</goal>
                        </goals>
                        <configuration>
                            <includedFeModuleManifests>
                                <!-- Required to know what is development only & useful for other future projects -->
                                <includedFeModuleManifest>${project.basedir}/package.json</includedFeModuleManifest>
                                <!-- Required so all versions of all transitive dependencies are declared -->
                                <includedFeModuleManifest>${project.basedir}/package-lock.json</includedFeModuleManifest>
                            </includedFeModuleManifests>
                        </configuration>
                    </execution>
                    <execution>
                        <id>report-fe-manifest-associations</id>
                        <goals>
                            <goal>report-fe-manifest-associations</goal>
                        </goals>
                        <configuration>
                            <feManifestAssociations>
                                <feManifestAssociation>
                                    <!-- package name of the frontend package -->
                                    <packageName>@atlassian/dc.shared.notifications-plugin.notifications-module</packageName>
                                    <manuallyVerifiedEveryFileHasItsDependenciesDeclaredInTheManifest>
                                        <outputDirectoryFiles>
                                            js/FormDialog-min.js,
                                            js/FormDialog.js,
                                            js/lib/backbone.js,
                                            js/lib/chosen/ajax-chosen-min.js,
                                            js/lib/chosen/ajax-chosen.js,
                                            js/lib/chosen/chosen.jquery.js,
                                            js/lib/chosen/chosen.jquery-min.js,
                                            js/lib/underscore-min.js,
                                            js/lib/backbone-min.js,
                                            js/lib/underscore.js,
                                            js/notification-queue-min.js,
                                            js/notification-queue.js,
                                            js/notifications-module-util-min.js,
                                            js/notifications-module-util.js,
                                            js/notificationserver-min.js,
                                            js/notificationserver.js,
                                            js/schemeadmin/AddNotificationModel-min.js,
                                            js/schemeadmin/AddNotificationModel.js,
                                            js/schemeadmin/AddNotificationView-min.js,
                                            js/schemeadmin/AddNotificationView.js,
                                            js/schemeadmin/NotificationEventModel-min.js,
                                            js/schemeadmin/NotificationEventModel.js,
                                            js/schemeadmin/NotificationEventView-min.js,
                                            js/schemeadmin/NotificationEventView.js,
                                            js/schemeadmin/NotificationModel-min.js,
                                            js/schemeadmin/NotificationModel.js,
                                            js/schemeadmin/NotificationRecipientModel-min.js,
                                            js/schemeadmin/NotificationRecipientModel.js,
                                            js/schemeadmin/NotificationRecipientView-min.js,
                                            js/schemeadmin/NotificationRecipientView.js,
                                            js/schemeadmin/NotificationSchemeCollection-min.js,
                                            js/schemeadmin/NotificationSchemeCollection.js,
                                            js/schemeadmin/NotificationSchemeModel-min.js,
                                            js/schemeadmin/NotificationSchemeModel.js,
                                            js/schemeadmin/NotificationSchemeView-min.js,
                                            js/schemeadmin/NotificationSchemeView.js,
                                            js/schemeadmin/NotificationsView-min.js,
                                            js/schemeadmin/NotificationsView.js,
                                            js/schemeadmin/initSchemeAdmin-min.js,
                                            js/schemeadmin/initSchemeAdmin.js,
                                            js/user-panel-min.js,
                                            js/user-panel.js,
                                            js/userprefs-min.js,
                                            js/userprefs.js
                                            <!-- ... more files separated with , -->
                                        </outputDirectoryFiles>
                                    </manuallyVerifiedEveryFileHasItsDependenciesDeclaredInTheManifest>
                                </feManifestAssociation>
                            </feManifestAssociations>
                        </configuration>
                    </execution>
                    <execution>
                        <id>js-enforcement</id>
                        <goals>
                            <goal>verify-fe-manifest-associations</goal>
                        </goals>
                        <phase>verify</phase>
                        <configuration>
                            <verifyFeManifestAssociationsInputEntrypoint>
                                ${project.build.directory}/${project.build.finalName}.jar
                            </verifyFeManifestAssociationsInputEntrypoint>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>${exec-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>frontend-install</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <skip>${npm.install.skip}</skip>
                            <executable>${npm.cmd}</executable>
                            <arguments>
                                <argument>install</argument>
                                <argument>--no-save</argument>
                                <argument>--no-audit</argument>
                                <argument>--prefer-offline</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>minify</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <skip>${npm.build.skip}</skip>
                            <executable>${npm.cmd}</executable>
                            <arguments>
                                <argument>run</argument>
                                <argument>${terser.script}</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>frontend-build</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <skip>${npm.build.skip}</skip>
                            <executable>${npm.cmd}</executable>
                            <arguments>
                                <argument>run</argument>
                                <argument>${npm.build.script}</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
