From 3d3c6de8c92739ba31cc97595955819d08b99ca2 Mon Sep 17 00:00:00 2001 From: "J.C. Hamlin" Date: Sat, 8 Aug 2020 14:32:02 -0500 Subject: [PATCH 1/4] Converted from maven to gradle and fixed to work with Java 14, Gradle 6.5.1, and Eclipse 2020-06-R --- .gitignore | 5 +++ .project | 17 +++++++++ Clipper Console/.classpath | 20 ++++------- Clipper Console/.project | 6 ++-- Clipper Console/build.gradle | 36 +++++++++++++++++++ Clipper Console/pom.xml | 28 --------------- Clipper GUI/.classpath | 20 ++++------- Clipper GUI/.project | 6 ++-- Clipper GUI/build.gradle | 36 +++++++++++++++++++ Clipper GUI/pom.xml | 28 --------------- Clipper/.classpath | 20 ++++------- Clipper/.project | 4 +-- Clipper/build.gradle | 32 +++++++++++++++++ Clipper/pom.xml | 22 ------------ .../src/de/lighti/clipper/DefaultClipper.java | 1 + Clipper/src/de/lighti/clipper/Point.java | 4 ++- settings.gradle | 3 ++ 17 files changed, 159 insertions(+), 129 deletions(-) create mode 100644 .project create mode 100644 Clipper Console/build.gradle delete mode 100644 Clipper Console/pom.xml create mode 100644 Clipper GUI/build.gradle delete mode 100644 Clipper GUI/pom.xml create mode 100644 Clipper/build.gradle delete mode 100644 Clipper/pom.xml create mode 100644 settings.gradle diff --git a/.gitignore b/.gitignore index 4644e4e..d04a8fc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,9 @@ +# Ignore Eclipse stuff .metadata target bin .settings + +# Ignore Gradle stuff +.gradle +build diff --git a/.project b/.project new file mode 100644 index 0000000..dae9338 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + clipper-java + Project clipper-java created by Buildship. + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.buildship.core.gradleprojectnature + + diff --git a/Clipper Console/.classpath b/Clipper Console/.classpath index 7233eb2..2bfdb57 100644 --- a/Clipper Console/.classpath +++ b/Clipper Console/.classpath @@ -1,21 +1,13 @@ - + - - - - - - - + + + + - - - - - - + diff --git a/Clipper Console/.project b/Clipper Console/.project index e3ecceb..9a83135 100644 --- a/Clipper Console/.project +++ b/Clipper Console/.project @@ -1,6 +1,6 @@ - Clipper Console + ClipperConsole @@ -11,13 +11,13 @@ - org.eclipse.m2e.core.maven2Builder + org.eclipse.buildship.core.gradleprojectbuilder - org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature + org.eclipse.buildship.core.gradleprojectnature diff --git a/Clipper Console/build.gradle b/Clipper Console/build.gradle new file mode 100644 index 0000000..c9b1455 --- /dev/null +++ b/Clipper Console/build.gradle @@ -0,0 +1,36 @@ +plugins { + id 'java' +} + +group = "de.lighti" +version = "6.4.2" +description = "A command line tool to read and process polygon files." + +dependencies { + compile project(':Clipper'); +} + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} + +jar { + manifest { + attributes 'Implementation-Title': project.name, + 'Implementation-Version': project.version + } +} + +sourceSets { + main { + java { + srcDirs 'src' + } + } +} + +tasks.withType(JavaCompile) { + options.compilerArgs << '-Xlint:unchecked' + options.deprecation = true +} diff --git a/Clipper Console/pom.xml b/Clipper Console/pom.xml deleted file mode 100644 index 7b6aabc..0000000 --- a/Clipper Console/pom.xml +++ /dev/null @@ -1,28 +0,0 @@ - - 4.0.0 - de.lighti - ClipperConsole - 6.4.2 - Clipper Console Application - A command line tool to read and process polygon files - - src - - - maven-compiler-plugin - 3.5.1 - - 1.8 - 1.8 - - - - - - - de.lighti - Clipper - 6.4.2 - - - \ No newline at end of file diff --git a/Clipper GUI/.classpath b/Clipper GUI/.classpath index 7233eb2..2bfdb57 100644 --- a/Clipper GUI/.classpath +++ b/Clipper GUI/.classpath @@ -1,21 +1,13 @@ - + - - - - - - - + + + + - - - - - - + diff --git a/Clipper GUI/.project b/Clipper GUI/.project index 545699e..e6c3122 100644 --- a/Clipper GUI/.project +++ b/Clipper GUI/.project @@ -1,6 +1,6 @@ - Clipper GUI + ClipperGUI @@ -11,13 +11,13 @@ - org.eclipse.m2e.core.maven2Builder + org.eclipse.buildship.core.gradleprojectbuilder - org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature + org.eclipse.buildship.core.gradleprojectnature diff --git a/Clipper GUI/build.gradle b/Clipper GUI/build.gradle new file mode 100644 index 0000000..70837b0 --- /dev/null +++ b/Clipper GUI/build.gradle @@ -0,0 +1,36 @@ +plugins { + id 'java' +} + +group = "de.lighti" +version = "6.4.2" +description = "A swing-based application to visualize the various operations of the Clipper library." + +dependencies { + compile project(':Clipper'); +} + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} + +jar { + manifest { + attributes 'Implementation-Title': project.name, + 'Implementation-Version': project.version + } +} + +sourceSets { + main { + java { + srcDirs 'src' + } + } +} + +tasks.withType(JavaCompile) { + options.compilerArgs << '-Xlint:unchecked' + options.deprecation = true +} diff --git a/Clipper GUI/pom.xml b/Clipper GUI/pom.xml deleted file mode 100644 index 30c4f99..0000000 --- a/Clipper GUI/pom.xml +++ /dev/null @@ -1,28 +0,0 @@ - - 4.0.0 - de.lighti - ClipperGUI - 6.4.2 - Clipper GUI Application - A swing-based application to visualize the various operations of the Clipper library - - src - - - maven-compiler-plugin - 3.5.1 - - 1.8 - 1.8 - - - - - - - de.lighti - Clipper - 6.4.2 - - - \ No newline at end of file diff --git a/Clipper/.classpath b/Clipper/.classpath index 149cb3c..4be791f 100644 --- a/Clipper/.classpath +++ b/Clipper/.classpath @@ -1,20 +1,12 @@ - + - - + + - - - - - - - - - - - + + + diff --git a/Clipper/.project b/Clipper/.project index 01f23cc..9f34631 100644 --- a/Clipper/.project +++ b/Clipper/.project @@ -11,13 +11,13 @@ - org.eclipse.m2e.core.maven2Builder + org.eclipse.buildship.core.gradleprojectbuilder - org.eclipse.m2e.core.maven2Nature org.eclipse.jdt.core.javanature + org.eclipse.buildship.core.gradleprojectnature diff --git a/Clipper/build.gradle b/Clipper/build.gradle new file mode 100644 index 0000000..f03789b --- /dev/null +++ b/Clipper/build.gradle @@ -0,0 +1,32 @@ +plugins { + id 'java' +} + +group = "de.lighti" +version = "6.4.2" +description = "Polygon Clipper is a library to execute various boolean operations (Union, Difference, XOR, etc.) on arbitrary 2D polygons, e.g. calculate the area in which two polygons overlap. It comes with two Demo applications, one for the console and one using a Swing based GUI." + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} + +jar { + manifest { + attributes 'Implementation-Title': project.name, + 'Implementation-Version': project.version + } +} + +sourceSets { + main { + java { + srcDirs 'src' + } + } +} + +tasks.withType(JavaCompile) { + options.compilerArgs << '-Xlint:unchecked' + options.deprecation = true +} diff --git a/Clipper/pom.xml b/Clipper/pom.xml deleted file mode 100644 index 6a48531..0000000 --- a/Clipper/pom.xml +++ /dev/null @@ -1,22 +0,0 @@ - - 4.0.0 - de.lighti - Clipper - 6.4.2 - A Polygon clipper for Java - Polygon Clipper is a library to execute various boolean operations (Union, Difference, XOR, etc.) on arbitrary 2D polygons, e.g. calculate the area in which two polygons overlap. It comes with two Demo applications, one for the console and one using a Swing based GUI. - - src - - - maven-compiler-plugin - 3.5.1 - - 1.8 - 1.8 - - - - - \ No newline at end of file diff --git a/Clipper/src/de/lighti/clipper/DefaultClipper.java b/Clipper/src/de/lighti/clipper/DefaultClipper.java index 9b01cb4..5ef5f3e 100644 --- a/Clipper/src/de/lighti/clipper/DefaultClipper.java +++ b/Clipper/src/de/lighti/clipper/DefaultClipper.java @@ -1316,6 +1316,7 @@ private boolean fixupIntersectionOrder() { //---------------------------------------------------------------------- + @SuppressWarnings("unused") private void fixupOutPolyline( OutRec outrec ) { Path.OutPt pp = outrec.getPoints(); Path.OutPt lastPP = pp.prev; diff --git a/Clipper/src/de/lighti/clipper/Point.java b/Clipper/src/de/lighti/clipper/Point.java index 98f290b..ea9389a 100644 --- a/Clipper/src/de/lighti/clipper/Point.java +++ b/Clipper/src/de/lighti/clipper/Point.java @@ -162,7 +162,8 @@ else if (pt2.y > pt1.y == pt2.y < pt3.y) { } } - private final static NumberComparator NUMBER_COMPARATOR = new NumberComparator(); + @SuppressWarnings("rawtypes") + private static final NumberComparator NUMBER_COMPARATOR = new NumberComparator(); protected T x; @@ -180,6 +181,7 @@ protected Point( T x, T y, T z ) { this.z = z; } + @SuppressWarnings("unchecked") @Override public boolean equals( Object obj ) { if (obj == null) { diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..379bdbd --- /dev/null +++ b/settings.gradle @@ -0,0 +1,3 @@ +include 'Clipper', 'Clipper Console', 'Clipper GUI' +project(':Clipper Console').name = 'ClipperConsole' +project(':Clipper GUI').name = 'ClipperGUI' \ No newline at end of file From 83fee36f91b20c09eacd89258a037233c4531cc0 Mon Sep 17 00:00:00 2001 From: "J.C. Hamlin" Date: Sat, 8 Aug 2020 16:18:33 -0500 Subject: [PATCH 2/4] Added maven plugin so the jars could be installed into a local m2 repository --- Clipper Console/build.gradle | 1 + Clipper GUI/build.gradle | 1 + Clipper/build.gradle | 1 + 3 files changed, 3 insertions(+) diff --git a/Clipper Console/build.gradle b/Clipper Console/build.gradle index c9b1455..0ff1636 100644 --- a/Clipper Console/build.gradle +++ b/Clipper Console/build.gradle @@ -1,5 +1,6 @@ plugins { id 'java' + id 'maven' } group = "de.lighti" diff --git a/Clipper GUI/build.gradle b/Clipper GUI/build.gradle index 70837b0..06ab490 100644 --- a/Clipper GUI/build.gradle +++ b/Clipper GUI/build.gradle @@ -1,5 +1,6 @@ plugins { id 'java' + id 'maven' } group = "de.lighti" diff --git a/Clipper/build.gradle b/Clipper/build.gradle index f03789b..06285b4 100644 --- a/Clipper/build.gradle +++ b/Clipper/build.gradle @@ -1,5 +1,6 @@ plugins { id 'java' + id 'maven' } group = "de.lighti" From f71f215c9292aa99b6d51ea9a146d9ab986128d9 Mon Sep 17 00:00:00 2001 From: "J.C. Hamlin" Date: Sat, 8 Aug 2020 16:26:58 -0500 Subject: [PATCH 3/4] Include Eclipse configuration files required for someone to use Import Existing Projects... in Eclipse --- .gitignore | 5 +---- .settings/org.eclipse.buildship.core.prefs | 2 ++ Clipper Console/.settings/org.eclipse.buildship.core.prefs | 2 ++ Clipper Console/.settings/org.eclipse.jdt.core.prefs | 4 ++++ Clipper GUI/.settings/org.eclipse.buildship.core.prefs | 2 ++ Clipper GUI/.settings/org.eclipse.jdt.core.prefs | 4 ++++ Clipper/.settings/org.eclipse.buildship.core.prefs | 2 ++ Clipper/.settings/org.eclipse.jdt.core.prefs | 4 ++++ 8 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 .settings/org.eclipse.buildship.core.prefs create mode 100644 Clipper Console/.settings/org.eclipse.buildship.core.prefs create mode 100644 Clipper Console/.settings/org.eclipse.jdt.core.prefs create mode 100644 Clipper GUI/.settings/org.eclipse.buildship.core.prefs create mode 100644 Clipper GUI/.settings/org.eclipse.jdt.core.prefs create mode 100644 Clipper/.settings/org.eclipse.buildship.core.prefs create mode 100644 Clipper/.settings/org.eclipse.jdt.core.prefs diff --git a/.gitignore b/.gitignore index d04a8fc..95cad72 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,5 @@ -# Ignore Eclipse stuff -.metadata -target +# Ignore Eclipse output directory bin -.settings # Ignore Gradle stuff .gradle diff --git a/.settings/org.eclipse.buildship.core.prefs b/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000..e889521 --- /dev/null +++ b/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir= +eclipse.preferences.version=1 diff --git a/Clipper Console/.settings/org.eclipse.buildship.core.prefs b/Clipper Console/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000..b1886ad --- /dev/null +++ b/Clipper Console/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir=.. +eclipse.preferences.version=1 diff --git a/Clipper Console/.settings/org.eclipse.jdt.core.prefs b/Clipper Console/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..35068d9 --- /dev/null +++ b/Clipper Console/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/Clipper GUI/.settings/org.eclipse.buildship.core.prefs b/Clipper GUI/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000..b1886ad --- /dev/null +++ b/Clipper GUI/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir=.. +eclipse.preferences.version=1 diff --git a/Clipper GUI/.settings/org.eclipse.jdt.core.prefs b/Clipper GUI/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..35068d9 --- /dev/null +++ b/Clipper GUI/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/Clipper/.settings/org.eclipse.buildship.core.prefs b/Clipper/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000..b1886ad --- /dev/null +++ b/Clipper/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir=.. +eclipse.preferences.version=1 diff --git a/Clipper/.settings/org.eclipse.jdt.core.prefs b/Clipper/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..35068d9 --- /dev/null +++ b/Clipper/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.source=1.8 From b4dcd50c51139fbed35be2dadc01a3497b1c09cb Mon Sep 17 00:00:00 2001 From: "J.C. Hamlin" Date: Sun, 9 Aug 2020 14:34:51 -0500 Subject: [PATCH 4/4] Moved all subproject Gradle logic into the parent build.gradle. Added publishing of binary, sources, and JavaDoc. --- .project | 2 +- Clipper Console/build.gradle | 37 ------------ Clipper GUI/build.gradle | 37 ------------ Clipper/build.gradle | 33 ----------- Clipper/src/de/lighti/clipper/Path.java | 2 +- Clipper/src/de/lighti/clipper/Paths.java | 2 +- build.gradle | 72 ++++++++++++++++++++++++ settings.gradle | 2 + 8 files changed, 77 insertions(+), 110 deletions(-) delete mode 100644 Clipper Console/build.gradle delete mode 100644 Clipper GUI/build.gradle delete mode 100644 Clipper/build.gradle create mode 100644 build.gradle diff --git a/.project b/.project index dae9338..3aa51d4 100644 --- a/.project +++ b/.project @@ -1,6 +1,6 @@ - clipper-java + ClipperJava Project clipper-java created by Buildship. diff --git a/Clipper Console/build.gradle b/Clipper Console/build.gradle deleted file mode 100644 index 0ff1636..0000000 --- a/Clipper Console/build.gradle +++ /dev/null @@ -1,37 +0,0 @@ -plugins { - id 'java' - id 'maven' -} - -group = "de.lighti" -version = "6.4.2" -description = "A command line tool to read and process polygon files." - -dependencies { - compile project(':Clipper'); -} - -java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 -} - -jar { - manifest { - attributes 'Implementation-Title': project.name, - 'Implementation-Version': project.version - } -} - -sourceSets { - main { - java { - srcDirs 'src' - } - } -} - -tasks.withType(JavaCompile) { - options.compilerArgs << '-Xlint:unchecked' - options.deprecation = true -} diff --git a/Clipper GUI/build.gradle b/Clipper GUI/build.gradle deleted file mode 100644 index 06ab490..0000000 --- a/Clipper GUI/build.gradle +++ /dev/null @@ -1,37 +0,0 @@ -plugins { - id 'java' - id 'maven' -} - -group = "de.lighti" -version = "6.4.2" -description = "A swing-based application to visualize the various operations of the Clipper library." - -dependencies { - compile project(':Clipper'); -} - -java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 -} - -jar { - manifest { - attributes 'Implementation-Title': project.name, - 'Implementation-Version': project.version - } -} - -sourceSets { - main { - java { - srcDirs 'src' - } - } -} - -tasks.withType(JavaCompile) { - options.compilerArgs << '-Xlint:unchecked' - options.deprecation = true -} diff --git a/Clipper/build.gradle b/Clipper/build.gradle deleted file mode 100644 index 06285b4..0000000 --- a/Clipper/build.gradle +++ /dev/null @@ -1,33 +0,0 @@ -plugins { - id 'java' - id 'maven' -} - -group = "de.lighti" -version = "6.4.2" -description = "Polygon Clipper is a library to execute various boolean operations (Union, Difference, XOR, etc.) on arbitrary 2D polygons, e.g. calculate the area in which two polygons overlap. It comes with two Demo applications, one for the console and one using a Swing based GUI." - -java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 -} - -jar { - manifest { - attributes 'Implementation-Title': project.name, - 'Implementation-Version': project.version - } -} - -sourceSets { - main { - java { - srcDirs 'src' - } - } -} - -tasks.withType(JavaCompile) { - options.compilerArgs << '-Xlint:unchecked' - options.deprecation = true -} diff --git a/Clipper/src/de/lighti/clipper/Path.java b/Clipper/src/de/lighti/clipper/Path.java index ddf7492..f6cbeba 100644 --- a/Clipper/src/de/lighti/clipper/Path.java +++ b/Clipper/src/de/lighti/clipper/Path.java @@ -6,7 +6,7 @@ import java.util.Collections; /** - * A pure convenience class to avoid writing List everywhere. + * A pure convenience class to avoid writing List<LongPoint> everywhere. * * @author Tobias Mahlmann * diff --git a/Clipper/src/de/lighti/clipper/Paths.java b/Clipper/src/de/lighti/clipper/Paths.java index 3084f0b..f2a9722 100644 --- a/Clipper/src/de/lighti/clipper/Paths.java +++ b/Clipper/src/de/lighti/clipper/Paths.java @@ -3,7 +3,7 @@ import java.util.ArrayList; /** - * A pure convenience class to avoid writing List everywhere. + * A pure convenience class to avoid writing List<Path> everywhere. * * @author Tobias Mahlmann * diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..88f960b --- /dev/null +++ b/build.gradle @@ -0,0 +1,72 @@ +allprojects { + group = "de.lighti" + version = "6.4.2" +} + +description = 'ClipperJava is a 1:1 Java port of the Clipper project developed by Angus Johnson, which as an implementation of the algorithm proposed by Bala R. Vatti. Clipper has various boolean operations (Union, Difference, XOR, etc.) on arbitrary 2D polygons, e.g. calculate the area in which two polygons overlap. It comes with two Demo applications, one for the Console and one using a Swing-based GUI.' + +subprojects { + apply plugin: 'java' + apply plugin: 'maven-publish' + + java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + withSourcesJar() + withJavadocJar() + } + + jar { + manifest { + attributes 'Implementation-Title': project.name, + 'Implementation-Version': project.version + } + } + + sourceSets { + main { + java { + srcDirs 'src' + } + } + } + + tasks.withType(JavaCompile) { + options.compilerArgs << '-Xlint:unchecked' + options.deprecation = true + } + + publishing { + publications { + ClipperJava(MavenPublication) { + from components.java + } + } + } + + javadoc { + if(JavaVersion.current().isJava9Compatible()) { + options.addBooleanOption('html5', true) + } + } +} + +project(':Clipper') { + description = 'Clipper is a library with various boolean operations (Union, Difference, XOR, etc.) on arbitrary 2D polygons, e.g. calculate the area in which two polygons overlap.' +} + +project(':ClipperConsole') { + description = 'ClipperConsole is a command line tool to read and process polygon files.' + + dependencies { + implementation project(':Clipper') + } +} + +project(':ClipperGUI') { + description = 'ClipperGUI is a swing-based application to visualize the various operations of the Clipper library.' + + dependencies { + implementation project(':Clipper') + } +} diff --git a/settings.gradle b/settings.gradle index 379bdbd..a88141e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,5 @@ +rootProject.name='ClipperJava' include 'Clipper', 'Clipper Console', 'Clipper GUI' +project(':Clipper').name = 'Clipper' project(':Clipper Console').name = 'ClipperConsole' project(':Clipper GUI').name = 'ClipperGUI' \ No newline at end of file