Skip to content

[Preset] Add linux crosscompile android preset #16557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 22, 2018

Conversation

AndrewSB
Copy link
Contributor

@AndrewSB AndrewSB commented May 11, 2018

The preset needs to include all of the following options passed to build-script:

    -R \                                       # Build in ReleaseAssert mode.
    --android \                                # Build for Android.
    --android-ndk $NDK_PATH \   # Path to an Android NDK.
    --android-api-level 21 \                   # The Android API level to target. Swift only supports 21 or greater.
    --android-icu-uc ${ARM_DIR}/libicuucswift.so \
    --android-icu-uc-include ${ARM_DIR}/icu/source/common \
    --android-icu-i18 ${ARM_DIR}/libicui18nswift.so \
    --android-icu-i18n-include ${ARM_DIR}/icu/source/i18n

I couldn't find other examples of presets that cross compile, @shahmishal is there a simple way to add this?

@shahmishal
Copy link
Member

@AndrewSB You can try following:

[preset: buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build]
mixin-preset=buildbot_linux

release
assertions

dash dash

android
android-ndk=%(ndk_path)s
android-api-level=21
android-icu-uc=%(arm_dir)s/libicuucswift.so
android-icu-uc-include=%(arm_dir)s/icu/source/common
android-icu-i18=%(arm_dir)s/libicui18nswift.so
android-icu-i18n-include=%(arm_dir)s/icu/source/i18n

To test the preset try:

./utils/build-script --preset=buildbot_linux_crosscompile_android,tools=RA,stdlib=RD,build ndk_path=<NDK_PATH> arm_dir=<ARM_DIR>

@shahmishal
Copy link
Member

@swift-ci smoke test

@shahmishal
Copy link
Member

@swift-ci smoke test

@shahmishal
Copy link
Member

You will need to update the test to support ndk_path and arm_dir, https://github.com/apple/swift/blob/4edb8d9baa50bddb4288b48eadb2b7867ba85e5b/utils/build_swift/tests/test_presets.py#L29

For example:

PRESET_DEFAULTS = {
    'arm_dir': 'arm',
    'darwin_toolchain_alias': 'Alias',
    'darwin_toolchain_bundle_identifier': 'BundleIdentifier',
    'darwin_toolchain_display_name': 'DisplayName',
    'darwin_toolchain_display_name_short': 'DispalyNameShort',
    'darwin_toolchain_version': '1.0',
    'darwin_toolchain_xctoolchain_name': 'default',
    'extra_swift_args': '',
    'install_destdir': '/tmp/install',
    'install_symroot': '/tmp/install/symroot',
    'install_toolchain_dir': '/tmp/install/toolchain',
    'installable_package': '/tmp/install/pkg',
    'ndk_path': '/path/to/ndk',
    'swift_install_destdir': '/tmp/install/swift',
    'symbols_package': '/path/to/symbols/package',
}

@AndrewSB
Copy link
Contributor Author

@compnerd please smoke test

@compnerd
Copy link
Member

@swift-ci please smoke test

@shahmishal shahmishal merged commit 983d9ac into swiftlang:master Jun 22, 2018
@AndrewSB AndrewSB deleted the android-preset branch June 25, 2018 18:17
@AndrewSB AndrewSB changed the title [WIP] [Preset] Add linux crosscompile android preset [Preset] Add linux crosscompile android preset Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants