1// 2// Copyright (C) 2018 The Android Open Source Project 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17cc_defaults { 18 name: "viewcompiler_defaults", 19 defaults: ["libdexfile_static_defaults"], 20 header_libs: [ 21 "libbase_headers", 22 ], 23 shared_libs: [ 24 "libbase", 25 "slicer", 26 ], 27 static_libs: [ 28 "libtinyxml2", 29 "liblog", 30 "libutils", 31 "libziparchive", 32 ], 33 cppflags: ["-std=c++17"], 34 target: { 35 android: { 36 shared_libs: [ 37 "libandroidfw", 38 ], 39 }, 40 host: { 41 static_libs: [ 42 "libandroidfw", 43 ], 44 }, 45 }, 46} 47 48cc_library_static { 49 name: "libviewcompiler", 50 defaults: ["viewcompiler_defaults"], 51 srcs: [ 52 "apk_layout_compiler.cc", 53 "dex_builder.cc", 54 "dex_layout_compiler.cc", 55 "java_lang_builder.cc", 56 "tinyxml_layout_parser.cc", 57 "util.cc", 58 "layout_validation.cc", 59 ], 60 host_supported: true, 61} 62 63cc_binary { 64 name: "viewcompiler", 65 defaults: ["viewcompiler_defaults"], 66 srcs: [ 67 "main.cc", 68 ], 69 static_libs: [ 70 "libgflags", 71 "libviewcompiler", 72 ], 73 host_supported: true 74} 75 76cc_test_host { 77 name: "view-compiler-tests", 78 defaults: ["viewcompiler_defaults"], 79 srcs: [ 80 "dex_builder_test.cc", 81 "layout_validation_test.cc", 82 "util_test.cc", 83 ], 84 static_libs: [ 85 "libviewcompiler", 86 ], 87 test_suites: ["general-tests"], 88} 89 90cc_binary_host { 91 name: "dex_testcase_generator", 92 defaults: ["viewcompiler_defaults"], 93 srcs: ["dex_testcase_generator.cc"], 94 static_libs: [ 95 "libviewcompiler", 96 ], 97} 98 99genrule { 100 name: "generate_dex_testcases", 101 tools: [":dex_testcase_generator"], 102 cmd: "$(location :dex_testcase_generator) $(genDir)", 103 out: [ 104 "simple.dex", 105 "trivial.dex", 106 ], 107} 108