Merge pull request #3173 from mozilla/ios-framework-publish

Build and publish iOS framework in GitHub release files
This commit is contained in:
Reuben Morais 2020-07-22 11:44:51 +02:00 committed by GitHub
commit 38f6afdba8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 61 additions and 6 deletions

View File

@ -5,6 +5,6 @@
location = "group:deepspeech_ios.xcodeproj"> location = "group:deepspeech_ios.xcodeproj">
</FileRef> </FileRef>
<FileRef <FileRef
location = "group:deepspeech_ios_test/deepspeech_ios_test.xcodeproj"> location = "group:deepspeech_ios_test.xcodeproj">
</FileRef> </FileRef>
</Workspace> </Workspace>

View File

@ -53,7 +53,7 @@
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
507CD3A024B61FE400409BBB /* deepspeech_ios.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = deepspeech_ios.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 507CD3A024B61FE400409BBB /* deepspeech_ios.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = deepspeech_ios.framework; sourceTree = BUILT_PRODUCTS_DIR; };
507CD3A224B61FEA00409BBB /* libdeepspeech.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libdeepspeech.so; path = ../libdeepspeech.so; sourceTree = "<group>"; }; 507CD3A224B61FEA00409BBB /* libdeepspeech.so */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libdeepspeech.so; path = libdeepspeech.so; sourceTree = "<group>"; };
50F787EF2497683900D52237 /* deepspeech_ios_test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = deepspeech_ios_test.app; sourceTree = BUILT_PRODUCTS_DIR; }; 50F787EF2497683900D52237 /* deepspeech_ios_test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = deepspeech_ios_test.app; sourceTree = BUILT_PRODUCTS_DIR; };
50F787F22497683900D52237 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 50F787F22497683900D52237 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
50F787F42497683900D52237 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; }; 50F787F42497683900D52237 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };

View File

@ -13,7 +13,7 @@ build:
tensorflow: ${system.tensorflow.ios_arm64.url} tensorflow: ${system.tensorflow.ios_arm64.url}
scripts: scripts:
build: "taskcluster/ios-build.sh --arm64" build: "taskcluster/ios-build.sh --arm64"
package: "taskcluster/package.sh" package: "taskcluster/ios-package.sh --arm64"
nc_asset_name: "native_client.arm64.tflite.ios.tar.xz" nc_asset_name: "native_client.arm64.tflite.ios.tar.xz"
maxRunTime: 14400 maxRunTime: 14400
metadata: metadata:

View File

@ -2,7 +2,7 @@
set -xe set -xe
platform=$1 arch=$1
source $(dirname "$0")/tc-tests-utils.sh source $(dirname "$0")/tc-tests-utils.sh
@ -12,7 +12,7 @@ BAZEL_TARGETS="
//native_client:libdeepspeech.so //native_client:libdeepspeech.so
" "
if [ "${platform}" = "--arm64" ]; then if [ "${arch}" = "--arm64" ]; then
BAZEL_BUILD_FLAGS="${BAZEL_IOS_ARM64_FLAGS}" BAZEL_BUILD_FLAGS="${BAZEL_IOS_ARM64_FLAGS}"
else else
BAZEL_BUILD_FLAGS="${BAZEL_IOS_X86_64_FLAGS}" BAZEL_BUILD_FLAGS="${BAZEL_IOS_X86_64_FLAGS}"
@ -21,3 +21,5 @@ fi
BAZEL_ENV_FLAGS="TF_NEED_CUDA=0" BAZEL_ENV_FLAGS="TF_NEED_CUDA=0"
do_bazel_build do_bazel_build
do_deepspeech_ios_framework_build "${arch}"

30
taskcluster/ios-package.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
set -xe
arch=$1
source $(dirname "$0")/tc-tests-utils.sh
mkdir -p ${TASKCLUSTER_ARTIFACTS} || true
cp ${DS_ROOT_TASK}/DeepSpeech/ds/tensorflow/bazel*.log ${TASKCLUSTER_ARTIFACTS}/
package_native_client "native_client.tar.xz"
package_libdeepspeech_as_zip "libdeepspeech.zip"
case $arch in
"--x86_64")
release_folder="Release-iphonesimulator"
artifact_name="deepspeech_ios.framework.x86_64.tar.xz"
;;
"--arm64")
release_folder="Release-iphoneos"
artifact_name="deepspeech_ios.framework.arm64.tar.xz"
;;
esac
${TAR} -cf - \
-C ${DS_ROOT_TASK}/DeepSpeech/ds/native_client/swift/DerivedData/Build/Products/${release_folder}/ deepspeech_ios.framework \
| ${XZ} > "${TASKCLUSTER_ARTIFACTS}/${artifact_name}"

View File

@ -13,7 +13,7 @@ build:
tensorflow: ${system.tensorflow.ios_x86_64.url} tensorflow: ${system.tensorflow.ios_x86_64.url}
scripts: scripts:
build: "taskcluster/ios-build.sh --x86_64" build: "taskcluster/ios-build.sh --x86_64"
package: "taskcluster/package.sh" package: "taskcluster/ios-package.sh --x86_64"
nc_asset_name: "native_client.x86_64.tflite.ios.tar.xz" nc_asset_name: "native_client.x86_64.tflite.ios.tar.xz"
maxRunTime: 14400 maxRunTime: 14400
metadata: metadata:

View File

@ -20,6 +20,8 @@ build:
- "win-amd64-cpu-opt" - "win-amd64-cpu-opt"
- "win-amd64-gpu-opt" - "win-amd64-gpu-opt"
- "win-amd64-ctc-opt" - "win-amd64-ctc-opt"
- "ios-x86_64-tflite-opt"
- "ios-arm64-tflite-opt"
allowed: allowed:
- "tag" - "tag"
ref_match: "refs/tags/" ref_match: "refs/tags/"
@ -66,6 +68,9 @@ build:
- "win-amd64-cpu-opt" - "win-amd64-cpu-opt"
- "win-amd64-gpu-opt" - "win-amd64-gpu-opt"
- "win-amd64-tflite-opt" - "win-amd64-tflite-opt"
ios:
- "ios-x86_64-tflite-opt"
- "ios-arm64-tflite-opt"
metadata: metadata:
name: "DeepSpeech GitHub Packages" name: "DeepSpeech GitHub Packages"
description: "Trigger Uploading of DeepSpeech Packages to GitHub release page" description: "Trigger Uploading of DeepSpeech Packages to GitHub release page"

View File

@ -325,3 +325,21 @@ do_nuget_build()
nuget pack nupkg/deepspeech.nuspec nuget pack nupkg/deepspeech.nuspec
} }
do_deepspeech_ios_framework_build()
{
arch=$1
cp ${DS_TFDIR}/bazel-bin/native_client/libdeepspeech.so ${DS_DSDIR}/native_client/swift/libdeepspeech.so
cd ${DS_DSDIR}/native_client/swift
case $arch in
"--x86_64")
iosSDK="iphonesimulator"
xcodeArch="x86_64"
;;
"--arm64")
iosSDK="iphoneos"
xcodeArch="arm64"
;;
esac
xcodebuild -workspace deepspeech_ios.xcworkspace -scheme deepspeech_ios_test -configuration Release -arch "${xcodeArch}" -sdk "${iosSDK}" -derivedDataPath DerivedData CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
}