<?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>

    <!-- No <parent> — addon is standalone-publishable (see Vaadin Directory publishing rules). -->

    <groupId>org.vaadin.addons.componentfactory</groupId>
    <artifactId>vcf-side-nav-rail</artifactId>
    <version>1.0.0</version>
    <packaging>jar</packaging>

    <name>SideNav Rail</name>
    <description>A togglable rail-mode SideNav for Vaadin 24.</description>

    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git@github.com:vaadin-component-factory/side-nav-rail.git</connection>
        <developerConnection>scm:git:git@github.com:vaadin-component-factory/side-nav-rail.git</developerConnection>
        <url>https://github.com/vaadin-component-factory/side-nav-rail</url>
        <tag>HEAD</tag>
    </scm>

    <organization>
        <name>Vaadin Ltd.</name>
        <url>https://vaadin.com</url>
    </organization>

    <developers>
        <developer>
            <name>Vaadin Component Factory</name>
            <email>componentfactory@vaadin.com</email>
            <organization>Vaadin Ltd.</organization>
            <organizationUrl>https://vaadin.com</organizationUrl>
        </developer>
    </developers>

    <properties>
        <maven.compiler.release>17</maven.compiler.release>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <vaadin.version>24.9.0</vaadin.version>
        <karibu.version>2.2.0</karibu.version>
        <junit.version>5.11.3</junit.version>

        <plugin.version.maven-source>3.4.0</plugin.version.maven-source>
        <plugin.version.maven-jar>3.5.0</plugin.version.maven-jar>
        <plugin.version.maven-assembly>3.8.0</plugin.version.maven-assembly>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-bom</artifactId>
                <version>${vaadin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-core</artifactId>
            <!-- provided: consumers bring their own Vaadin platform version (via their
                 vaadin-bom); the addon must not force-pin 24.9.0 or drag the full
                 platform + dev-mode tooling tree onto them as compile dependencies. -->
            <scope>provided</scope>
        </dependency>

        <!-- Test scope -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.github.mvysny.kaributesting</groupId>
            <artifactId>karibu-testing-v24</artifactId>
            <version>${karibu.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.13.0</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.2</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.3.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.10.1</version>
                <configuration>
                    <doclint>all,-missing</doclint>
                    <failOnWarnings>true</failOnWarnings>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>3.6.0</version>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>10.21.0</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <!-- CLAUDE_GUIDELINES §2, mechanizable subset (see the config file). -->
                    <configLocation>${project.basedir}/../config/checkstyle/checkstyle.xml</configLocation>
                    <includeTestSourceDirectory>false</includeTestSourceDirectory>
                    <!-- Only error-severity rules (Rule 1) fail the build; Rule 4 warnings are reported. -->
                    <violationSeverity>error</violationSeverity>
                    <failOnViolation>true</failOnViolation>
                </configuration>
                <executions>
                    <execution>
                        <id>checkstyle-check</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <!-- Standalone addon: Spotless is declared here in full (no parent to inherit from). -->
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>2.43.0</version>
                <configuration>
                    <java>
                        <googleJavaFormat>
                            <version>1.22.0</version>
                            <style>AOSP</style>
                        </googleJavaFormat>
                        <removeUnusedImports/>
                    </java>
                </configuration>
                <executions>
                    <execution>
                        <id>spotless-check</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>directory</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>${plugin.version.maven-assembly}</version>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                            <descriptors>
                                <descriptor>assembly/assembly.xml</descriptor>
                            </descriptors>
                        </configuration>
                        <executions>
                            <execution>
                                <goals><goal>single</goal></goals>
                                <phase>install</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${plugin.version.maven-source}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <phase>verify</phase>
                                <goals><goal>jar-no-fork</goal></goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <version>${plugin.version.maven-jar}</version>
                        <configuration>
                            <archive>
                                <index>true</index>
                                <manifest>
                                    <addClasspath>false</addClasspath>
                                    <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                </manifest>
                                <manifestEntries>
                                    <Vaadin-Package-Version>1</Vaadin-Package-Version>
                                    <Implementation-Vendor>n/a</Implementation-Vendor>
                                </manifestEntries>
                            </archive>
                            <excludes>
                                <exclude>META-INF/VAADIN/config/flow-build-info.json</exclude>
                                <exclude>rebel.xml</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
