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
17package {
18    // See: http://go/android-license-faq
19    // A large-scale-change added 'default_applicable_licenses' to import
20    // all of the 'license_kinds' from "frameworks_base_license"
21    // to get the below license kinds:
22    //   SPDX-license-identifier-Apache-2.0
23    default_applicable_licenses: ["frameworks_base_license"],
24}
25
26cc_defaults {
27    name: "viewcompiler_defaults",
28    header_libs: [
29        "libbase_headers",
30    ],
31    shared_libs: [
32        "libbase",
33        "slicer",
34    ],
35    static_libs: [
36        "libcutils",
37        "libtinyxml2",
38        "liblog",
39        "libutils",
40        "libziparchive",
41        "libz",
42    ],
43    cpp_std: "gnu++2b",
44    target: {
45        android: {
46            shared_libs: [
47                "libandroidfw",
48            ],
49        },
50        host: {
51            static_libs: [
52                "libandroidfw",
53            ],
54        },
55    },
56}
57
58cc_library_static {
59    name: "libviewcompiler",
60    defaults: ["viewcompiler_defaults"],
61    srcs: [
62        "apk_layout_compiler.cc",
63        "dex_builder.cc",
64        "dex_layout_compiler.cc",
65        "java_lang_builder.cc",
66        "tinyxml_layout_parser.cc",
67        "util.cc",
68        "layout_validation.cc",
69    ],
70    host_supported: true,
71}
72
73cc_binary {
74    name: "viewcompiler",
75    defaults: ["viewcompiler_defaults"],
76    srcs: [
77        "main.cc",
78    ],
79    static_libs: [
80        "libgflags",
81        "libviewcompiler",
82    ],
83    host_supported: true,
84}
85
86cc_test_host {
87    name: "view-compiler-tests",
88    defaults: ["viewcompiler_defaults"],
89    srcs: [
90        "layout_validation_test.cc",
91        "util_test.cc",
92    ],
93    static_libs: [
94        "libviewcompiler",
95    ],
96}
97
98cc_binary_host {
99    name: "dex_testcase_generator",
100    defaults: ["viewcompiler_defaults"],
101    srcs: ["dex_testcase_generator.cc"],
102    static_libs: [
103        "libviewcompiler",
104    ],
105}
106
107genrule {
108    name: "generate_dex_testcases",
109    tools: [":dex_testcase_generator"],
110    cmd: "$(location :dex_testcase_generator) $(genDir)",
111    out: [
112        "simple.dex",
113        "trivial.dex",
114    ],
115}
116