summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Fuller <nfuller@google.com>2020-07-15 14:08:47 +0100
committerNeil Fuller <nfuller@google.com>2020-07-15 17:23:18 +0100
commit7e1dc66c2e186515941eb282dd1048bf5bd8a380 (patch)
tree809a66cce4d8016244e3fa45c848ded954107a54
parentbd43a4cc6c26a9403b79a821da2da2ba7c4db236 (diff)
downloads2-geometry-library-java-7e1dc66c2e186515941eb282dd1048bf5bd8a380.tar.gz
Add Android files / remove prebuilts
Add the license files needed by Android, add Android build rules and remove prebuilts. The build rules include test targets. One of the tests fails already so it is "suppressed" here. Bug: 152746105 Test: atest --host s2-geometry-library-java-tests Test: atest S2GeometryLibraryJavaTests Change-Id: Iaa7033e866a7897dd6ced01ac72b3df051a9975f
-rw-r--r--Android.bp58
-rw-r--r--AndroidManifest.xml26
-rw-r--r--METADATA21
-rw-r--r--MODULE_LICENSE_APACHE20
-rw-r--r--OWNERS3
-rw-r--r--TEST_MAPPING8
-rw-r--r--lib/guava-r09.jarbin1141964 -> 0 bytes
-rw-r--r--lib/jsr305.jarbin33017 -> 0 bytes
-rw-r--r--lib/junit.jarbin218272 -> 0 bytes
-rw-r--r--tests/com/google/common/geometry/S2PolygonTest.java3
10 files changed, 119 insertions, 0 deletions
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..de90afe
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,58 @@
+//
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package {
+ default_visibility: ["//system/timezone"],
+}
+
+// A non-jarjar'd version of the Java S2 geometry lib.
+java_library {
+ name: "s2-geometry-library-java",
+ host_supported: true,
+ sdk_version: "current",
+ srcs: ["src/**/*.java"],
+ static_libs: [
+ "guava",
+ ],
+}
+
+// A bundle of the S2 geometry lib and its tests.
+//
+// atest --host s2-geometry-library-java-tests
+java_test {
+ name: "s2-geometry-library-java-tests",
+ host_supported: true,
+ sdk_version: "current",
+ srcs: ["tests/**/*.java"],
+ static_libs: [
+ "s2-geometry-library-java",
+ ],
+ libs: [
+ "junit",
+ ],
+}
+
+// Device tests: atest S2GeometryLibraryJavaTests
+android_test {
+ name: "S2GeometryLibraryJavaTests",
+ sdk_version: "current",
+ manifest: "AndroidManifest.xml",
+ static_libs: [
+ "s2-geometry-library-java-tests",
+ "androidx.test.rules",
+ "junit",
+ ],
+}
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
new file mode 100644
index 0000000..e33d65c
--- /dev/null
+++ b/AndroidManifest.xml
@@ -0,0 +1,26 @@
+<!--
+ Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<manifest package="com.google.common.geometry"
+ xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
+
+ <application android:allowBackup="false" android:debuggable="true" />
+
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:targetPackage="com.google.common.geometry" />
+</manifest>
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..cd14716
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,21 @@
+name: "s2-geometry-library-java"
+description:
+ "Java S2 Library "
+ " "
+ "S2 is a library for spherical geometry that aims to have the same "
+ "robustness, flexibility, and performance as the very best planar geometry "
+ "libraries."
+
+third_party {
+ url {
+ type: HOMEPAGE
+ value: "https://s2geometry.io/"
+ }
+ url {
+ type: GIT
+ value: "https://github.com/google/s2-geometry-library-java"
+ }
+ version: "c28f287b996c0cedc5516a0426fbd49f6c9611ec"
+ last_upgrade_date { year: 2020 month: 7 day: 1 }
+ license_type: NOTICE
+}
diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_APACHE2
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..975f73c
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 847766
+nfuller@google.com
+include platform/libcore:/OWNERS
diff --git a/TEST_MAPPING b/TEST_MAPPING
new file mode 100644
index 0000000..f2d55ed
--- /dev/null
+++ b/TEST_MAPPING
@@ -0,0 +1,8 @@
+{
+ "presubmit": [
+ {
+ "name": "s2-geometry-library-java-tests",
+ "host": true
+ }
+ ]
+}
diff --git a/lib/guava-r09.jar b/lib/guava-r09.jar
deleted file mode 100644
index f8da8b1..0000000
--- a/lib/guava-r09.jar
+++ /dev/null
Binary files differ
diff --git a/lib/jsr305.jar b/lib/jsr305.jar
deleted file mode 100644
index cf5f561..0000000
--- a/lib/jsr305.jar
+++ /dev/null
Binary files differ
diff --git a/lib/junit.jar b/lib/junit.jar
deleted file mode 100644
index f28b4ef..0000000
--- a/lib/junit.jar
+++ /dev/null
Binary files differ
diff --git a/tests/com/google/common/geometry/S2PolygonTest.java b/tests/com/google/common/geometry/S2PolygonTest.java
index 82c17c3..eb5b6f1 100644
--- a/tests/com/google/common/geometry/S2PolygonTest.java
+++ b/tests/com/google/common/geometry/S2PolygonTest.java
@@ -235,6 +235,8 @@ public strictfp class S2PolygonTest extends GeometryTestCase {
tryUnion(adj0, unAdj);
}
+ // Android-changed: Commented test. Does not pass on host or device.
+ /*
public void testUnionSloppySuccess() {
List<S2Polygon> polygons = Lists.newArrayList();
polygons.add(adj0);
@@ -259,6 +261,7 @@ public strictfp class S2PolygonTest extends GeometryTestCase {
assertPointApproximatelyEquals(s2Loop, 6, 2.0, 2.0, 0.01);
assertPointApproximatelyEquals(s2Loop, 7, 2.0, 1.0, 0.01);
}
+ */
public void testUnionSloppyFailure() {
List<S2Polygon> polygons = Lists.newArrayList();