Ejemplo n.º 1
0
def add_gradle_task(*, calldir, target='', abis=[], extra_args=[], **kwargs):
    _init()
    if dragon.OPTIONS.android_abis:
        abis = dragon.OPTIONS.android_abis
    _args = [target]
    _args.extend(extra_args)
    dragon.add_meta_task(
        posthook=lambda task, dragon_args: _gradle(calldir, abis, _args),
        **kwargs)
Ejemplo n.º 2
0
def add_task_build_common(android_abis, default_abi=None):
    _init()
    if dragon.OPTIONS.android_abis:
        android_abis = dragon.OPTIONS.android_abis

    # Check if asan is used
    raw_asan = dragon.get_alchemy_var('USE_ADDRESS_SANITIZER')
    if not raw_asan or raw_asan == '0':
        asan = False
    else:
        asan = True

    # Register all abi/arch\
    for abi in android_abis:
        _add_android_abi(abi, asan)

    # Update basic alchemy task to use default abi
    if not default_abi:
        default_abi = android_abis[0]
    if default_abi not in android_abis:
        logging.error('Default android abi(%s) is not in %s', default_abi,
                      android_abis)
    else:
        dragon.override_alchemy_task(
            'alchemy',
            prehook=lambda task, args: _setup_android_abi(
                task, args, default_abi),
            outsubdir=default_abi,
            host_in_subdir=False)

    # Override genproject tasks
    gen_tasks = {
        'genvscode': 'Generate VisualStudio Code project',
    }
    for taskname, taskdesc in gen_tasks.items():
        dragon.override_meta_task(
            name=taskname,
            desc=taskdesc,
            exechook=lambda task, args: _hook_alchemy_genproject_android(
                task, args, default_abi))

    # Meta-task to build all common code abi/arch
    dragon.add_meta_task(
        name='build-common',
        desc='Build android common code for all architectures',
        subtasks=['build-common-' + abi for abi in android_abis],
        weak=True,
        secondary_help=True)
    dragon.add_meta_task(
        name='clean-common',
        desc='Clean android common code for all architectures',
        subtasks=['clean-common-' + abi for abi in android_abis],
        weak=True,
        secondary_help=True)
Ejemplo n.º 3
0
def add_ndk_build_task(*,
                       calldir='',
                       module='',
                       abis=[],
                       extra_args=[],
                       ignore_failure=False,
                       **kwargs):
    _init()
    if dragon.OPTIONS.android_abis:
        abis = dragon.OPTIONS.android_abis
    dragon.add_meta_task(posthook=lambda task, dragon_args: _ndk_build(
        calldir, module, abis, extra_args, ignore_failure),
                         **kwargs)
Ejemplo n.º 4
0
def add_xcodebuild_task(*,
                        calldir='',
                        workspace='',
                        configuration='',
                        scheme='',
                        action='',
                        bundle_id=None,
                        team_id=None,
                        extra_args=[],
                        short_version=False,
                        **kwargs):
    dragon.add_meta_task(posthook=lambda task, args: _xcodebuild(
        calldir, workspace, configuration, scheme, action, bundle_id, team_id,
        extra_args, short_version),
                         **kwargs)
Ejemplo n.º 5
0
def add_xctool_task(calldir='',
                    workspace='',
                    configuration='',
                    scheme='',
                    action='',
                    reporter=None,
                    extra_args=[],
                    name='',
                    desc='',
                    subtasks=[]):
    dragon.add_meta_task(name=name,
                         desc=desc,
                         subtasks=subtasks,
                         posthook=lambda task, args: _xctool(
                             calldir, workspace, configuration, scheme, action,
                             reporter, extra_args))
Ejemplo n.º 6
0
def add_jazzy_task(*, calldir='', scheme='', extra_args=[], **kwargs):
    dragon.add_meta_task(
        posthook=lambda task, args: _jazzy(calldir, scheme, extra_args),
        **kwargs)
Ejemplo n.º 7
0
    if args:
        cmd += " ".join(args)
    dragon.exec_cmd(cmd=cmd, cwd=dirpath)


def publish_android_sdk():
    # Build application
    cmd = "./gradlew "
    cmd += "bintrayUpload"
    dragon.exec_cmd(cmd=cmd, cwd=android_arsdk3_dir)


