• 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
18# Env constant
19OUT_DIR_COMMON_BASE_ENV_VAR = 'OUT_DIR_COMMON_BASE'
20ANDROID_DEFAULT_OUT = 'out'
21AIDEGEN_ROOT_PATH = 'tools/asuite/aidegen'
22USER_HOME = '$USER_HOME$'
23TARGET_PRODUCT = 'TARGET_PRODUCT'
24TARGET_BUILD_VARIANT = 'TARGET_BUILD_VARIANT'
25GEN_JAVA_DEPS = 'SOONG_COLLECT_JAVA_DEPS'
26GEN_CC_DEPS = 'SOONG_COLLECT_CC_DEPS'
27GEN_COMPDB = 'SOONG_GEN_COMPDB'
28AIDEGEN_TEST_MODE = 'AIDEGEN_TEST_MODE'
29
30# Constants for module's info.
31KEY_PATH = 'path'
32KEY_DEPENDENCIES = 'dependencies'
33KEY_DEPTH = 'depth'
34KEY_CLASS = 'class'
35KEY_INSTALLED = 'installed'
36KEY_SRCS = 'srcs'
37KEY_SRCJARS = 'srcjars'
38KEY_CLASSES_JAR = 'classes_jar'
39KEY_TAG = 'tags'
40KEY_COMPATIBILITY = 'compatibility_suites'
41KEY_AUTO_TEST_CONFIG = 'auto_test_config'
42KEY_MODULE_NAME = 'module_name'
43KEY_TEST_CONFIG = 'test_config'
44KEY_HEADER = 'header_search_path'
45KEY_SYSTEM = 'system_search_path'
46KEY_TESTS = 'tests'
47KEY_JARS = 'jars'
48KEY_DEP_SRCS = 'dep_srcs'
49KEY_IML_NAME = 'iml_name'
50KEY_EXCLUDES = 'excludes'
51
52# Java related classes.
53JAVA_TARGET_CLASSES = ['APPS', 'JAVA_LIBRARIES', 'ROBOLECTRIC']
54# C, C++ related classes.
55NATIVE_TARGET_CLASSES = [
56    'HEADER_LIBRARIES', 'NATIVE_TESTS', 'STATIC_LIBRARIES', 'SHARED_LIBRARIES'
57]
58TARGET_CLASSES = JAVA_TARGET_CLASSES
59TARGET_CLASSES.extend(NATIVE_TARGET_CLASSES)
60
61# Constants for IDE util.
62IDE_ECLIPSE = 'Eclipse'
63IDE_INTELLIJ = 'IntelliJ'
64IDE_ANDROID_STUDIO = 'Android Studio'
65IDE_CLION = 'CLion'
66IDE_VSCODE = 'VSCode'
67IDE_NAME_DICT = {
68    'j': IDE_INTELLIJ,
69    's': IDE_ANDROID_STUDIO,
70    'e': IDE_ECLIPSE,
71    'c': IDE_CLION,
72    'v': IDE_VSCODE
73}
74
75# Constants for asuite metrics.
76EXIT_CODE_EXCEPTION = -1
77EXIT_CODE_NORMAL = 0
78EXIT_CODE_AIDEGEN_EXCEPTION = 1
79AIDEGEN_TOOL_NAME = 'aidegen'
80ANDROID_TREE = 'is_android_tree'
81
82# Exit code of the asuite metrics for parsing xml file failed.
83XML_PARSING_FAILURE = 101
84
85# Exit code of the asuite metrics for locating Android SDK path failed.
86LOCATE_SDK_PATH_FAILURE = 102
87
88# Exit code of the asuite metrics for IDE launched failed.
89IDE_LAUNCH_FAILURE = 103
90
91# Constants for file names.
92MERGED_MODULE_INFO = 'merged_module_info.json'
93BLUEPRINT_JAVA_JSONFILE_NAME = 'module_bp_java_deps.json'
94BLUEPRINT_CC_JSONFILE_NAME = 'module_bp_cc_deps.json'
95COMPDB_JSONFILE_NAME = 'compile_commands.json'
96CMAKELISTS_FILE_NAME = 'clion_project_lists.txt'
97CLION_PROJECT_FILE_NAME = 'CMakeLists.txt'
98ANDROID_BP = 'Android.bp'
99ANDROID_MK = 'Android.mk'
100JAVA_FILES = '*.java'
101VSCODE_CONFIG_DIR = '.vscode'
102ANDROID_MANIFEST = 'AndroidManifest.xml'
103
104# Constants for file paths.
105RELATIVE_NATIVE_PATH = 'development/ide/clion'
106RELATIVE_COMPDB_PATH = 'development/ide/compdb'
107
108# Constants for whole Android tree.
109WHOLE_ANDROID_TREE_TARGET = '#WHOLE_ANDROID_TREE#'
110
111# Constants for ProjectInfo or ModuleData classes.
112JAR_EXT = '.jar'
113TARGET_LIBS = [JAR_EXT]
114
115# Constants for aidegen_functional_test.
116ANDROID_COMMON = 'android_common'
117LINUX_GLIBC_COMMON = 'linux_glibc_common'
118
119# Constants for ide_util.
120NOHUP = 'nohup'
121ECLIPSE_WS = '~/Documents/AIDEGen_Eclipse_workspace'
122IGNORE_STD_OUT_ERR_CMD = '2>/dev/null >&2'
123
124# Constants for environment.
125LUNCH_TARGET = 'lunch target'
126
127# Constants for the languages aidegen supports.
128JAVA = 'Java'
129C_CPP = 'C/C++'
130
131# Constants for error message.
132INVALID_XML = 'The content of {XML_FILE} is not valid.'
133
134# Constants for default modules.
135FRAMEWORK_ALL = 'framework-all'
136CORE_ALL = 'core-all'
137FRAMEWORK_SRCJARS = 'framework_srcjars'
138
139# Constants for module's path.
140FRAMEWORK_PATH = 'frameworks/base'
141LIBCORE_PATH = 'libcore'
142
143# Constants for regular expression
144RE_INSIDE_PATH_CHECK = r'^{}($|/.+)'
145
146# Constants for Git
147GIT_FOLDER_NAME = '.git'
148
149# Constants for Idea
150IDEA_FOLDER = '.idea'
151