• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2022 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import os
16
17
18def analyze_trees(context, inner_trees):
19    inner_trees.for_each_tree(run_analysis)
20
21
22def run_analysis(tree_key, inner_tree, cookie):
23    """Call inner_build analyze."""
24    context = inner_tree.context
25    cmd = ["analyze"]
26
27    # Pass the abspath of the inner_tree.  The nsjail config will change
28    # directory to this path at invocation.
29    cmd.extend(["--inner_tree", os.path.join(os.getcwd(), inner_tree.root)])
30
31    # Pass the api_surfaces directory.
32    cmd.extend(["--api_surfaces_dir",
33                context.out.api_surfaces_dir(base=context.out.Base.ORIGIN)])
34
35    inner_tree.invoke(cmd)
36
37    # Save the environment variables used for the inner-tree build.
38    inner_tree.set_env_used()
39