Merge commit 'upstream/auto-value-1.9^'
Bug: 227669740
Test: m checkbuild
Change-Id: I95f88b4d3abfa241999baf33a5732c52dfcfc9e5
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..a7efec4
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,17 @@
+package {
+ default_visibility: [":__subpackages__"],
+ default_applicable_licenses: ["external_auto_license"],
+}
+
+// Added automatically by a large-scale-change
+// See: http://go/android-license-faq
+license {
+ name: "external_auto_license",
+ visibility: [":__subpackages__"],
+ license_kinds: [
+ "SPDX-license-identifier-Apache-2.0",
+ ],
+ license_text: [
+ "LICENSE",
+ ],
+}
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..560bb92
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,17 @@
+name: "auto"
+description:
+ "A collection of source code generators for Java."
+
+third_party {
+ url {
+ type: HOMEPAGE
+ value: "https://github.com/google/auto"
+ }
+ url {
+ type: GIT
+ value: "https://github.com/google/auto"
+ }
+ version: "auto-value-1.9"
+ last_upgrade_date { year: 2022 month: 04 day: 11 }
+ 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/android-annotation-stubs/Android.bp b/android-annotation-stubs/Android.bp
new file mode 100644
index 0000000..3e0be03
--- /dev/null
+++ b/android-annotation-stubs/Android.bp
@@ -0,0 +1,13 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "external_auto_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["external_auto_license"],
+}
+
+java_library_host {
+ name: "auto_android_annotation_stubs",
+ srcs: ["src/**/*.java"],
+}
diff --git a/android-annotation-stubs/gen_annotations.sh b/android-annotation-stubs/gen_annotations.sh
new file mode 100755
index 0000000..4766af9
--- /dev/null
+++ b/android-annotation-stubs/gen_annotations.sh
@@ -0,0 +1,73 @@
+#!/bin/bash
+
+declare -A INNER
+declare -A PARAMETER
+declare -A IMPORT
+
+ANNOTATIONS=(
+ net.ltgt.gradle.incap.IncrementalAnnotationProcessor
+ org.checkerframework.checker.nullness.qual.Nullable
+)
+
+PARAMETER["net.ltgt.gradle.incap.IncrementalAnnotationProcessor"]="IncrementalAnnotationProcessorType"
+IMPORT["net.ltgt.gradle.incap.IncrementalAnnotationProcessor"]="net.ltgt.gradle.incap.IncrementalAnnotationProcessorType"
+
+for a in ${ANNOTATIONS[@]}; do
+ package=${a%.*}
+ class=${a##*.}
+ dir=$(dirname $0)/src/${package//.//}
+ file=${class}.java
+ inner=${INNER[$a]}
+ parameter=${PARAMETER[$a]}
+ import=
+
+ if [ -n "${parameter}" ]; then
+ parameter="${parameter} value();"
+ fi
+
+ for i in ${IMPORT[$a]}; do
+ import="${import}import ${i};"
+ done
+
+ mkdir -p ${dir}
+ sed -e"s/__PACKAGE__/${package}/" \
+ -e"s/__CLASS__/${class}/" \
+ -e"s/__INNER__/${inner}/" \
+ -e"s/__PARAMETER__/${parameter}/" \
+ -e"s/__IMPORT__/${import}/" \
+ $(dirname $0)/tmpl.java > ${dir}/${file}
+ google-java-format -i ${dir}/${file}
+done
+
+f=$(dirname $0)/src/net/ltgt/gradle/incap/IncrementalAnnotationProcessorType.java
+cat > ${f} <<EOF
+/*
+ * Copyright (C) 2019 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 net.ltgt.gradle.incap;
+
+import java.util.Locale;
+
+public enum IncrementalAnnotationProcessorType {
+ DYNAMIC,
+ ISOLATING,
+ AGGREGATING;
+
+ public String getProcessorOption() {
+ return "org.gradle.annotation.processing." + name().toLowerCase(Locale.ROOT);
+ }
+}
+EOF
diff --git a/android-annotation-stubs/src/net/ltgt/gradle/incap/IncrementalAnnotationProcessor.java b/android-annotation-stubs/src/net/ltgt/gradle/incap/IncrementalAnnotationProcessor.java
new file mode 100644
index 0000000..aa1ce76
--- /dev/null
+++ b/android-annotation-stubs/src/net/ltgt/gradle/incap/IncrementalAnnotationProcessor.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2019 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 net.ltgt.gradle.incap;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/* This is an annotation stub to avoid dependencies on annotations that aren't
+ * in the Android platform source tree. */
+
+@Target({
+ ElementType.ANNOTATION_TYPE,
+ ElementType.CONSTRUCTOR,
+ ElementType.FIELD,
+ ElementType.LOCAL_VARIABLE,
+ ElementType.METHOD,
+ ElementType.PACKAGE,
+ ElementType.PARAMETER,
+ ElementType.TYPE,
+ ElementType.TYPE_PARAMETER,
+ ElementType.TYPE_USE
+})
+@Retention(RetentionPolicy.SOURCE)
+public @interface IncrementalAnnotationProcessor {
+
+ IncrementalAnnotationProcessorType value();
+}
diff --git a/android-annotation-stubs/src/net/ltgt/gradle/incap/IncrementalAnnotationProcessorType.java b/android-annotation-stubs/src/net/ltgt/gradle/incap/IncrementalAnnotationProcessorType.java
new file mode 100644
index 0000000..1abee42
--- /dev/null
+++ b/android-annotation-stubs/src/net/ltgt/gradle/incap/IncrementalAnnotationProcessorType.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2019 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 net.ltgt.gradle.incap;
+
+import java.util.Locale;
+
+public enum IncrementalAnnotationProcessorType {
+ DYNAMIC,
+ ISOLATING,
+ AGGREGATING;
+
+ public String getProcessorOption() {
+ return "org.gradle.annotation.processing." + name().toLowerCase(Locale.ROOT);
+ }
+}
diff --git a/android-annotation-stubs/src/org/checkerframework/checker/nullness/qual/Nullable.java b/android-annotation-stubs/src/org/checkerframework/checker/nullness/qual/Nullable.java
new file mode 100644
index 0000000..276d64c
--- /dev/null
+++ b/android-annotation-stubs/src/org/checkerframework/checker/nullness/qual/Nullable.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2019 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 org.checkerframework.checker.nullness.qual;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/* This is an annotation stub to avoid dependencies on annotations that aren't
+ * in the Android platform source tree. */
+
+@Target({
+ ElementType.ANNOTATION_TYPE,
+ ElementType.CONSTRUCTOR,
+ ElementType.FIELD,
+ ElementType.LOCAL_VARIABLE,
+ ElementType.METHOD,
+ ElementType.PACKAGE,
+ ElementType.PARAMETER,
+ ElementType.TYPE,
+ ElementType.TYPE_PARAMETER,
+ ElementType.TYPE_USE
+})
+@Retention(RetentionPolicy.SOURCE)
+public @interface Nullable {}
diff --git a/android-annotation-stubs/tmpl.java b/android-annotation-stubs/tmpl.java
new file mode 100644
index 0000000..c4df609
--- /dev/null
+++ b/android-annotation-stubs/tmpl.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2019 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 __PACKAGE__;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+__IMPORT__
+
+/* This is an annotation stub to avoid dependencies on annotations that aren't
+ * in the Android platform source tree. */
+
+@Target({
+ ElementType.ANNOTATION_TYPE,
+ ElementType.CONSTRUCTOR,
+ ElementType.FIELD,
+ ElementType.LOCAL_VARIABLE,
+ ElementType.METHOD,
+ ElementType.PACKAGE,
+ ElementType.PARAMETER,
+ ElementType.TYPE,
+ ElementType.TYPE_PARAMETER,
+ ElementType.TYPE_USE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface __CLASS__ {
+ __INNER__
+ __PARAMETER__
+}
diff --git a/common/Android.bp b/common/Android.bp
new file mode 100644
index 0000000..19e2acd
--- /dev/null
+++ b/common/Android.bp
@@ -0,0 +1,19 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "external_auto_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["external_auto_license"],
+}
+
+java_library_host {
+ name: "auto_common",
+ srcs: ["src/main/java/**/*.java"],
+ libs: [
+ "auto_android_annotation_stubs",
+ "guava",
+ "javapoet",
+ ],
+ visibility: ["//visibility:public"],
+}
diff --git a/factory/Android.bp b/factory/Android.bp
new file mode 100644
index 0000000..7e75542
--- /dev/null
+++ b/factory/Android.bp
@@ -0,0 +1,40 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "external_auto_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["external_auto_license"],
+}
+
+java_library {
+ name: "auto_factory_annotations",
+ host_supported: true,
+ srcs: ["src/main/**/com/google/auto/factory/*.java"],
+ visibility: ["//visibility:public"],
+}
+
+java_plugin {
+ name: "auto_factory_plugin",
+ srcs: ["src/main/**/com/google/auto/factory/processor/*.java"],
+ static_libs: [
+ "auto_common",
+ "auto_factory_annotations",
+ "google_java_format",
+ "guava",
+ "javapoet",
+ "jsr330",
+ ],
+ libs: [
+ "auto_android_annotation_stubs",
+ "auto_value_annotations",
+ "auto_service_annotations",
+ ],
+ plugins: [
+ "auto_service_plugin",
+ "auto_value_plugin",
+ ],
+ processor_class: "com.google.auto.factory.processor.AutoFactoryProcessor",
+ generates_api: true,
+ visibility: ["//visibility:public"],
+}
diff --git a/service/Android.bp b/service/Android.bp
new file mode 100644
index 0000000..318c47b
--- /dev/null
+++ b/service/Android.bp
@@ -0,0 +1,28 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "external_auto_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["external_auto_license"],
+}
+
+java_library {
+ name: "auto_service_annotations",
+ host_supported: true,
+ srcs: ["annotations/src/main/java/**/*.java"],
+ sdk_version: "core_current",
+ visibility: ["//visibility:public"],
+}
+
+java_plugin {
+ name: "auto_service_plugin",
+ srcs: ["processor/src/main/java/**/*.java"],
+ static_libs: [
+ "auto_common",
+ "auto_service_annotations",
+ "guava",
+ ],
+ processor_class: "com.google.auto.service.processor.AutoServiceProcessor",
+ visibility: ["//visibility:public"],
+}
diff --git a/value/Android.bp b/value/Android.bp
new file mode 100644
index 0000000..2f554aa
--- /dev/null
+++ b/value/Android.bp
@@ -0,0 +1,133 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "external_auto_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["external_auto_license"],
+}
+
+filegroup {
+ name: "auto_value_plugin_resources",
+ path: "src/main/java",
+ srcs: ["src/main/java/com/google/auto/value/processor/*.vm"],
+}
+
+java_library_host {
+ name: "libauto_value_plugin",
+ srcs: ["src/main/java/com/google/auto/value/processor/**/*.java"],
+ java_resources: [":auto_value_plugin_resources"],
+ libs: [
+ "auto_android_annotation_stubs",
+ "auto_service_annotations",
+ "error_prone_annotations",
+
+ "auto_common",
+ "auto_value_extension",
+ "escapevelocity",
+ "guava",
+ "javapoet",
+ ],
+}
+
+java_library_host {
+ name: "auto_value_extension",
+ srcs: ["src/main/java/com/google/auto/value/extension/*.java"],
+ libs: [
+ "guava",
+ ],
+}
+
+
+java_library {
+ name: "auto_value_annotations",
+ host_supported: true,
+ srcs: ["src/main/java/com/google/auto/value/*.java"],
+ sdk_version: "core_current",
+ // AutoValue is a pure java library without any dependency on android framework, however due to
+ // a dependency from an apex it is required to have a min_sdk_version
+ min_sdk_version: "19",
+ visibility: ["//visibility:public"],
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.extservices",
+ ],
+}
+
+java_plugin {
+ name: "auto_value_plugin",
+ static_libs: [
+ "libauto_value_plugin",
+
+ "auto_android_annotation_stubs",
+ "auto_common",
+ "auto_service_plugin",
+ "auto_value_extension",
+ "escapevelocity",
+ "guava",
+ "javapoet",
+ ],
+ processor_class: "com.google.auto.value.processor.AutoValueProcessor",
+ visibility: ["//visibility:public"],
+}
+
+java_plugin {
+ name: "auto_oneof_plugin",
+ static_libs: [
+ "libauto_value_plugin",
+
+ "auto_android_annotation_stubs",
+ "auto_common",
+ "auto_service_plugin",
+ "auto_value_extension",
+ "escapevelocity",
+ "guava",
+ "javapoet",
+ ],
+ processor_class: "com.google.auto.value.processor.AutoOneOfProcessor",
+ visibility: ["//visibility:public"],
+}
+
+java_plugin {
+ name: "auto_annotation_plugin",
+ static_libs: [
+ "libauto_value_plugin",
+
+ "auto_android_annotation_stubs",
+ "auto_common",
+ "auto_service_plugin",
+ "auto_value_extension",
+ "escapevelocity",
+ "guava",
+ "javapoet",
+ ],
+ processor_class: "com.google.auto.value.processor.AutoAnnotationProcessor",
+ visibility: ["//visibility:public"],
+}
+
+java_library {
+ name: "auto_value_memoized_extension_annotations",
+ host_supported: true,
+ srcs: ["src/main/java/com/google/auto/value/extension/memoized/*.java"],
+ sdk_version: "core_current",
+ visibility: ["//visibility:public"],
+}
+
+java_plugin {
+ name: "auto_value_memoized_extension_plugin",
+ srcs: ["src/main/java/com/google/auto/value/extension/memoized/processor/*.java"],
+ static_libs: [
+ "auto_android_annotation_stubs",
+ "auto_common",
+ "auto_service_annotations",
+ "auto_value_extension",
+ "error_prone_annotations",
+ "escapevelocity",
+ "guava",
+ "javapoet",
+ "jsr305",
+ ],
+ plugins: ["auto_service_plugin"],
+ processor_class: "com.google.auto.value.extension.memoized.processor.MemoizedValidator",
+ visibility: ["//visibility:public"],
+}