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

    <groupId>com.flowingcode.addons</groupId>
    <artifactId>font-awesome-iron-iconset</artifactId>
    <version>6.0.1-SNAPSHOT</version>
    <name>FontAwesome Iron Iconset</name>
    <description>Icon set based in FontAwesome</description>
    <url>https://www.flowingcode.com/en/open-source/</url>
    
    <properties>
        <vaadin.version>24.4.6</vaadin.version>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <jetty.version>11.0.26</jetty.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <flowingcode.commons.demo.version>4.0.0</flowingcode.commons.demo.version>
        <project.build.generatedSources>${project.basedir}/src/main/generated</project.build.generatedSources>
        <!-- 
        <fontawesome.version>Pro 6.1.2</fontawesome.version>
        <project.build.generatedResources>${project.basedir}/src/main/resources/META-INF/resources/frontend</project.build.generatedResources>
        <codegen.sprites>${project.basedir}/src/main/sprites</codegen.sprites>
        <codegen.icons>${project.basedir}/src/main/icons</codegen.icons>
        <codegen.skipDownload>true</codegen.skipDownload>
        <codegen.embedded>true</codegen.embedded>
         -->
        <fontawesome.version>7.2.0</fontawesome.version>
		<project.build.generatedResources>${project.basedir}/src/main/javascript</project.build.generatedResources>
        <codegen.sprites>${project.build.directory}/sprites</codegen.sprites>
        <codegen.icons />
        <codegen.skipDownload>false</codegen.skipDownload>
        <codegen.embedded>false</codegen.embedded>
        <npm.package>@flowingcode/font-awesome-iron-iconset</npm.package>
        <npm.version>6.0.0</npm.version>
    </properties>
    
	<scm>
        <url>https://github.com/FlowingCode/FontAwesomeIronIconset</url>
        <connection>scm:git:git://github.com/FlowingCode/FontAwesomeIronIconset.git</connection>
        <developerConnection>scm:git:ssh://git@github.com:/FlowingCode/FontAwesomeIronIconset.git</developerConnection>
        <tag>HEAD</tag>
    </scm>

    <organization>
       <name>Flowing Code</name>
       <url>https://www.flowingcode.com</url>
     </organization>
     <inceptionYear>2019</inceptionYear>
    <licenses>
        <license>
            <name>Apache 2</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
         <developer>
            <id>flowingcode</id>
            <organization>Flowing Code</organization>
            <organizationUrl>https://www.flowingcode.com</organizationUrl>
        </developer>
    </developers>
  
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-bom</artifactId>
                <type>pom</type>
                <scope>import</scope>
                <version>${vaadin.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <repositories>
        <repository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>Vaadin Directory</id>
            <url>https://maven.vaadin.com/vaadin-addons</url>
        </repository>
        <repository>
            <id>Vaadin prereleases</id>
            <url>https://maven.vaadin.com/vaadin-prereleases</url>
        </repository>		
    </repositories>


    <pluginRepositories>
        <pluginRepository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <!-- Repository needed for prerelease versions of Vaadin -->
        <pluginRepository>
            <id>Vaadin prereleases</id>
            <url>https://maven.vaadin.com/vaadin-prereleases</url>
        </pluginRepository>
    </pluginRepositories>

    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-core</artifactId>            
            <optional>true</optional>
        </dependency>
		
		<dependency>
			<groupId>com.flowingcode.vaadin</groupId>
			<artifactId>json-migration-helper</artifactId>
			<version>0.9.2</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<version>1.18.42</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
		    <groupId>junit</groupId>
		    <artifactId>junit</artifactId>
		    <version>4.13.1</version>
		    <scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.flowingcode.vaadin.addons.demo</groupId>
			<artifactId>commons-demo</artifactId>
			<version>${flowingcode.commons.demo.version}</version>
			<scope>test</scope>
		</dependency>

    </dependencies>

    <build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-release-plugin</artifactId>
					<version>3.0.1</version>
					<configuration>
					    <releaseProfiles>release</releaseProfiles>
					</configuration>
				</plugin>
				<plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-surefire-plugin</artifactId>
					<version>2.22.1</version>
					<configuration>
						<useSystemClassLoader>false</useSystemClassLoader>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
		
        <plugins>
				
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>license-maven-plugin</artifactId>
				<version>2.0.0</version>
				<configuration>
				  <licenseName>apache_v2</licenseName>
				  <addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
				  <excludes>
					<exclude>main/javascript/font-awesome-iron-iconset/**</exclude>
					<exclude>main/icons/**</exclude>
					<exclude>main/sprites/**</exclude>
					<exclude>main/dev-bundle/**</exclude>
				  </excludes>
				  <extraExtensions>
					<xslt>xml</xslt>
				  </extraExtensions>
				</configuration>
			</plugin>
	
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
				  <execution>
					<id>add-source</id>
					<phase>generate-sources</phase>
					<goals>
					  <goal>add-source</goal>
					</goals>
					<configuration>
					  <sources>
						<source>${project.build.generatedSources}</source>
					  </sources>
					</configuration>
				  </execution>
				</executions>
            </plugin>
						
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.2</version>
                <configuration>
                    <archive>
                        <index>true</index>
                        <manifest>
                            <addClasspath>false</addClasspath>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                        <manifestEntries>
                            <Vaadin-Package-Version>1</Vaadin-Package-Version>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>${vaadin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-frontend</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.version}</version>
                <configuration>
                    <scanIntervalSeconds>3</scanIntervalSeconds>
                    <!-- Use test scope because the UI/demo classes are in
                            the test package. -->
                    <useTestScope>true</useTestScope>
                    <webApp>
                        <resourceBases>
	                        <resourceBase>src/test/resources/META-INF/resources</resourceBase>
	                        <resourceBase>src/main/resources/META-INF/resources</resourceBase>
	                    </resourceBases>
                    </webApp>
                    <supportedPackagings>
                        <supportedPackaging>jar</supportedPackaging>
                    </supportedPackagings>
                    <systemProperties>
                        <vaadin.frontend.hotdeploy>true</vaadin.frontend.hotdeploy>
                    </systemProperties>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>directory</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.11.1</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <quiet>true</quiet>
                            <doclint>none</doclint>
                            <failOnWarnings>true</failOnWarnings>
                            <links>
                                <link>https://javadoc.io/doc/com.vaadin/vaadin-platform-javadoc/${vaadin.version}</link>
                            </links>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <version>3.1.2</version>
                        <configuration>
                            <!-- Generated file that shouldn't be included in add-ons -->
                            <excludes>
                                <exclude>META-INF/VAADIN/config/flow-build-info.json</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Run (demo) in production mode-->
        <profile>
            <id>production</id>
            <properties>
                <vaadin.productionMode>true</vaadin.productionMode>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>com.vaadin</groupId>
                    <artifactId>flow-server-production-mode</artifactId>
                </dependency>
            </dependencies>
            
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.vaadin</groupId>
                        <artifactId>vaadin-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>build-frontend</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

    	<profile>
    		<id>generate</id>
    		<build>
    			<defaultGoal>generate-sources</defaultGoal>
    			
    			<plugins>
					
    				<plugin>
				    	<artifactId>maven-clean-plugin</artifactId>
    					<executions>
    						<execution>
						    	<configuration>
							      <filesets>
									<!-- clean src/main/generated -->
							        <fileset>
							          <directory>${project.build.generatedSources}</directory>
							        </fileset>
									<!-- clean src/main/javascript -->
									<fileset>
										<directory>${project.build.generatedResources}</directory>
											<includes>
												<include>**/*.js</include>
											</includes>
											<excludes>
												<exclude>**/duotone.js</exclude>
											</excludes>
											<excludes>
												<exclude>**/fc-iconset.js</exclude>
											</excludes>
									</fileset>
						      	   </filesets>
						    	</configuration>
								<phase>clean</phase>
								<goals>
									<goal>clean</goal>
								</goals>
						    </execution>
						</executions>				    	
				  	</plugin>
			
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-dependency-plugin</artifactId>
						<executions>
							<execution>
								<phase>initialize</phase>
								<goals>
									<goal>properties</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					
					<plugin>
    					<groupId>org.codehaus.mojo</groupId>
    					<artifactId>exec-maven-plugin</artifactId>
    					<configuration>
    						<executable>mvn</executable>
    						<workingDirectory>${project.basedir}/src/codegen</workingDirectory>
    					</configuration>
    					<executions>
    						<execution>
								<id>iron-icons</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>exec</goal>
								</goals>
								<configuration>
								  <arguments combine.children="append">
									<argument>clean</argument>
									<argument>compile</argument>
									<argument>exec:java@download</argument>
									<argument>exec:java@build-sprites</argument>
									<argument>exec:java@generate</argument>
									<argument>exec:java@compile</argument>
									
									<!-- The tag of FortAwesome/Font-Awesome that will be checked out -->
									<argument>-Dcodegen.tag=${fontawesome.version}</argument>
									
									<!-- Configure to true for skipping the download phase-->
									<argument>-Dcodegen.skipDownload=${codegen.skipDownload}</argument>
									
									<!-- Configure for building the sprites from individual icon files-->
									<argument>-Dcodegen.icons=${codegen.icons}</argument>
									
									<!-- Location of the SVG sprites -->
									<argument>-Dcodegen.sprites=${codegen.sprites}</argument>
									
									<!-- Location of the generated Java sources -->
									<argument>-Dcodegen.sources=${project.build.generatedSources}</argument>
									
									<!-- Location of the generated JS modules -->
									<argument>-Dcodegen.resources=${project.build.generatedResources}</argument>
									
									<!-- if embedded=false value and version are used for the @NpmPackage annotation  
									     if embedded=true no @NpmPackage annotation will be added -->
									<argument>-Dcodegen.embedded=${codegen.embedded}</argument>
									<argument>-Dcodegen.npmPackage=${npm.package}</argument>
									<argument>-Dcodegen.npmVersion=${npm.version}</argument>

									<argument>-Dcodegen.compiler.source=${maven.compiler.source}</argument>
									<argument>-Dcodegen.compiler.target=${maven.compiler.target}</argument>
								  </arguments>
								</configuration>
						    </execution>							
						</executions>		    					
    				</plugin>
    			
    			</plugins>    		
    		</build>
    	</profile>

		<profile>
			<id>bigenum</id>
			<properties>
				<maven.main.skip>true</maven.main.skip>
			</properties>
			<build>
				<resources>
					<resource>
						<directory>target/codegen/recompiled</directory>
					</resource>
				</resources>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<configuration>
							<executable>mvn</executable>
							<workingDirectory>${project.basedir}/src/codegen</workingDirectory>
						</configuration>
						<executions>
							<execution>
								<id>iron-icons</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>exec</goal>
								</goals>
								<configuration>
								  <arguments combine.children="append">
									<argument>-Dcodegen.classpath=${com.vaadin:flow-server:jar};${com.vaadin:vaadin-flow-components-base:jar};${com.vaadin:vaadin-icons-flow:jar}</argument>
									<argument>-Dcodegen.postcompile=true</argument>
								  </arguments>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>gpg</id>
			<activation>
				<property>
					<name>env.MAVEN_GPG_PASSPHRASE</name>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<version>3.2.7</version>
						<executions>
							<execution>
								<id>sign-artifacts</id>
								<phase>verify</phase>
								<goals>
									<goal>sign</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
    
    	<profile>
			<id>demo-jar</id>
            <build>		
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-jar-plugin</artifactId>
						<executions>
							<execution>
								<goals>
									<goal>test-jar</goal>
								</goals>
								<configuration>
									<classifier>demo</classifier>
									<excludes>
										<exclude>META-INF/resources/frontend/styles/shared-styles.css</exclude>
										<exclude>**/test/*</exclude>
										<exclude>**/integration/*</exclude>
										<exclude>**/redirect/*</exclude>
										<exclude>**/DemoLayout.class</exclude>
									</excludes>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>v25</id>
			<properties>
				<maven.compiler.source>21</maven.compiler.source>
				<maven.compiler.target>21</maven.compiler.target>
				<vaadin.version>25.0.3</vaadin.version>
			</properties>
			<dependencies>
				<dependency>
					<groupId>com.vaadin</groupId>
					<artifactId>vaadin-dev</artifactId>
					<optional>true</optional>
				</dependency>
			</dependencies>
		</profile>

        	<profile>
        	    <id>release</id>
	            <build>
        	        <plugins>
	                    <plugin>
                        	<groupId>org.sonatype.central</groupId>
                	        <artifactId>central-publishing-maven-plugin</artifactId>
        	                <version>0.8.0</version>
	                        <extensions>true</extensions>
                    		</plugin>
                	</plugins>
        	    </build>
	        </profile>

    </profiles>
</project>
