• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2#
3# Copyright 2018 - The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16"""The common definitions of AIDEgen"""
17
18import os
19
20from atest import constants
21
22# Env constant
23OUT_DIR_COMMON_BASE_ENV_VAR = 'OUT_DIR_COMMON_BASE'
24ANDROID_DEFAULT_OUT = 'out'
25ANDROID_HOST_OUT = os.environ.get(constants.ANDROID_HOST_OUT)
26ANDROID_ROOT_PATH = os.environ.get(constants.ANDROID_BUILD_TOP)
27AIDEGEN_ROOT_PATH = os.path.join(ANDROID_ROOT_PATH, 'tools/asuite/aidegen')
28ANDROID_OUT_DIR = os.environ.get(constants.ANDROID_OUT_DIR)
29OUT_DIR_COMMON_BASE = os.getenv(OUT_DIR_COMMON_BASE_ENV_VAR)
30
31# Constants for out dir
32ANDROID_OUT_DIR_COMMON_BASE = (os.path.join(
33    OUT_DIR_COMMON_BASE, os.path.basename(ANDROID_ROOT_PATH))
34                               if OUT_DIR_COMMON_BASE else None)
35OUT_DIR = ANDROID_OUT_DIR or ANDROID_OUT_DIR_COMMON_BASE or ANDROID_DEFAULT_OUT
36SOONG_OUT_DIR_PATH = os.path.join(ANDROID_ROOT_PATH, OUT_DIR, 'soong')
37RELATIVE_HOST_OUT = os.path.relpath(ANDROID_HOST_OUT, ANDROID_ROOT_PATH)
38
39# Constants for module's info.
40KEY_PATH = 'path'
41KEY_DEP = 'dependencies'
42KEY_DEPTH = 'depth'
43
44# Constants for IDE util.
45IDE_ECLIPSE = 'Eclipse'
46IDE_INTELLIJ = 'IntelliJ'
47IDE_ANDROID_STUDIO = 'Android Studio'
48IDE_NAME_DICT = {'j': IDE_INTELLIJ, 's': IDE_ANDROID_STUDIO, 'e': IDE_ECLIPSE}
49
50# Constants for asuite metrics
51EXIT_CODE_EXCEPTION = -1
52EXIT_CODE_NORMAL = 0
53EXIT_CODE_AIDEGEN_EXCEPTION = 1
54AIDEGEN_TOOL_NAME = 'aidegen'
55