-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
archurtan
committed
Jan 11, 2022
1 parent
fbc4756
commit 7f886df
Showing
4 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!/bin/sh | ||
|
||
rb=$(git rev-parse --abbrev-ref HEAD) | ||
echo $rb | ||
echo $GIT_BRANCH_IMAGE_VERSION | ||
|
||
# 1.拉取eNet支持库 | ||
git clone https://$GIT_ACCESS_TOKEN@github.com/tencentyun/iot-p2p.git | ||
cd iot-p2p | ||
if [ "$1" = "Release" ]; then | ||
git checkout $GIT_BRANCH_IMAGE_VERSION | ||
else | ||
git checkout $rb | ||
fi | ||
|
||
# 1.1获取p2p版本号 | ||
VIDEOSDKRC=$(git rev-parse --short HEAD) | ||
rc=$rb+git.$VIDEOSDKRC | ||
if [ "$1" = "Release" ]; then | ||
rc=$GIT_BRANCH_IMAGE_VERSION+git.$VIDEOSDKRC | ||
fi | ||
rc=${rc#*v} | ||
echo $rc | ||
|
||
# 2.拷贝app_interface源文件至android_device/samples/iot_video_demo | ||
mkdir android_device/samples/iot_video_demo/app_interface | ||
mv app_interface/curl_inc/* android_device/samples/iot_video_demo/app_interface | ||
mv app_interface/app_p2p/* android_device/samples/iot_video_demo/app_interface | ||
mv app_interface/cloud_api/* android_device/samples/iot_video_demo/app_interface | ||
mv app_interface/utils/* android_device/samples/iot_video_demo/app_interface | ||
rm android_device/samples/iot_video_demo/app_interface/utils_hmac.cpp | ||
|
||
# 2.1 更新p2p代码版本 | ||
sed -i "s#.*VIDEOSDKVERSION.*#static const char * VIDEOSDKVERSION = \"$rc\";#g" android_device/samples/iot_video_demo/app_interface/appWrapper.h | ||
|
||
mv ../.github/file/libs/arm64-v8a/libcurl.a android_device/lib/arm64-v8a | ||
mv ../.github/file/libs/armeabi-v7a/libcurl.a android_device/lib/armeabi-v7a | ||
|
||
# 3.编译iot_video_demo.so | ||
mkdir -p build/android_arm64 | ||
cd build/android_arm64 | ||
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=/usr/local/lib/android/sdk/ndk/16.1.4479499/build/cmake/android.toolchain.cmake -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9 -DANDROID_NDK=/usr/local/lib/android/sdk/ndk/16.1.4479499 -DCMAKE_BUILD_TYPE=Release -DANDROID_NATIVE_API_LEVEL=android-9 -DANDROID_ABI=arm64-v8a -DANDROID_TOOLCHAIN=clang -DENET_NO_STATIC_BINARY=ON -DBUNDLE_CERTS=OFF -DWITH_DHT=OFF -DBUILD_WITH_FS=OFF -DWITH_ZIP=OFF -DWITH_XDFS=OFF -DWITH_UPNP=OFF | ||
make all -j8 | ||
|
||
cd ../../ | ||
mkdir -p build/android_armv7 | ||
cd build/android_armv7 | ||
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=/usr/local/lib/android/sdk/ndk/16.1.4479499/build/cmake/android.toolchain.cmake -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9 -DANDROID_NDK=/usr/local/lib/android/sdk/ndk/16.1.4479499 -DCMAKE_BUILD_TYPE=Release -DANDROID_NATIVE_API_LEVEL=android-9 -DANDROID_ABI=armeabi-v7a -DANDROID_TOOLCHAIN=clang -DENET_NO_STATIC_BINARY=ON -DBUNDLE_CERTS=OFF -DWITH_DHT=OFF -DBUILD_WITH_FS=OFF -DWITH_ZIP=OFF -DWITH_XDFS=OFF -DWITH_UPNP=OFF | ||
make all -j8 | ||
|
||
cd ../../ | ||
mv build/android_arm64/libenet.a android_device/lib/arm64-v8a | ||
mv build/android_arm64/_deps/libevent-build/*.a android_device/lib/arm64-v8a | ||
mv build/android_arm64/_deps/mbedtls-build/library/*.a android_device/lib/arm64-v8a | ||
mv build/android_arm64/_deps/minizip-build/*.a android_device/lib/arm64-v8a | ||
mv build/android_arm64/_deps/tinyxml2-build/*.a android_device/lib/arm64-v8a | ||
|
||
mv build/android_armv7/libenet.a android_device/lib/armeabi-v7a | ||
mv build/android_armv7/_deps/libevent-build/*.a android_device/lib/armeabi-v7a | ||
mv build/android_armv7/_deps/mbedtls-build/library/*.a android_device/lib/armeabi-v7a | ||
mv build/android_armv7/_deps/minizip-build/*.a android_device/lib/armeabi-v7a | ||
mv build/android_armv7/_deps/tinyxml2-build/*.a android_device/lib/armeabi-v7a | ||
|
||
cd android_device | ||
./cmake_build.sh ANDROID | ||
|
||
ls -l output/arm64-v8a/ | ||
ls -l output/armeabi-v7a/ | ||
|
||
mv output/armeabi-v7a/libiot_video_demo.so device_video_aar/explorer-device-video-sdk/libs/armeabi-v7a | ||
mv output/arm64-v8a/libiot_video_demo.so device_video_aar/explorer-device-video-sdk/libs/arm64-v8a | ||
|
||
# 4.构建打包aar所需要的app头文件以及native-lib.cpp文件 | ||
mv ../android/java/*.java device_video_aar/explorer-device-video-sdk/src/main/java/com/tencent/xnet | ||
mv ../android/cpp/native-lib.cpp device_video_aar/explorer-device-video-sdk/src/main/cpp/app-native-lib.cpp | ||
sed -i '/\/\/xxxxxxJNI_OnLoad & JNI_OnUnload xxxxxx/, +30d' device_video_aar/explorer-device-video-sdk/src/main/cpp/app-native-lib.cpp | ||
mv samples/iot_video_demo/app_interface/appWrapper.h device_video_aar/explorer-device-video-sdk/src/main/cpp | ||
mv samples/iot_video_demo/app_interface/app_log.h device_video_aar/explorer-device-video-sdk/src/main/cpp |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Android App&Device Combine CI | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- '**.md' | ||
- 'LICENSE' | ||
|
||
env: | ||
IOT_SONATYPE_USERNAME: ${{ secrets.IOT_SONATYPE_USERNAME }} | ||
IOT_SONATYPE_PASSWORD: ${{ secrets.IOT_SONATYPE_PASSWORD }} | ||
GPG_DECRYPT_PASSPHRASE: ${{ secrets.GPG_DECRYPT_PASSPHRASE }} | ||
IOT_GPG_KEYNAME: ${{ secrets.IOT_GPG_KEYNAME }} | ||
IOT_GPG_PASSPHRASE: ${{ secrets.IOT_GPG_PASSPHRASE }} | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup cmake | ||
uses: jwlawson/actions-setup-cmake@v1.8 | ||
with: | ||
cmake-version: '3.17.0' | ||
- name: Use cmake | ||
run: echo +++++$(cmake --version) | ||
|
||
- name: Setup NDK | ||
run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;16.1.4479499" | ||
|
||
|
||
- name: build libenet debug | ||
if: startsWith(github.event.ref, 'refs/heads') | ||
run: | | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
export GIT_BRANCH_IMAGE_VERSION=$VERSION | ||
sh .github/script/build_android_combine.sh Debug | ||
env: | ||
GIT_ACCESS_TOKEN: ${{ secrets.IOT_GITHUB_ACCESS_TOKEN }} | ||
PROVISIONING_PASSWORD: ${{ secrets.GPG_DECRYPT_PASSPHRASE }} | ||
- name: build libenet release | ||
if: startsWith(github.event.ref, 'refs/tags') | ||
run: | | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
export GIT_BRANCH_IMAGE_VERSION=$VERSION | ||
sh .github/script/build_android_combine.sh Release | ||
env: | ||
GIT_ACCESS_TOKEN: ${{ secrets.IOT_GITHUB_ACCESS_TOKEN }} | ||
PROVISIONING_PASSWORD: ${{ secrets.GPG_DECRYPT_PASSPHRASE }} | ||
|
||
- name: Update sdk version debug | ||
if: startsWith(github.event.ref, 'refs/heads') | ||
run: | | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
export GIT_BRANCH_IMAGE_VERSION=$VERSION | ||
bash .github/script/update_version_for_android.sh Debug iot-p2p/android_device/device_video_aar/explorer-device-video-sdk/build.gradle | ||
- name: Update sdk version release | ||
if: startsWith(github.event.ref, 'refs/tags') | ||
run: | | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
export GIT_BRANCH_IMAGE_VERSION=$VERSION | ||
bash .github/script/update_version_for_android.sh Release iot-p2p/android_device/device_video_aar/explorer-device-video-sdk/build.gradle | ||
- name: Update Values of Signing | ||
run: | | ||
export KEY_ID_OF_SIGN=$IOT_GPG_KEYNAME | ||
export PASSWORD_OF_SIGN=$IOT_GPG_PASSPHRASE | ||
sh .github/script/update_values_for_sign.sh iot-p2p/android_device/device_video_aar/gradle.properties | ||
- name: Build with Gradle | ||
run: | | ||
gpg -d --passphrase "$GPG_DECRYPT_PASSPHRASE" --batch --quiet .github/file/secring.gpg.asc > secring.gpg | ||
chmod -R 777 iot-p2p/android_device/device_video_aar/ | ||
cd iot-p2p/android_device/device_video_aar/ | ||
./gradlew build | ||
- name: Publish aar to Maven | ||
run: | | ||
chmod -R 777 iot-p2p/android_device/device_video_aar/ | ||
cd iot-p2p/android_device/device_video_aar/ | ||
./gradlew publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,5 @@ iot-p2p/ | |
*.java | ||
*.h | ||
CMakeLists* | ||
#build_*.sh | ||
iot_build*.sh |