<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>org.rascalmpl</groupId>
    <artifactId>rascal</artifactId>
    <version>0.41.0-RC3-SNAPSHOT</version>
    <packaging>jar</packaging>

    <scm>
        <developerConnection>scm:git:ssh://git@github.com/usethesource/rascal.git</developerConnection>
        <tag>v0.41.0-RC1</tag>
    </scm>

    <!-- dependency resolution configuration (usethesource) -->
    <repositories>
        <repository>
            <id>usethesource</id>
            <url>https://releases.usethesource.io/maven/</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>usethesource</id>
            <url>https://releases.usethesource.io/maven/</url>
        </pluginRepository>
    </pluginRepositories>


    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <lucence-version>7.5.0</lucence-version>
        <maven-version>3.9.9</maven-version>
        <exec.mainClass>org.rascalmpl.shell.RascalShell</exec.mainClass>
        <rascal.test.memory>3</rascal.test.memory>
        <maven.compiler.release>11</maven.compiler.release>
        <rascal-maven.version>0.28.9-BOOT1</rascal-maven.version>
    </properties>

    <licenses>
        <license>
            <name>BSD-2-Clause</name>
            <url>https://opensource.org/license/BSD-2-Clause</url>
            <distribution>repo</distribution>
            <!-- we cannot define multiple licenses in this maven block, as it would mean the user can choose either of the licenses -->
            <comments>Note, some older files are still licensed under Eclipse v1</comments>
        </license>
    </licenses>


    <build>
        <sourceDirectory>src</sourceDirectory>
        <resources>
            <resource>
                <directory>src</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                    <exclude>**/*.class</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>.</directory>
                <filtering>false</filtering>
                <includes>
                    <include>plugin.xml</include>
                    <include>META-INF/RASCAL.MF</include>
                    <include>rascal-DEPENDENCIES.txt</include>
                </includes>
            </resource>
            <resource>
                <directory>${project.build.directory}/generated-resources</directory>
            </resource>
        </resources>
        <testSourceDirectory>test</testSourceDirectory>
        <testResources>
            <testResource>
                <directory>test</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                    <exclude>**/*.class</exclude>
                </excludes>
            </testResource>
            <testResource>
                <directory>test/org/rascalmpl/test/data/</directory>
            </testResource>
            <testResource>
                <directory>src/org/rascalmpl/library/</directory>
            </testResource>
        </testResources>

        <plugins>
            <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</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>3.2.1</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.3.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.13.0</version>
                <configuration>
                    <compilerArgument>-parameters</compilerArgument> <!-- make sure parameters are compiled by name into the jar -->
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.rascalmpl</groupId>
                <artifactId>rascal-maven-plugin</artifactId>
                <version>${rascal-maven.version}</version>
                <configuration>
                    <errorsAsWarnings>false</errorsAsWarnings> <!-- only allowed during intermediate bootstrap cycles -->
                    <bin>${project.build.outputDirectory}</bin>
                    <srcs>
                        <src>${project.basedir}/src/org/rascalmpl/library</src>
                    </srcs>
                    <sourceLookup>|std:///|</sourceLookup>
                    <funding>${project.basedir}/FUNDING</funding>
                    <citation>${project.basedir}/CITATION.md</citation>
                    <issues>|https://github.com/usethesource/rascal/issues|</issues>
                    <srcIgnores>
                        <ignore>${project.basedir}/src/org/rascalmpl/library/experiments</ignore>
                        <ignore>${project.basedir}/src/org/rascalmpl/library/resource</ignore>
                        <ignore>${project.basedir}/src/org/rascalmpl/library/lang/rascal/tests</ignore>
                        <ignore>${project.basedir}/src/org/rascalmpl/library/lang/rascal/grammar/tests</ignore>
                        <ignore>${project.basedir}/src/org/rascalmpl/library/lang/rascal/syntax/tests</ignore>
                    </srcIgnores>
                    <enableStandardLibrary>false</enableStandardLibrary>
                    <parallel>true</parallel>
                    <parallelPreChecks>
                        <pre>${project.basedir}/src/org/rascalmpl/library/Prelude.rsc</pre>
                    </parallelPreChecks>
                </configuration>
                <executions>
                    <execution>
                        <id>it-compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>it-package</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>package</goal>
                        </goals>
                    </execution>
                        <!-- commented out for bootstrapping purposes; 
                            <execution>
                        <id>default-cli</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>tutor</goal>
                        </goals>
                        <configuration>
                            <isPackageCourse>false</isPackageCourse>
                            <enableStandardLibrary>false</enableStandardLibrary>
                            <errorsAsWarnings>false</errorsAsWarnings>
                            <bin>${project.build.outputDirectory}</bin>
                            <license>${project.basedir}/LICENSE</license>
                            <sources>|http://github.com/usethesource/rascal/blob/main|</sources>
                            <issues>|http://github.com/usethesource/rascal/issues|</issues>
                            <srcs>
                                <src>${project.basedir}/src/org/rascalmpl/library</src>
                            </srcs>
                            <ignores>
                                <ignore>${project.basedir}/src/org/rascalmpl/library/lang/rascal</ignore>
                            </ignores>
                        </configuration>
                        </execution> -->
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.4.0</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>${project.basedir}/bin</directory>
                            <includes>
                                <include>**/*.*</include>
                            </includes>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.2</version>
                <executions>
                    <execution>
                        <id>test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <argLine>
                                -ea
                                -Xmx${rascal.test.memory}G
                                -Xss128m
                                -Dfile.encoding=UTF-8
                                ${argLine}
                        </argLine>
                    <includes>
                        <include>**/org/rascalmpl/test/AllSuiteParallel.java</include>
                        <include>**/org/rascalmpl/test/library/LibraryLangPaths.java</include>
                        <include>**/org/rascalmpl/test/value/AllTests.java</include>
                        <include>**/org/rascalmpl/*Test.java</include>
                    </includes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.12</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.8.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>tree</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>
                            <output>rascal-DEPENDENCIES.txt</output>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>3.1.1</version>
                <configuration>
                    <tagNameFormat>v@{project.version}</tagNameFormat>
                    <arguments>-Drascal.compile.skip -Drascal.tutor.skip -DskipTests</arguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>2.5.0</version>
                <executions>
                    <execution>
                        <id>download-licenses</id>
                        <goals>
                            <goal>download-licenses</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.6.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <manifestEntries>
                                        <Name>rascal</Name>
                                        <Main-Class>org.rascalmpl.shell.RascalShell</Main-Class>
                                        <Specification-Version>${project.version}</Specification-Version>
                                        <Specification-Vendor>http://www.usethesource.io</Specification-Vendor>
                                    </manifestEntries>
                                </transformer>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>org/rascalmpl/uri/resolvers.config</resource>
                                </transformer>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>io/usethesource/vallang/type/types.config</resource>
                                </transformer>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>META-INF/sisu/javax.inject.Named</resource> <!-- Needed for dependency injection in MavenCli -->
                                </transformer>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer" /> <!-- Needed for dependency injection in MavenCli -->
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" />
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
                                    <addHeader>false</addHeader>
                                </transformer>
                            </transformers>
                            <relocations>
                                <relocation>
                                    <pattern>org.fusesource.jansi</pattern>
                                    <shadedPattern>org.rascalmpl.fusesource.jansi</shadedPattern>
                                    <excludes>
                                        <exclude>org.fusesource.jansi.internal.*</exclude>
                                    </excludes>
                                </relocation>
                                <relocation>
                                    <pattern>jline</pattern>
                                    <shadedPattern>org.rascalmpl.jline</shadedPattern>
                                </relocation>
                            </relocations>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin><!-- make sure users are using recent versions of maven -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.5.0</version>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                        <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>(3.8,)</version> <!-- ideally this would be 3.9+, but GH actions is still on 3.8 -->
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings
                    only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                                    org.codehaus.mojo
                                            </groupId>
                                        <artifactId>
                                                    exec-maven-plugin
                                            </artifactId>
                                        <versionRange>
                                                    [1.4.0,)
                                            </versionRange>
                                        <goals>
                                            <goal>exec</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <dependencies>
        <!-- Repackaged Eclipse Dependencies -->
        <dependency>
            <groupId>org.rascalmpl</groupId>
            <artifactId>rascal-p2-dependencies-repackaged</artifactId>
            <version>0.6.0</version>
        </dependency>

        <!-- Regular POM Dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
        </dependency>
        <dependency> 
            <groupId>io.usethesource</groupId>
            <artifactId>vallang</artifactId>
            <version>1.0.0-RC12</version>
        </dependency>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm</artifactId>
            <version>9.6</version>
        </dependency>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm-tree</artifactId>
            <version>9.6</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-math</artifactId>
            <version>2.2</version>
        </dependency>
        <dependency> <!-- used by the compression uri feature-->
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-compress</artifactId>
            <version>1.27.1</version>
        </dependency>
        <dependency> <!-- needed by commons-compress for compressed+...://...zst -->
            <groupId>com.github.luben</groupId>
            <artifactId>zstd-jni</artifactId>
            <version>1.5.6-8</version>
        </dependency>
        <dependency> <!-- used for base32 encoding in IO and String, needed anyway for commons-compress -->
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.17.1</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.11.0</version>
        </dependency>
        <dependency>
            <groupId>jline</groupId>
            <artifactId>jline</artifactId>
            <version>2.14.6</version>
        </dependency>
        <dependency>
            <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
            <version>2.3</version>
        </dependency>
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.15.4</version>
        </dependency>
        <dependency>
            <groupId>org.jdom</groupId>
            <artifactId>jdom2</artifactId>
            <version>2.0.6.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-core</artifactId>
            <version>${lucence-version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-highlighter</artifactId>
            <version>${lucence-version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-analyzers-common</artifactId>
            <version>${lucence-version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-queryparser</artifactId>
            <version>${lucence-version}</version>
        </dependency>
        <dependency>
            <groupId>org.nanohttpd</groupId>
            <artifactId>nanohttpd</artifactId>
            <version>2.3.1</version>
        </dependency>
        <dependency>
            <groupId>com.ibm.icu</groupId>
            <artifactId>icu4j</artifactId>
            <version>76.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-embedder</artifactId>
            <version>${maven-version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>3.8.1</version>
        </dependency>
        <dependency> <!-- needed for maven-embedder-->
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-nop</artifactId>
            <version>1.7.36</version>
        </dependency>
        <dependency> <!-- needed for maven-embedder-->
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-compat</artifactId>
            <version>${maven-version}</version>
        </dependency>
        <dependency> <!-- needed for maven-embedder-->
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>${maven-version}</version>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>unshaded</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-shade-plugin</artifactId>
                        <version>3.6.0</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>shade</goal>
                                </goals>
                                <configuration>
                                    <transformers>
                                        <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                            <manifestEntries>
                                                <Name>rascal</Name>
                                                <Main-Class>org.rascalmpl.shell.RascalShell</Main-Class>
                                                <Specification-Version>${project.version}</Specification-Version>
                                                <Specification-Vendor>http://www.usethesource.io</Specification-Vendor>
                                            </manifestEntries>
                                        </transformer>
                                    </transformers>
                                    <relocations>
                                        <relocation>
                                            <pattern>org.fusesource.jansi</pattern>
                                            <shadedPattern>org.rascalmpl.fusesource.jansi</shadedPattern>
                                            <excludes>
                                                <exclude>org.fusesource.jansi.internal.*</exclude>
                                            </excludes>
                                        </relocation>
                                        <relocation>
                                            <pattern>jline</pattern>
                                            <shadedPattern>org.rascalmpl.jline</shadedPattern>
                                        </relocation>
                                    </relocations>
                                    <filters>
                                        <filter>
                                            <artifact>*:*</artifact>
                                            <excludes>
                                                <exclude>META-INF/*.SF</exclude>
                                                <exclude>META-INF/*.DSA</exclude>
                                                <exclude>META-INF/*.RSA</exclude>
                                            </excludes>
                                        </filter>
                                    </filters>
                                    <artifactSet>
                                        <includes>
                                            <include>jline:*</include>
                                        </includes>
                                    </artifactSet>
                                    <shadedClassifierName>unshaded</shadedClassifierName>
				    <shadedArtifactAttached>true</shadedArtifactAttached>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>license-maven-plugin</artifactId>
                        <configuration>
                            <skipDownloadLicenses>true</skipDownloadLicenses>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
        </profile>
    </profiles>
</project>
