From e9ed8a48c781b384f681f270df068f5c3315159a Mon Sep 17 00:00:00 2001 From: Argonaught Date: Sun, 18 Jul 2021 16:53:03 +0100 Subject: [PATCH 1/3] added gradle support fixed class path resource loading issue in test --- .gitignore | 3 +++ build.gradle | 17 +++++++++++++++++ settings.gradle | 1 + .../github/varunpant/quadtree/SpatialTest.java | 5 +++-- 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 build.gradle create mode 100644 settings.gradle diff --git a/.gitignore b/.gitignore index 2826b30..d4afe19 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ target/ .iws # Mac crap .DS_Store +build/ +.gradle/ +out/ diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..09d50eb --- /dev/null +++ b/build.gradle @@ -0,0 +1,17 @@ +plugins { + id 'java' +} + +group 'Quadtree' +version '1.0' + +repositories { + mavenCentral() +} + + +dependencies { + testRuntimeOnly group: 'junit', name: 'junit', version: '4.7' + testImplementation group: 'junit', name: 'junit-dep', version: '4.7' + +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..ad7cee3 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'QuadTree' \ No newline at end of file diff --git a/src/test/java/com/github/varunpant/quadtree/SpatialTest.java b/src/test/java/com/github/varunpant/quadtree/SpatialTest.java index b0a74f7..73383c2 100644 --- a/src/test/java/com/github/varunpant/quadtree/SpatialTest.java +++ b/src/test/java/com/github/varunpant/quadtree/SpatialTest.java @@ -47,8 +47,9 @@ private static String[] readAllTextFileLines(String fileName) { @Test public void testTree(){ _pointList = new ArrayList>(); - URL classpathResource = Thread.currentThread().getContextClassLoader().getResource(""); - String resourcePath = classpathResource.getPath()+"points.txt"; + URL classpathResource = ClassLoader.getSystemClassLoader().getResource("points.txt"); + String resourcePath = classpathResource.getPath(); + LoadPointsFromFile(resourcePath); assertEquals("Expecting 844 points",844,_pointList.size()); From 2fbdeb9a6229d6f5f4f9869937d7f73abba9a2b3 Mon Sep 17 00:00:00 2001 From: Argonaught Date: Sun, 18 Jul 2021 17:12:28 +0100 Subject: [PATCH 2/3] updating README.md --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 194ef31..4ae9571 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,26 @@ This is a Java implementation of [Quadtree](http://en.wikipedia.org/wiki/Quadtre [![CircleCI](https://circleci.com/gh/varunpant/Quadtree.svg?style=svg)](https://circleci.com/gh/varunpant/Quadtree) ![Illustration](http://upload.wikimedia.org/wikipedia/commons/8/8b/Point_quadtree.svg "This image is for Illustration only") + + +## Adding as a gradle dep + +in lieu of setting up a build and publishing to a maven repo, the project has been converted to gradle to use a plugin that clones, builds and creates dependencies on gradle projects in git + +in gradle.build +```groovy +git { + implementation 'https://github.com/Argonaught/Quadtree.git', { + tag '1.1' + } +} +``` + + +in gradle.settings +```groovy +plugins { + id 'com.alexvasilkov.git-dependencies' version '2.0.1' +} +``` + From 1689c3c2a8805968c06686cf6d2c5eb5379d2e31 Mon Sep 17 00:00:00 2001 From: Argonaught Date: Sun, 18 Jul 2021 17:12:47 +0100 Subject: [PATCH 3/3] bumping version to 1.1 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 09d50eb..f62ff08 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ plugins { } group 'Quadtree' -version '1.0' +version '1.1' repositories { mavenCentral()