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/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' +} +``` + diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..f62ff08 --- /dev/null +++ b/build.gradle @@ -0,0 +1,17 @@ +plugins { + id 'java' +} + +group 'Quadtree' +version '1.1' + +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());