[view-compiler] Add layout validation
Layout validation walks over a layout resource and verifies that the layout only
uses features the layout compiler supports.
Currently this means we reject layouts that use any of the following tags:
* include
* fragment
* merge
* view
In the future, we will extend the layout compiler to handle these, but for now
we want to be liberal in what we reject.
Bug: 111895153
Test: atest view-compiler-tests
Change-Id: I8dca30c035a83b6763497a36fc60c68438fa1b0c
diff --git a/startop/view_compiler/Android.bp b/startop/view_compiler/Android.bp
index de40e0d..91cec554 100644
--- a/startop/view_compiler/Android.bp
+++ b/startop/view_compiler/Android.bp
@@ -24,6 +24,9 @@
"libdexfile",
"slicer",
],
+ static_libs: [
+ "libtinyxml2",
+ ],
}
cc_library_host_static {
@@ -32,7 +35,9 @@
srcs: [
"dex_builder.cc",
"java_lang_builder.cc",
+ "tinyxml_layout_parser.cc",
"util.cc",
+ "layout_validation.cc",
],
}
@@ -43,7 +48,6 @@
"main.cc",
],
static_libs: [
- "libtinyxml2",
"libgflags",
"libviewcompiler",
],
@@ -54,6 +58,7 @@
defaults: ["viewcompiler_defaults"],
srcs: [
"dex_builder_test.cc",
+ "layout_validation_test.cc",
"util_test.cc",
],
static_libs: [