<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>com.umlet</groupId>
		<artifactId>umlet-parent</artifactId>
		<version>15.1</version>
	</parent>

	<artifactId>umlet-eclipse-feature</artifactId>
	<packaging>eclipse-feature</packaging>

	<repositories>
		<repository>
			<id>eclipse-mars</id>
			<url>http://download.eclipse.org/releases/mars</url> <!-- update to e.g. photon works but only with tyco v2.3.0 (which requires java11) otherwise animal-sniffer-plugin fails -->
			<layout>p2</layout>
		</repository>
	</repositories>

	<build>
		<plugins>
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-maven-plugin</artifactId>
				<version>${tycho.version}</version>
				<extensions>true</extensions>
			</plugin>
			<plugin>
				<artifactId>maven-antrun-plugin</artifactId>
				<executions>
					<!-- update versions in feature.xml with current pom.xml version (replace the -<qualifier> with ".qualifier" to be compatible with OSGI versioning; ".qualifier" will be replaced by tycho with a timestamp, other qualifier values are not supported) -->
					<execution>
						<id>updateManifestVersion</id>
						<!-- this goal must be called explicitly at the same time the mvn version is updated (otherwise tycho would still use the old version) -->
						<goals>
							<goal>run</goal>
						</goals>
						<configuration>
							<target>
								<property name="newVersionTemp" value="${newVersion}" />
								<loadresource property="newVersionOsgi">
									<propertyresource name="newVersionTemp" />
									<filterchain>
										<tokenfilter>
											<replaceregex pattern="-.*" replace=".qualifier" />
										</tokenfilter>
									</filterchain>
								</loadresource>
								<replaceregexp file="feature.xml" match='(version=").*(")' replace="\1${newVersionOsgi}\2" byline="true" />
								<echo message="Updated feature.xml versions to ${newVersionOsgi} (derived from VM Argument: ${newVersion})" />
							</target>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>
