From 0ecaf687da92564270ed31bcee84685b701bb407 Mon Sep 17 00:00:00 2001
From: Kai Brassel <mail@khbrassel.de>
Date: Tue, 5 Apr 2022 12:28:36 +0200
Subject: [PATCH] Advance to tycho 2.7.0, Indriya 2.1.3, Java 17; adapt tests

---
 de.hftstuttgart.cityunits.feature/feature.xml |  6 +-
 de.hftstuttgart.cityunits.model/.classpath    |  2 +-
 .../META-INF/MANIFEST.MF                      |  6 +-
 .../cityunits/model/NullableQuantity.java     |  4 +-
 de.hftstuttgart.cityunits.target/.project     | 17 -----
 .../HowToDefineTargetPlatform.md              | 11 ---
 "de.hftstuttgart.cityunits.target/Icon\r"     |  0
 .../cityunits.target.target                   | 23 ------
 de.hftstuttgart.cityunits.target/pom.xml      | 15 ----
 de.hftstuttgart.cityunits.tests/.classpath    |  2 +-
 pom.xml                                       | 76 +++++++------------
 11 files changed, 35 insertions(+), 127 deletions(-)
 delete mode 100644 de.hftstuttgart.cityunits.target/.project
 delete mode 100644 de.hftstuttgart.cityunits.target/HowToDefineTargetPlatform.md
 delete mode 100644 "de.hftstuttgart.cityunits.target/Icon\r"
 delete mode 100644 de.hftstuttgart.cityunits.target/cityunits.target.target
 delete mode 100644 de.hftstuttgart.cityunits.target/pom.xml

diff --git a/de.hftstuttgart.cityunits.feature/feature.xml b/de.hftstuttgart.cityunits.feature/feature.xml
index 33e749e..1f32635 100644
--- a/de.hftstuttgart.cityunits.feature/feature.xml
+++ b/de.hftstuttgart.cityunits.feature/feature.xml
@@ -21,11 +21,11 @@ Certain units relevant to City simulations are also added.
    </license>
 
    <requires>
-      <import plugin="tech.units.indriya" version="2.1.1" match="compatible"/>
-      <import plugin="javax.measure.unit-api" version="2.1.1" match="compatible"/>
+      <import plugin="tech.units.indriya" version="2.1.3" match="compatible"/>
+      <import plugin="javax.measure.unit-api" version="2.1.3" match="compatible"/>
       <import plugin="org.eclipse.core.runtime" version="3.8.0" match="compatible"/>
-      <import plugin="org.eclipse.emf.ecore"/>
       <import plugin="uom-lib-common" version="2.1.0" match="compatible"/>
+      <import plugin="org.eclipse.emf.ecore"/>
       <import plugin="org.eclipse.emf.edit" version="2.8.0" match="compatible"/>
    </requires>
 
diff --git a/de.hftstuttgart.cityunits.model/.classpath b/de.hftstuttgart.cityunits.model/.classpath
index 41fde47..24b87a3 100644
--- a/de.hftstuttgart.cityunits.model/.classpath
+++ b/de.hftstuttgart.cityunits.model/.classpath
@@ -6,6 +6,6 @@
 		</attributes>
 	</classpathentry>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="src/"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/de.hftstuttgart.cityunits.model/META-INF/MANIFEST.MF b/de.hftstuttgart.cityunits.model/META-INF/MANIFEST.MF
index 38e163b..f185553 100644
--- a/de.hftstuttgart.cityunits.model/META-INF/MANIFEST.MF
+++ b/de.hftstuttgart.cityunits.model/META-INF/MANIFEST.MF
@@ -7,11 +7,11 @@ Bundle-ClassPath: .
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
 Automatic-Module-Name: de.hftstuttgart.cityunits.model
-Require-Bundle: tech.units.indriya;bundle-version="[2.1.1,3.0.0)",
- javax.measure.unit-api;bundle-version="[2.1.1,3.0.0)",
+Require-Bundle: tech.units.indriya;bundle-version="[2.1.3,3.0.0)",
+ javax.measure.unit-api;bundle-version="[2.1.3,3.0.0)",
  org.eclipse.core.runtime,
  org.eclipse.emf.ecore;visibility:=reexport,
- uom-lib-common;bundle-version="[2.1.0,3.0.0)"
+ uom-lib-common;bundle-version="2.1.0"
 Eclipse-LazyStart: true
 Bundle-ActivationPolicy: lazy
 Export-Package: de.hftstuttgart.cityunits.model;
