def _check_sdk_platform_update(self, update_component_ids): """Checks and performs update for the sdk platform.""" pinned_id = 'android-%d' % toolchain.get_android_api_level() pinned_dir = os.path.join( self.unpacked_linked_cache_path, 'platforms', pinned_id) if not os.path.exists(pinned_dir): update_component_ids.append(pinned_id)
def _build_apk(source_path, use_ndk, use_clang, build_path, install_apk, debug, verbose): if not os.path.isdir(_SDK_PATH): raise Exception('Missing SDK path: ' + str(_SDK_PATH)) print print '--------------------------' print 'Building ' + os.path.basename(install_apk) print '--------------------------' # We use this work directory in order to allow us to completely # create it from scratch every time we build. We cannot do that # to the build_path since files in there (like the build.log) # should not be deleted on every run. work_path = os.path.join(build_path, 'work') if os.path.isdir(work_path): file_util.rmtree(work_path) shutil.copytree(os.path.join('.', source_path), work_path) print os.path.join(_SDK_PATH, 'tools', 'android') # Any target 14+ should work (tested on 21). subprocess.check_call([ os.path.join(_SDK_PATH, 'tools', 'android'), 'update', 'project', '--target', 'android-%d' % toolchain.get_android_api_level(), '--path', '.', '--name', 'test_app' ], cwd=work_path) if use_ndk: if not os.path.isdir(_NDK_PATH): raise Exception('Missing NDK path: ' + str(_NDK_PATH)) app_optim = 'release' if debug: app_optim = 'debug' if not os.path.exists(os.path.join(work_path, 'jni', 'Application.mk')): # Write desired ABI before calling ndk-build. Do not drop 'x86' since # -t=bi uses x86 NDK binaries by default. open(os.path.join(work_path, 'jni', 'Application.mk'), 'w').write('APP_ABI := x86 armeabi armeabi-v7a\n' + ('APP_OPTIM := %s\n' % app_optim) + 'APP_STL := stlport_static\n') extras = [] if verbose: extras.append('V=1') if use_clang: extras.append('NDK_TOOLCHAIN_VERSION=clang') subprocess.check_call([ os.path.join(_NDK_PATH, 'ndk-build'), '-j', '16', '-l', '16', 'ARC_ROOT=' + _ARC_ROOT ] + extras, cwd=work_path) subprocess.check_call( [os.path.join(_TOOLS_ROOT, 'ant', 'bin', 'ant'), 'debug'], cwd=work_path) shutil.copyfile(os.path.join(work_path, 'bin', 'test_app-debug.apk'), install_apk)
def _build_apk(source_path, use_ndk, use_clang, build_path, install_apk, debug, verbose): if not os.path.isdir(_SDK_PATH): raise Exception('Missing SDK path: ' + str(_SDK_PATH)) print print '--------------------------' print 'Building ' + os.path.basename(install_apk) print '--------------------------' # We use this work directory in order to allow us to completely # create it from scratch every time we build. We cannot do that # to the build_path since files in there (like the build.log) # should not be deleted on every run. work_path = os.path.join(build_path, 'work') if os.path.isdir(work_path): file_util.rmtree(work_path) shutil.copytree(os.path.join('.', source_path), work_path) print os.path.join(_SDK_PATH, 'tools', 'android') # Any target 14+ should work (tested on 21). subprocess.check_call([ os.path.join(_SDK_PATH, 'tools', 'android'), 'update', 'project', '--target', 'android-%d' % toolchain.get_android_api_level(), '--path', '.', '--name', 'test_app'], cwd=work_path) if use_ndk: if not os.path.isdir(_NDK_PATH): raise Exception('Missing NDK path: ' + str(_NDK_PATH)) app_optim = 'release' if debug: app_optim = 'debug' if not os.path.exists(os.path.join(work_path, 'jni', 'Application.mk')): # Write desired ABI before calling ndk-build. Do not drop 'x86' since # -t=bi uses x86 NDK binaries by default. open(os.path.join(work_path, 'jni', 'Application.mk'), 'w').write( 'APP_ABI := x86 armeabi armeabi-v7a\n' + ('APP_OPTIM := %s\n' % app_optim) + 'APP_STL := stlport_static\n') extras = [] if verbose: extras.append('V=1') if use_clang: extras.append('NDK_TOOLCHAIN_VERSION=clang') subprocess.check_call([os.path.join(_NDK_PATH, 'ndk-build'), '-j', '16', '-l', '16', 'ARC_ROOT=' + _ARC_ROOT] + extras, cwd=work_path) subprocess.check_call([os.path.join(_TOOLS_ROOT, 'ant', 'bin', 'ant'), 'debug'], cwd=work_path) shutil.copyfile(os.path.join(work_path, 'bin', 'test_app-debug.apk'), install_apk)
import os from src.build import analyze_diffs from src.build import build_common from src.build import lint_source from src.build import ninja_generator from src.build import ninja_generator_runner from src.build import open_source from src.build import staging from src.build import toolchain from src.build.build_options import OPTIONS _ANDROID_SYSTEM_IMAGE_DIR = ('ndk/platforms/android-%d' % toolchain.get_android_api_level()) def _generate_gtest_ninja(name, instances=0, enable_libcxx=False, host=False): n = ninja_generator.ArchiveNinjaGenerator( name, base_path='android/external/chromium_org/testing/gtest/src', instances=instances, force_compiler='clang', enable_cxx11=True, enable_libcxx=enable_libcxx, host=host) n.add_include_paths(staging.as_staging( 'android/external/chromium_org/testing/gtest')) # To avoid "private field 'pretty_' is not used" on clang. n.add_compiler_flags('-Wno-unused-private-field') n.build_default(['gtest-all.cc']).archive()
os.environ['BUILD_NUMBER'] = '-'.join(tokens[1:]) else: os.environ['BUILD_ID'] = _BUILD_NUMBER os.environ['BUILD_NUMBER'] = _BUILD_NUMBER if OPTIONS.is_debug_code_enabled(): os.environ['BUILD_VERSION_TAGS'] = 'test-keys' else: os.environ['BUILD_VERSION_TAGS'] = 'release-keys' # "REL" means a release build (everything else is a dev build). os.environ['PLATFORM_VERSION_CODENAME'] = 'REL' os.environ['PLATFORM_VERSION_ALL_CODENAMES'] = 'REL' os.environ['PLATFORM_VERSION'] = '5.0' # SDK has to be pinned to correct level to avoid loading # unsupported featured from app's APK file. os.environ['PLATFORM_SDK_VERSION'] = str(toolchain.get_android_api_level()) # By convention, ro.product.brand, ro.product.manufacturer and ro.product.name # are always in lowercase. os.environ['PRODUCT_BRAND'] = 'chromium' os.environ['PRODUCT_DEFAULT_LANGUAGE'] = 'en' os.environ['PRODUCT_DEFAULT_REGION'] = 'US' os.environ['PRODUCT_DEFAULT_WIFI_CHANNELS'] = '' os.environ['PRODUCT_MANUFACTURER'] = 'chromium' os.environ['PRODUCT_MODEL'] = 'App Runtime for Chrome' if dev_mode: os.environ['PRODUCT_MODEL'] += ' Dev' os.environ['PRODUCT_NAME'] = 'arc' os.environ['TARGET_AAPT_CHARACTERISTICS'] = 'default' os.environ['TARGET_BOARD_PLATFORM'] = OPTIONS.target()
""" import os from src.build import analyze_diffs from src.build import build_common from src.build import lint_source from src.build import ninja_generator from src.build import ninja_generator_runner from src.build import open_source from src.build import staging from src.build import toolchain from src.build.build_options import OPTIONS _ANDROID_SYSTEM_IMAGE_DIR = ('ndk/platforms/android-%d' % toolchain.get_android_api_level()) def _generate_gtest_ninja(name, instances=0, enable_libcxx=False, host=False): n = ninja_generator.ArchiveNinjaGenerator( name, base_path='android/external/chromium_org/testing/gtest/src', instances=instances, force_compiler='clang', enable_cxx11=True, enable_libcxx=enable_libcxx, host=host) n.add_include_paths( staging.as_staging('android/external/chromium_org/testing/gtest')) # To avoid "private field 'pretty_' is not used" on clang. n.add_compiler_flags('-Wno-unused-private-field')