if dragon.VARIANT == "android":
    dragon.add_meta_task(
        name="build-jni",
        desc="Build android sdk & jni",
        subtasks=["build-sdk"],
        posthook=lambda task, args: build_android_jni(
            os.path.join(android_arsdk3_dir, "arsdk", "jni"), args))

    dragon.add_meta_task(name="publish",
                         desc="Build android sdk & jni",
                         subtasks=["build-jni"],
                         posthook=lambda task, args: publish_android_sdk())

    if os.path.exists(android_sample_dir):
        dragon.add_meta_task(
            name="build-sample",
            desc="Build the android sample in debug",
            subtasks=["build-jni"],
            posthook=lambda task, args: build_android_app(os.path.join(
                android_sample_dir, "buildWithLocalSDK"),
Ejemplo n.º 8
0
                               extra_args=[
                                   "PACKAGES_DIR={}".format(
                                       os.path.join(dragon.WORKSPACE_DIR,
                                                    "packages")), "clean"
                               ],
                               ignore_failure=True)

    android.add_gradle_task(name="build-app",
                            desc="Build the PDrAW Android app in debug",
                            subtasks=["build-jni"],
                            calldir=android_app_dir,
                            target="assembleDebug")

    android.add_gradle_task(name="clean-app",
                            desc="Clean the PDrAW Android app",
                            subtasks=["clean-jni"],
                            calldir=android_app_dir,
                            target="clean")

    dragon.add_meta_task(
        name="build",
        desc="Build libs & app",
        # Should be "build-app" when app is available
        subtasks=["build-jni"])

    dragon.add_meta_task(
        name="clean",
        desc="Clean libs & app",
        # Should be "clean-app" when app is available
        subtasks=["clean-jni"])
Ejemplo n.º 9
0
#===============================================================================
# Tasks
#===============================================================================

dragon.add_alchemy_task(
    name="alchemy",
    desc="Directly pass commands to alchemy",
    product=dragon.PRODUCT,
    variant=dragon.VARIANT,
    weak=False,
)

dragon.add_meta_task(
    name="build",
    desc="Build everything and generate final directory",
    subtasks=["alchemy all final"],
    weak=True,
)

dragon.add_meta_task(
    name="clean",
    desc="Clean everything",
    subtasks=["alchemy clobber"],
    posthook=hook_post_clean,
    weak=True,
)

dragon.add_meta_task(name="images",
                     desc="Generate default images for product",
                     subtasks=["alchemy image"],
                     prehook=hook_pre_images,
Ejemplo n.º 10
0
#===============================================================================
# Tasks
#===============================================================================

dragon.add_alchemy_task(
    name = "alchemy",
    desc = "Directly pass commands to alchemy",
    product = dragon.PRODUCT,
    variant = dragon.VARIANT,
    weak = False,
)

dragon.add_meta_task(
    name = "build",
    desc = "Build everything and generate final directory",
    subtasks=["alchemy all final"],
    weak = True,
)

dragon.add_meta_task(
    name = "clean",
    desc = "Clean everything",
    subtasks=["alchemy clobber"],
    posthook = hook_post_clean,
    weak = True,
)

dragon.add_meta_task(
    name="images",
    desc="Generate default images for product",
    subtasks=["alchemy image"],
Ejemplo n.º 11
0
#===============================================================================
#===============================================================================
if dragon.VARIANT == "android":
    # Register all abi/arch
    add_android_abi("armeabi")
    add_android_abi("armeabi-v7a")
    add_android_abi("mips")
    add_android_abi("x86")
    add_android_abi("arm64-v8a")

    # Meta-task to build all sdk abi/arch
    dragon.add_meta_task(name="build-sdk",
                         desc="Build android sdk for all architectures",
                         subtasks=[
                             "alchemy-armeabi all sdk",
                             "alchemy-armeabi-v7a all sdk",
                             "alchemy-mips all sdk",
                             "alchemy-x86 all sdk",
                             "alchemy-arm64-v8a all sdk",
                         ],
                         weak=True)

    # add clean-sdk to clean all abi/arch
    dragon.add_meta_task(name="clean-sdk",
                         desc="Clean android sdk for all architectures",
                         subtasks=[
                             "alchemy clobber",
                             "alchemy-armeabi clobber",
                             "alchemy-armeabi-v7a clobber",
                             "alchemy-mips clobber",
                             "alchemy-x86 clobber",
                             "alchemy-arm64-v8a clobber",
Ejemplo n.º 12
0
    # invoke alchemy qtcreatorproject python script
    build_cmd = "-p %s-%s -A" % (dragon.PRODUCT, dragon.VARIANT)
    dragon.exec_dir_cmd(
        dirpath=dragon.WORKSPACE_DIR,
        cmd="%s/scripts/qtcreatorproject.py %s -b '%s' %s" %
        (dragon.ALCHEMY_HOME, alchemy_xml, build_cmd, " ".join(projects)))


#===============================================================================
# Tasks
#===============================================================================

dragon.add_meta_task(
    name="build",
    desc="Build everything and generate final directory",
    subtasks=["alchemy all final"],
    weak=True,
)

dragon.add_meta_task(
    name="clean",
    desc="Clean everything",
    subtasks=["alchemy clobber"],
    posthook=hook_post_clean,
    weak=True,
)

dragon.add_meta_task(name="all",
                     desc="Build and generate images for product",
                     subtasks=["build", "images"],
                     weak=True)
Ejemplo n.º 13
0
    android.add_ndk_build_task(
        name="clean-jni",
        desc="Clean android arsdk jni",
        calldir=os.path.join(android_arsdk3_dir, "arsdk", "jni"),
        module="arsdk",
        abis=android_abis,
        extra_args=["PACKAGES_DIR={}".format(os.path.join(dragon.WORKSPACE_DIR,
                                                          "packages")),
                    "clean"],
        ignore_failure=True
    )

    dragon.add_meta_task(
        name="build-sdk",
        desc="build android sdk",
        subtasks=["build-jni"]
    )

    dragon.add_meta_task(
        name="clean-sdk",
        desc="clean android sdk",
        subtasks=["clean-jni", "clean-common"]
    )

    android.add_gradle_task(
        name="publish",
        desc="Build & publish android sdk & jni",
        subtasks=["build-sdk"],
        calldir=android_arsdk3_dir,
        target="bintrayUpload"
        gen_app = True
        app_release = True
        args_app = tasksargs[tasklist.index("build-release-app")]

    if gen_jni:
        build_jni()
    if gen_app:
        build_app(release=app_release)

#===============================================================================
# Tasks
#===============================================================================

dragon.add_meta_task(
    name = "build-sdk",
    desc = "Build SDK",
    subtasks = ["build"],
)

dragon.add_meta_task(
    name = "build-jni",
    desc = "Build SDK & JNI",
    subtasks = ["build-sdk"],
)

dragon.add_meta_task(
    name = "build-app",
    desc = "Build SDK, JNI & generate application",
    subtasks = ["build-jni"],
)
#    cmd += "-derivedDataPath %s " % os.path.join(dragon.OUT_DIR, "ARFreeFlight")
#    cmd += "archive -archivePath %s " % os.path.join(dragon.OUT_DIR, "ARFreeFlight.xcarchive")
    if args:
        cmd += " ".join(args)
    dragon.exec_dir_cmd(dirpath=arfreeflight_ios_dir, cmd=cmd)

    #  TODO: Export ipa file (require archive)
#    cmd = "xcodebuild "
#    cmd += "-exportArchive -exportFormat ipa "
#    cmd += "-archivePath build/ARFreeFlight.xcarchive "
#    cmd += "-exportPath build/ARFreeFlight.ipa "
#    cmd += "-exportProvisioningProfile 'iOS Team Provisioning Profile: *' "
#    dragon.exec_dir_cmd(dirpath=arfreeflight_ios_dir, cmd=cmd)

#===============================================================================
# Tasks
#===============================================================================

dragon.add_meta_task(
    name = "build-sdk",
    desc = "Build SDK",
    subtasks = ["build"],
)

dragon.add_meta_task(
    name = "build-app",
    desc = "Build SDK & generate application",
    subtasks = ["build-sdk"],
    posthook = build_app,
)