Split icing project into two parts: protos/java, and native lib.

The native lib will only be required for clients who choose not to use
the other backends, so it should be kept separate.

This also enables us to jarjar and proguard the protos/java side more
easily.

Bug: 153380375
Test: ./gradlew appsearch:appsearch:connectedCheck --daemon --info
Change-Id: I96a7b91c4b29cd8d620498e66393334c64afcd03
diff --git a/java/build.gradle b/java/build.gradle
new file mode 100644
index 0000000..7f75fd5
--- /dev/null
+++ b/java/build.gradle
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+buildscript {
+    boolean unbundleBuild = (new File('unbundled-build')).exists()
+    repositories {
+        maven { url '../../../prebuilts/androidx/external' }
+        if (unbundleBuild) {
+            jcenter()
+        }
+    }
+    dependencies {
+        classpath('gradle.plugin.com.google.protobuf:protobuf-gradle-plugin:0.8.8')
+    }
+}
+
+apply plugin: 'java-library'
+apply plugin: 'com.google.protobuf'
+apply plugin: 'idea'
+
+sourceSets {
+    main {
+        proto {
+            srcDir '..'
+            include '**/*.proto'
+        }
+    }
+}
+
+dependencies {
+    api('com.google.protobuf:protobuf-javalite:3.10.0')
+}
+
+protobuf {
+    protoc {
+        artifact = 'com.google.protobuf:protoc:3.10.0'
+    }
+
+    generateProtoTasks {
+        all().each { task ->
+            task.builtins {
+                java {
+                    option 'lite'
+                }
+            }
+        }
+    }
+}