Beispiel #1
0
def setup(fips_dir) :
    """setup the Android SDK and NDK"""
    log.colored(log.YELLOW, '=== setup Android SDK/NDK :')

    # first make sure that java is present, otherwise the Android
    # SDK setup will finish without errors, but is not actually usable
    if not java.check_exists(fips_dir) or not javac.check_exists(fips_dir) :
        log.error("please install Java JDK 8 (see './fips diag tools')")
    ensure_sdk_dirs(fips_dir)

    # download the command line tools archive
    tools_archive_path = get_tools_archive_path(fips_dir)
    tools_url = get_tools_url()
    log.info("downloading '{}'...".format(tools_url))
    urlretrieve(tools_url, tools_archive_path, util.url_download_hook)
    log.info("\nunpacking '{}'...".format(tools_archive_path))
    uncompress(fips_dir, tools_archive_path)

    # install the required SDK components through sdkmanager
    install_package(fips_dir, '"platforms;android-28"')
    install_package(fips_dir, '"build-tools;29.0.3"')
    install_package(fips_dir, 'platform-tools')
    install_package(fips_dir, 'ndk-bundle')

    # check for potentially breaking changes in build setup
    fips_cmake = fips_dir + '/cmake-toolchains/android.toolchain.orig'
    ndk_cmake = get_sdk_dir(fips_dir) + '/ndk-bundle/build/cmake/android.toolchain.cmake'
    if compute_sha256(ndk_cmake, strip_whitespace) != compute_sha256(fips_cmake, strip_whitespace) :
        log.warn('android.toolchain.cmake in fips might be outdated...')

    log.colored(log.GREEN, "done.")
Beispiel #2
0
def setup(fips_dir, proj_dir) :
    """setup the Android SDK and NDK"""
    log.colored(log.YELLOW, '=== setup Android SDK/NDK :')

    # first make sure that java is present, otherwise the Android
    # SDK setup will finish without errors, but is not actually usable
    if not java.check_exists(fips_dir) :
        log.error("please install java first (see './fips diag tools')")

    ensure_sdk_dirs(fips_dir)

    # download and setup the Android SDK
    sdk_archive_path = get_androidsdk_archive_path(fips_dir)
    if not os.path.isfile(sdk_archive_path) :        
        sdk_url = get_sdk_url()
        log.info("downloading '{}'...".format(sdk_url))
        urllib.urlretrieve(sdk_url, sdk_archive_path, util.url_download_hook)
    else :
        log.info("'{}' already exists".format(sdk_archive_path))
    log.info("\nunpacking '{}'...".format(sdk_archive_path))
    uncompress(fips_dir, sdk_archive_path)
    log.info("downloading additional SDK files...")
    update_android_sdk(fips_dir, proj_dir)

    # download the Android NDK
    ndk_archive_path = get_androidndk_archive_path(fips_dir)
    if not os.path.isfile(ndk_archive_path) :
        ndk_url = get_ndk_url()
        log.info("downloading '{}'...".format(ndk_url))
        urllib.urlretrieve(ndk_url, ndk_archive_path, util.url_download_hook)
    else :
        log.info("'{}' already exists".format(ndk_archive_path))
    log.info("\nunpacking '{}'...".format(ndk_archive_path))
    uncompress(fips_dir, ndk_archive_path)

    log.colored(log.GREEN, "done.")