Merge commit '615ab4863f7d2e31d3037d0c6a0f641fd6fc0d07' into master

Conflicts:
 samples/Android.mk

Bug: b/201652781
Change-Id: Ia48f5389d9cde2b0730767e215d86e28cced7da6
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..45d03c4
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,99 @@
+package {
+    default_applicable_licenses: ["external_deqp-deps_amber_license"],
+}
+
+// Added automatically by a large-scale-change
+//
+// large-scale-change included anything that looked like it might be a license
+// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
+//
+// Please consider removing redundant or irrelevant files from 'license_text:'.
+// See: http://go/android-license-faq
+license {
+    name: "external_deqp-deps_amber_license",
+    visibility: [":__subpackages__"],
+    license_kinds: [
+        "SPDX-license-identifier-Apache-2.0",
+    ],
+    license_text: [
+        "LICENSE",
+    ],
+}
+
+genrule {
+    name: "deqp_amber_gen_vk_wrappers",
+    out: ["vk-wrappers-1-0.inc", "vk-wrappers-1-0.h", "vk-wrappers-1-1.inc", "vk-wrappers-1-1.h"],
+    srcs: ["src/vulkan/vk-funcs-1-0.inc", "src/vulkan/vk-funcs-1-1.inc"],
+    tool_files: ["tools/update_vk_wrappers.py"],
+    cmd: "$(location) $(genDir) $$(dirname $(location src/vulkan/vk-funcs-1-0.inc))/../..",
+}
+
+cc_library_static {
+    name: "deqp_amber",
+    defaults: ["deqp_and_deps_defaults"],
+    export_include_dirs: [
+        "include",
+        ".",
+    ],
+    generated_headers: [
+        "deqp_amber_gen_vk_wrappers",
+    ],
+    header_libs: [
+        "deqp_vulkan_headers",
+    ],
+    srcs: [
+        "src/amber.cc",
+        "src/amberscript/parser.cc",
+        "src/buffer.cc",
+        "src/command_data.cc",
+        "src/command.cc",
+        "src/debug.cc",
+        "src/descriptor_set_and_binding_parser.cc",
+        "src/engine.cc",
+        "src/executor.cc",
+        "src/float16_helper.cc",
+        "src/format.cc",
+        "src/parser.cc",
+        "src/pipeline_data.cc",
+        "src/pipeline.cc",
+        "src/recipe.cc",
+        "src/result.cc",
+        "src/sampler.cc",
+        "src/script.cc",
+        "src/shader_compiler.cc",
+        "src/shader.cc",
+        "src/sleep.cc",
+        "src/tokenizer.cc",
+        "src/type_parser.cc",
+        "src/type.cc",
+        "src/value.cc",
+        "src/verifier.cc",
+        "src/virtual_file_store.cc",
+        "src/vkscript/command_parser.cc",
+        "src/vkscript/datum_type_parser.cc",
+        "src/vkscript/parser.cc",
+        "src/vkscript/section_parser.cc",
+        "src/vulkan_engine_config.cc",
+        "src/vulkan/buffer_backed_descriptor.cc",
+        "src/vulkan/buffer_descriptor.cc",
+        "src/vulkan/command_buffer.cc",
+        "src/vulkan/command_pool.cc",
+        "src/vulkan/compute_pipeline.cc",
+        "src/vulkan/descriptor.cc",
+        "src/vulkan/device.cc",
+        "src/vulkan/engine_vulkan_debugger.cc",
+        "src/vulkan/engine_vulkan.cc",
+        "src/vulkan/frame_buffer.cc",
+        "src/vulkan/graphics_pipeline.cc",
+        "src/vulkan/image_descriptor.cc",
+        "src/vulkan/index_buffer.cc",
+        "src/vulkan/pipeline.cc",
+        "src/vulkan/push_constant.cc",
+        "src/vulkan/resource.cc",
+        "src/vulkan/sampler_descriptor.cc",
+        "src/vulkan/sampler.cc",
+        "src/vulkan/transfer_buffer.cc",
+        "src/vulkan/transfer_image.cc",
+        "src/vulkan/vertex_buffer.cc",
+    ],
+}
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index d7fc392..0000000
--- a/Android.mk
+++ /dev/null
@@ -1,82 +0,0 @@
-# Copyright 2019 The Amber Authors.
-#
-# 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE:=amber
-LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti \
-    -Wno-unknown-pragmas \
-    -DAMBER_ENABLE_SPIRV_TOOLS=1 \
-    -DAMBER_ENABLE_SHADERC=1 \
-    -DAMBER_ENGINE_VULKAN=1
-LOCAL_SRC_FILES:= \
-    src/amber.cc \
-    src/amberscript/parser.cc \
-    src/buffer.cc \
-    src/command.cc \
-    src/command_data.cc \
-    src/debug.cc \
-    src/descriptor_set_and_binding_parser.cc \
-    src/engine.cc \
-    src/executor.cc \
-    src/float16_helper.cc \
-    src/format.cc \
-    src/parser.cc \
-    src/pipeline.cc \
-    src/pipeline_data.cc \
-    src/recipe.cc \
-    src/result.cc \
-    src/sampler.cc \
-    src/script.cc \
-    src/shader.cc \
-    src/shader_compiler.cc \
-    src/tokenizer.cc \
-    src/type.cc \
-    src/type_parser.cc \
-    src/value.cc \
-    src/verifier.cc \
-    src/virtual_file_store.cc \
-    src/vkscript/command_parser.cc \
-    src/vkscript/datum_type_parser.cc \
-    src/vkscript/parser.cc \
-    src/vkscript/section_parser.cc \
-    src/vulkan/buffer_descriptor.cc \
-    src/vulkan/buffer_backed_descriptor.cc \
-    src/vulkan/command_buffer.cc \
-    src/vulkan/command_pool.cc \
-    src/vulkan/compute_pipeline.cc \
-    src/vulkan/descriptor.cc \
-    src/vulkan/device.cc \
-    src/vulkan/engine_vulkan.cc \
-    src/vulkan/engine_vulkan_debugger.cc \
-    src/vulkan/frame_buffer.cc \
-    src/vulkan/graphics_pipeline.cc \
-    src/vulkan/image_descriptor.cc \
-    src/vulkan/index_buffer.cc \
-    src/vulkan/pipeline.cc \
-    src/vulkan/push_constant.cc \
-    src/vulkan/resource.cc \
-    src/vulkan/sampler.cc \
-    src/vulkan/sampler_descriptor.cc \
-    src/vulkan/transfer_buffer.cc \
-    src/vulkan/transfer_image.cc \
-    src/vulkan/vertex_buffer.cc \
-    src/vulkan_engine_config.cc
-LOCAL_STATIC_LIBRARIES:=glslang SPIRV-Tools shaderc
-LOCAL_C_INCLUDES:=$(LOCAL_PATH)/include $(LOCAL_PATH)/third_party/vulkan-headers/include
-LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/include
-include $(BUILD_STATIC_LIBRARY)
-
-include $(LOCAL_PATH)/third_party/Android.mk
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..d97975c
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,3 @@
+third_party {
+  license_type: NOTICE
+}
diff --git a/android_test/Android.mk b/android_test/Android.mk
deleted file mode 100644
index 0419997..0000000
--- a/android_test/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright 2019 The Amber Authors.
-#
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_CPP_EXTENSION := .cc .cpp .cxx
-LOCAL_SRC_FILES:=test.cc
-LOCAL_MODULE:=amber_ndk_test
-LOCAL_LDLIBS:=-landroid
-LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -Werror
-LOCAL_STATIC_LIBRARIES:=amber
-include $(BUILD_SHARED_LIBRARY)
-
-include $(LOCAL_PATH)/../Android.mk
diff --git a/samples/Android.mk b/samples/Android.mk
deleted file mode 100644
index 1428ead..0000000
--- a/samples/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright 2019 The Amber Authors.
-#
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE:=amber_ndk
-LOCAL_CPP_EXTENSION := .cc .cpp .cxx
-LOCAL_SRC_FILES:= \
-    amber.cc \
-    config_helper.cc \
-    config_helper_vulkan.cc \
-    log.cc \
-    ppm.cc \
-    png.cc \
-    timestamp.cc
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. $(LOCAL_PATH)/../include
-LOCAL_LDLIBS:=-landroid -lvulkan -llog
-LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -Werror -Wno-unknown-pragmas -DAMBER_ENGINE_VULKAN=1 -DAMBER_ENABLE_LODEPNG=1
-LOCAL_STATIC_LIBRARIES:=amber lodepng
-include $(BUILD_EXECUTABLE)
-
-LOCAL_MODULE:=amber_ndk_sharedlib
-LOCAL_MODULE_FILENAME:=libamber_ndk
-LOCAL_SRC_FILES+=android_helper.cc
-LOCAL_CXXFLAGS+=-DAMBER_ANDROID_MAIN=1
-include $(BUILD_SHARED_LIBRARY)
-
-include $(LOCAL_PATH)/../Android.mk
diff --git a/third_party/Android.mk b/third_party/Android.mk
deleted file mode 100644
index 24b54c4..0000000
--- a/third_party/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright 2020 The Amber Authors.
-#
-# 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
-#
-#     https://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.
-
-THIRD_PARTY_PATH := $(call my-dir)
-
-LOCAL_PATH := $(call my-dir)
-
-# Lodepng
-include $(CLEAR_VARS)
-LOCAL_MODULE:=lodepng
-LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti
-LOCAL_SRC_FILES:= lodepng/lodepng.cpp
-include $(BUILD_STATIC_LIBRARY)
-
-ifeq ($(GLSLANG_LOCAL_PATH),)
-	GLSLANG_LOCAL_PATH:=$(THIRD_PARTY_PATH)/glslang
-endif
-ifeq ($(SPVTOOLS_LOCAL_PATH),)
-  SPVTOOLS_LOCAL_PATH:=$(THIRD_PARTY_PATH)/spirv-tools
-endif
-ifeq ($(SPVHEADERS_LOCAL_PATH),)
-	SPVHEADERS_LOCAL_PATH:=$(THIRD_PARTY_PATH)/spirv-headers
-endif
-
-# The Shaderc Android.mk file will include the glslang and the spirv-tools
-# build files.
-ifeq ($(SHADERC_LOCAL_PATH),)
-	SHADERC_LOCAL_PATH:=$(THIRD_PARTY_PATH)/shaderc
-endif
-include $(SHADERC_LOCAL_PATH)/Android.mk