diff --git a/de.hftstuttgart.cityunits.model/src/de/hftstuttgart/cityunits/model/NullableQuantity.java b/de.hftstuttgart.cityunits.model/src/de/hftstuttgart/cityunits/model/NullableQuantity.java
index 798f73e..9afb2d1 100644
--- a/de.hftstuttgart.cityunits.model/src/de/hftstuttgart/cityunits/model/NullableQuantity.java
+++ b/de.hftstuttgart.cityunits.model/src/de/hftstuttgart/cityunits/model/NullableQuantity.java
@@ -8,8 +8,6 @@ import java.util.Optional;
 import javax.measure.Quantity;
 import javax.measure.Unit;
 
-import org.eclipse.core.runtime.Platform;
-
 import tech.units.indriya.AbstractUnit;
 import tech.units.indriya.format.SimpleQuantityFormat;
 import tech.units.indriya.quantity.Quantities;
@@ -49,7 +47,7 @@ public class NullableQuantity {
 				// number and unit could not be parsed: default to dimensionless null quantity 
 				newNullableQuantity = new NullQuantity(AbstractUnit.ONE);
 			}
-		} catch (final IllegalArgumentException ex) { // Quantity could not be parsed
+		} catch (final RuntimeException ex) { // Quantity could not be parsed
 			// unit could not be parsed: default to dimensionless quantity 
 			newNullableQuantity = create(num, AbstractUnit.ONE);
 		}
diff --git a/de.hftstuttgart.cityunits.target/.project b/de.hftstuttgart.cityunits.target/.project
deleted file mode 100644
index 7b60485..0000000
--- a/de.hftstuttgart.cityunits.target/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>de.hftstuttgart.cityunits.target</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.m2e.core.maven2Builder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.m2e.core.maven2Nature</nature>
-	</natures>
-</projectDescription>
diff --git a/de.hftstuttgart.cityunits.target/HowToDefineTargetPlatform.md b/de.hftstuttgart.cityunits.target/HowToDefineTargetPlatform.md
deleted file mode 100644
index ce2b82d..0000000
--- a/de.hftstuttgart.cityunits.target/HowToDefineTargetPlatform.md
+++ /dev/null
@@ -1,11 +0,0 @@
-# How to Define Eclipse Target Platform
-
-Create new or edit old `.target` file.
-
-In Target Definition editor add target definition file and add six features from four P2 sites:
-
-* From the site for latest Eclipse release, e.g. `http://download.eclipse.org/releases/2020-12` add: `Eclipse RT Target Platform Components -> Equinox Target Components` and `General Purpose Tools -> Eclipse e4 Tools Developer Resources`.
-* From the site for latest Orbit release, e.g. `https://download.eclipse.org/tools/orbit/downloads/2020-12/` add: `JUnit` and `JUnit Jupiter API` from category `Orbit Bundles By Scope: Testing`.
-* From Eclipse Source site for EMF `https://transfer.hft-stuttgart.de/pages/neqmodplus/indriya-p2/release_target_211/` and: `Uncategorized -> Indriya P2`.
-* From HfT Stuttgart transfer site for Indriya Units `http://download.eclipse.org/ecp/releases/releases_target_125/` and: `All SDKs -> EMF Forms SDK`.
-* From HfT Stuttgart transfer site for Indriya Units `http://download.eclipse.org/ecp/releases/releases_target_125/` and: `EMF Client Platform Features -> ECP SDK e4 (Target Feature)`.
diff --git "a/de.hftstuttgart.cityunits.target/Icon\r" "b/de.hftstuttgart.cityunits.target/Icon\r"
deleted file mode 100644
index e69de29..0000000
diff --git a/de.hftstuttgart.cityunits.target/cityunits.target.target b/de.hftstuttgart.cityunits.target/cityunits.target.target
deleted file mode 100644
index f92425d..0000000
--- a/de.hftstuttgart.cityunits.target/cityunits.target.target
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?pde version="3.8"?>
-<target name="RCP, EMF Forms 2020-12">
-	<locations>
-		<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="false" type="InstallableUnit">
-			<repository location="http://download.eclipse.org/releases/2020-12"/>
-			<unit id="org.eclipse.equinox.sdk.feature.group" version="3.21.0.v20201128-0731"/>
-			<unit id="org.eclipse.e4.core.tools.feature.source.feature.group" version="4.18.0.v20201026-0947"/>
-		</location>
-		<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="false" type="InstallableUnit">
-			<repository location="https://download.eclipse.org/tools/orbit/downloads/2020-12/"/>
-			<unit id="org.junit.jupiter.api" version="5.7.0.v20201026-1537"/>
-			<unit id="org.junit" version="4.13.0.v20200204-1500"/>
-		</location>
-		<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="false" type="InstallableUnit">
-			<repository location="https://transfer.hft-stuttgart.de/pages/neqmodplus/indriya-p2/release_target_211/"/>
-			<unit id="de.hft-stuttgart.indriya.feature.feature.group" version="1.0.0"/>
-		</location>
-		<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="false" type="InstallableUnit">
-			<repository location="http://download.eclipse.org/ecp/releases/releases_target_125/"/>
-		</location>
-	</locations>
-</target>
\ No newline at end of file
diff --git a/de.hftstuttgart.cityunits.target/pom.xml b/de.hftstuttgart.cityunits.target/pom.xml
deleted file mode 100644
index e2006e6..0000000
--- a/de.hftstuttgart.cityunits.target/pom.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	<artifactId>de.hftstuttgart.cityunits.target</artifactId>
-	<packaging>eclipse-target-definition</packaging>
-	<name>City Units Target Definition</name>
-
-	<parent>
-		<groupId>de.hftstuttgart</groupId>
-		<artifactId>de.hftstuttgart.cityunits</artifactId>
-		<version>1.1.0</version>
-	</parent>
-
-</project>
\ No newline at end of file
diff --git a/de.hftstuttgart.cityunits.tests/.classpath b/de.hftstuttgart.cityunits.tests/.classpath
index 0850a94..570f04d 100644
--- a/de.hftstuttgart.cityunits.tests/.classpath
+++ b/de.hftstuttgart.cityunits.tests/.classpath
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-16">
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
 		<attributes>
 			<attribute name="maven.pomderived" value="true"/>
 		</attributes>
