• Stars
    star
    416
  • Rank 104,068 (Top 3 %)
  • Language
    Shell
  • License
    MIT License
  • Created almost 7 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Swift Android Toolchain Download CI

Automated scripts to build Swift Android cross compilation toolchain for macOS

Installation

Prebuilt toolchains are located on Github Releases

Prepare environment (macOS x86_64 or macOS arm64)

  1. [IMPORTANT] Install XCode 13.0 and make it default in Command Line
  2. Install brew if needed
  3. Install tools, NDK and Swift Android Toolchain
# install system tools
brew install coreutils cmake wget
 
cd ~
mkdir android
cd android
 
# install ndk
wget https://dl.google.com/android/repository/android-ndk-r21e-darwin-x86_64.zip
unzip android-ndk-r21e-darwin-x86_64.zip
rm -rf android-ndk-r21e-darwin-x86_64.zip
 
# instal swift android toolchain
SWIFT_ANDROID=$(curl --silent "https://api.github.com/repos/readdle/swift-android-toolchain/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
wget https://github.com/readdle/swift-android-toolchain/releases/latest/download/swift-android-$SWIFT_ANDROID.zip
unzip swift-android-$SWIFT_ANDROID.zip
rm -rf swift-android-$SWIFT_ANDROID.zip

swift-android-$SWIFT_ANDROID/bin/swift-android tools --update
ln -sfn swift-android-$SWIFT_ANDROID swift-android-current
unset SWIFT_ANDROID
  1. Setup environment variables by putting this to .profile
export ANDROID_NDK_HOME=$HOME/android/android-ndk-r21e
export SWIFT_ANDROID_HOME=$HOME/android/swift-android-current
 
export PATH=$ANDROID_NDK_HOME:$PATH
export PATH=$SWIFT_ANDROID_HOME/bin:$SWIFT_ANDROID_HOME/build-tools/current:$PATH
  1. Include .profile to your .bashrc or .zshrc if needed by adding this line
source $HOME/.profile

Build and Test swift modules

Our current swift build system is tiny wrapper over Swift PM. See Swift PM docs for more info.

Command Description
swift package clean Clean build folder
swift package update Update dependencies
swift-build Build all products
swift-build --build-tests Build all products and tests

swift-build wrapper scripts works as swift build from swift package manager but configured for android. So you can add any extra params like -Xswiftc -DDEBUG , -Xswiftc -suppress-warnings or --configuration release

Example of compilation flags:

Debug

swift-build --configuration debug \
    -Xswiftc -DDEBUG \
    -Xswiftc -Xfrontend -Xswiftc -experimental-disable-objc-attr

Release

swift-build --configuration release \
    -Xswiftc -Xfrontend -Xswiftc -experimental-disable-objc-attr \
    -Xswiftc -Xllvm -Xswiftc -sil-disable-pass=array-specialize

Build swift modules with Android Studio

This plugin integrates Swift Android Toolchain to Gradle

Other swift releated projects

  1. Anotation Processor for generating JNI code
  2. Sample todo app
  3. Cross-platform swift weather app

More Repositories

1

app-store-server-api

Pure PHP library that allows managing customer transactions using the App Store Server API and handling server-to-server notifications using the App Store Server Notifications V2
PHP
50
star
2

swift-java-codegen

Swift Java Codegeneration annotation processor
Java
28
star
3

swift-windows-gha

Swift for Windows build helper tool. Also Swift Toolchain and SDK snapshots.
Batchfile
26
star
4

swift-android-buildtools

Python
22
star
5

app-store-receipt-verification

Pure PHP library that allows receipts parsing/validation/verification without API calls to the App Store Server API
PHP
19
star
6

google_breakpad_server

Python
6
star
7

swift-java-coder

Swift-Java Encoder Decoder
Swift
6
star
8

fqdb

PHP wrapper for PDO
PHP
5
star
9

rdhttp

powerful iOS HTTP client library
Objective-C
5
star
10

system7

System 7 is the Git submodules system for mere mortals.
Objective-C
4
star
11

swift-android-google-breakpad

C++
4
star
12

swift-anycodable

Utils that help encode/decode abstract types via Swift Codable API
Swift
3
star
13

SwiftFMDB

SwiftFMDB is pure swift version of FMDB
Swift
2
star
14

php_scheduler

Scheduler is a cron-like php environment for docker containers
PHP
2
star
15

tensorflow-lite-swift

TensorFlowLiteSwift
Swift
1
star
16

houston

Houston allows you to create command-line commands for NodeJS.
CoffeeScript
1
star
17

swift-java

Java swift module
Swift
1
star
18

stripe-httpclient-mock

PHP
1
star
19

jquery-livesearcher

live search field (with auto-complete) for jQuery
JavaScript
1
star
20

swift-android-ndk

Swift package for Android NDK API
C
1
star
21

swift-android-trace

C-wrapper for Trace (systrace) compatible with Swift
C
1
star
22

RDMPEG

Objective-C
1
star