Build and publish deepspeech_ios.framework

This commit is contained in:
Reuben Morais 2020-07-21 19:57:07 +02:00
parent 9bdce0a305
commit ce0ef4fd1e
6 changed files with 54 additions and 4 deletions

View File

@ -13,7 +13,7 @@ build:
tensorflow: ${system.tensorflow.ios_arm64.url}
scripts:
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"
maxRunTime: 14400
metadata:

View File

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

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

@ -0,0 +1,28 @@
#!/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")
${TAR} -cf - \
-C ${DS_ROOT_TASK}/DeepSpeech/ds/native_client/swift/DerivedData/Build/Products/Release-iphonesimulator/deepspeech_ios.framework \
| ${XZ} > "${TASKCLUSTER_ARTIFACTS}/ deepspeech_ios.framework.x86_64.tar.xz"
;;
"--arm64")
${TAR} -cf - \
-C ${DS_ROOT_TASK}/DeepSpeech/ds/native_client/swift/DerivedData/Build/Products/Release-iphoneos/deepspeech_ios.framework \
| ${XZ} > "${TASKCLUSTER_ARTIFACTS}/ deepspeech_ios.framework.arm64.tar.xz"
;;
esac

View File

@ -13,7 +13,7 @@ build:
tensorflow: ${system.tensorflow.ios_x86_64.url}
scripts:
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"
maxRunTime: 14400
metadata:

View File

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

View File

@ -315,3 +315,18 @@ do_nuget_build()
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")
xcodebuild -workspace deepspeech_ios.xcworkspace -scheme deepspeech_ios_test -configuration Release -arch x86_64 -sdk "iphonesimulator" -derivedDataPath DerivedData
;;
"--arm64")
xcodebuild -workspace deepspeech_ios.xcworkspace -scheme deepspeech_ios_test -configuration Release -arch arm64 -sdk "iphoneos" -derivedDataPath DerivedData
;;
esac
}