diff --git a/pom.xml b/pom.xml
index 2d9d4f1..2b34bbe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
 	<name>City Units Parent POM</name>
 
 	<properties>
-		<tycho-version>2.1.0</tycho-version>
+		<tycho-version>2.7.0</tycho-version>
 	</properties>
 
 	<build>
@@ -30,63 +30,39 @@
 				<groupId>org.eclipse.tycho</groupId>
 				<artifactId>target-platform-configuration</artifactId>
 				<version>${tycho-version}</version>
-				<configuration>
-					<pomDependencies>consider</pomDependencies>
-					<target>
-						<artifact>
-							<groupId>de.hftstuttgart</groupId>
-							<artifactId>de.hftstuttgart.cityunits.target</artifactId>
-							<version>1.1.0</version>
-						</artifact>
-					</target>
-					<environments>
-						<environment>
-							<os>win32</os>
-							<ws>win32</ws>
-							<arch>x86_64</arch>
-						</environment>
-						<environment>
-							<os>linux</os>
-							<ws>gtk</ws>
-							<arch>x86_64</arch>
-						</environment>
-						<environment>
-							<os>macosx</os>
-							<ws>cocoa</ws>
-							<arch>x86_64</arch>
-						</environment>
-					</environments>
-				</configuration>
 			</plugin>
 
 			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-surefire-plugin</artifactId>
-				<version>2.22.2</version>
+				<groupId>org.eclipse.tycho</groupId>
+				<artifactId>tycho-surefire-plugin</artifactId>
+				<version>${tycho-version}</version>
+				<configuration>
+					<testFailureIgnore>false</testFailureIgnore>
+					<useUIHarness>false</useUIHarness>
+				</configuration>
 			</plugin>
 		</plugins>
 	</build>
-
-	<dependencies>
-		<dependency>
-			<groupId>tech.units</groupId>
-			<artifactId>indriya</artifactId>
-			<version>2.1.1</version>
-		</dependency>
-		<dependency>
-			<groupId>jakarta.inject</groupId>
-			<artifactId>jakarta.inject-api</artifactId>
-			<version>2.0.0</version>
-		</dependency>
-		<dependency>
-			<groupId>jakarta.annotation</groupId>
-			<artifactId>jakarta.annotation-api</artifactId>
-			<version>2.0.0</version>
-		</dependency>
-	</dependencies>
+	
+	<repositories>
+		<repository>
+			<id>eclipse-2022-03</id>
+			<url>https://download.eclipse.org/releases/2022-03</url>
+			<layout>p2</layout>
+		</repository>
+		<repository>
+			<id>Indriya</id>
+			<url>https://transfer.hft-stuttgart.de/pages/neqmodplus/indriya-p2/repository/</url>
+			<layout>p2</layout>
+		</repository>
+		<repository>
+			<id>CityUnits</id>
+			<url>https://transfer.hft-stuttgart.de/pages/neqmodplus/de.hft-stuttgart.cityunits/release_target_110/</url>
+			<layout>p2</layout>
+		</repository>
+	</repositories>
 
 	<modules>
-		<module>de.hftstuttgart.cityunits.target</module>
 		<module>de.hftstuttgart.cityunits.feature</module>
 		<module>de.hftstuttgart.cityunits.model</module>
 		<module>de.hftstuttgart.cityunits.model.edit</module>
-- 
GitLab