diff --git a/.github/workflows/matrix.yml b/.github/workflows/matrix.yml index 7276998..91869ba 100644 --- a/.github/workflows/matrix.yml +++ b/.github/workflows/matrix.yml @@ -41,10 +41,18 @@ jobs: run: | bash print_settings.sh + - name: Install Python 2 + if: ${{ matrix.install_python2 }} + run: | + sudo apt install python2 + - name: Get NDK and Toolchain run: | bash get_ndk.sh bash get_toolchain.sh + # This is an extra check for files in the NDK we need to know about. + # This is not part of run.sh + bash assert_ndk_files.sh - name: Get SDK if: ${{ matrix.use_java }} @@ -79,6 +87,9 @@ jobs: - name: Configure ACE/TAO and OpenDDS run: bash configure.sh + - name: Show Build Config + run: perl OpenDDS/tools/scripts/show_build_config.pl + - name: Build ACE/TAO and OpenDDS run: bash build.sh @@ -95,6 +106,7 @@ jobs: ndk: r23b api: 30 os: "ubuntu-22.04" + install_python2: false use_security: true use_java: true use_toolchain: false @@ -105,6 +117,7 @@ jobs: ndk: r23b api: 29 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -115,6 +128,7 @@ jobs: ndk: r23b api: 28 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -125,6 +139,7 @@ jobs: ndk: r23b api: 27 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -135,6 +150,7 @@ jobs: ndk: r23b api: 26 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -145,6 +161,7 @@ jobs: ndk: r23b api: 24 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -155,6 +172,7 @@ jobs: ndk: r23b api: 23 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -165,6 +183,7 @@ jobs: ndk: r23b api: 22 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -175,16 +194,7 @@ jobs: ndk: r23b api: 21 os: "ubuntu-22.04" - use_security: false - use_java: false - use_toolchain: false - target_api: 30 - ace_tao: "doc_group_master" - - name: r23b-arm-20-doc-group-master - arch: arm - ndk: r23b - api: 20 - os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -195,6 +205,7 @@ jobs: ndk: r23b api: 19 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -205,6 +216,7 @@ jobs: ndk: r23b api: 18 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -215,6 +227,7 @@ jobs: ndk: r23b api: 17 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -225,6 +238,7 @@ jobs: ndk: r23b api: 16 os: "ubuntu-22.04" + install_python2: false use_security: true use_java: true use_toolchain: false @@ -235,6 +249,7 @@ jobs: ndk: r23b api: 30 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -245,6 +260,7 @@ jobs: ndk: r23b api: 16 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -256,6 +272,7 @@ jobs: ndk: r22b api: 30 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -266,6 +283,7 @@ jobs: ndk: r22b api: 16 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -276,6 +294,7 @@ jobs: ndk: r22b api: 30 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: true @@ -286,6 +305,7 @@ jobs: ndk: r22b api: 16 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: true @@ -297,6 +317,7 @@ jobs: ndk: r20b api: 29 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -307,6 +328,7 @@ jobs: ndk: r20b api: 16 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -318,6 +340,7 @@ jobs: ndk: r19c api: 28 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -328,6 +351,7 @@ jobs: ndk: r19c api: 16 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -339,6 +363,7 @@ jobs: ndk: r18b api: 16 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: true use_toolchain: true @@ -349,6 +374,7 @@ jobs: ndk: r18b api: 28 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: true @@ -361,6 +387,7 @@ jobs: ndk: r23b api: 30 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -371,6 +398,7 @@ jobs: ndk: r23b api: 29 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -381,6 +409,7 @@ jobs: ndk: r23b api: 28 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -391,6 +420,7 @@ jobs: ndk: r23b api: 27 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -401,6 +431,7 @@ jobs: ndk: r23b api: 26 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -411,6 +442,7 @@ jobs: ndk: r23b api: 24 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -421,6 +453,7 @@ jobs: ndk: r23b api: 23 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -431,6 +464,7 @@ jobs: ndk: r23b api: 22 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -441,16 +475,7 @@ jobs: ndk: r23b api: 21 os: "ubuntu-22.04" - use_security: false - use_java: false - use_toolchain: false - target_api: 30 - ace_tao: "doc_group_ace6_tao2" - - name: r23b-arm-20-doc-group-ace6-tao2 - arch: arm - ndk: r23b - api: 20 - os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -461,6 +486,7 @@ jobs: ndk: r23b api: 19 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -471,6 +497,7 @@ jobs: ndk: r23b api: 18 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -481,6 +508,7 @@ jobs: ndk: r23b api: 17 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -491,6 +519,7 @@ jobs: ndk: r23b api: 16 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -502,6 +531,7 @@ jobs: ndk: r19c api: 28 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -512,6 +542,7 @@ jobs: ndk: r19c api: 16 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: false @@ -523,6 +554,7 @@ jobs: ndk: r18b api: 28 os: "ubuntu-22.04" + install_python2: false use_security: false use_java: false use_toolchain: true @@ -533,6 +565,30 @@ jobs: ndk: r18b api: 16 os: "ubuntu-22.04" + install_python2: false + use_security: false + use_java: false + use_toolchain: true + target_api: 30 + ace_tao: "doc_group_ace6_tao2" +# r12b --------------------------------------------------------------------------- + - name: r12b-arm64-24-install-python2-toolchain-doc-group-ace6-tao2 + arch: arm64 + ndk: r12b + api: 24 + os: "ubuntu-22.04" + install_python2: true + use_security: false + use_java: false + use_toolchain: true + target_api: 30 + ace_tao: "doc_group_ace6_tao2" + - name: r12b-arm-16-install-python2-toolchain-doc-group-ace6-tao2 + arch: arm + ndk: r12b + api: 16 + os: "ubuntu-22.04" + install_python2: true use_security: false use_java: false use_toolchain: true diff --git a/.gitignore b/.gitignore index e05b505..d2d8db3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,18 @@ +/settings.sh + +/MPC /ACE_TAO +/ACE_wrappers /OpenDDS -/MPC + /android-ndk-* /*-toolchain -/jdk -/xerces_source -/iconv_source -/settings.sh -/openssl_source -/ACE_wrappers -/ACE+TAO-2.2a_with_latest_patches.tar.gz -/secdeps_prefix +/commandlinetools-* /android-sdk + +/Python-* +/openssl-* +/libiconv-* +/xerces-c-* +/secdeps_prefix +/*_source diff --git a/README.md b/README.md index 6979264..7153b55 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# An ACE/TAO/OpenDDS Build Matrix for Android [![matrix](https://github.com/iguessthislldo/OpenDDS-Android/workflows/matrix/badge.svg)](https://github.com/iguessthislldo/OpenDDS-Android/actions?query=workflow%3Amatrix) +# An ACE/TAO/OpenDDS Build Matrix for Android + +[![matrix](https://github.com/iguessthislldo/OpenDDS-Android/workflows/matrix/badge.svg)](https://github.com/iguessthislldo/OpenDDS-Android/actions?query=workflow%3Amatrix) Scripts for building [OpenDDS](https://github.com/objectcomputing/OpenDDS) against various combinations of Android NDK and API versions on GitHub Actions. @@ -11,13 +13,14 @@ machine. `M` = [`doc_group_master`](https://github.com/DOCGroup/ACE_TAO) `6` = [`doc_group_ace6_tao2`](https://github.com/DOCGroup/ACE_TAO/tree/ace6tao2) -| | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | -| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | -| r23b | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | -| r22b | `M` | - | - | - | - | - | - | - | - | - | - | - | - | `M` | -| r20b | `M` | - | - | - | - | - | - | - | - | - | - | - | `M` | - | -| r19c | `M`,`6` | - | - | - | - | - | - | - | - | - | - | `M`,`6` | - | - | -| r18b | `M`,`6` | - | - | - | - | - | - | - | - | - | - | `M`,`6` | - | - | +| | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| r23b | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | `M`,`6` | +| r22b | `M` | - | - | - | - | - | - | - | - | - | - | - | `M` | +| r20b | `M` | - | - | - | - | - | - | - | - | - | - | `M` | - | +| r19c | `M`,`6` | - | - | - | - | - | - | - | - | - | `M`,`6` | - | - | +| r18b | `M`,`6` | - | - | - | - | - | - | - | - | - | `M`,`6` | - | - | +| r12b | `6` | - | - | - | - | - | - | `6` | - | - | - | - | - | ### Modifying the Matrix @@ -69,8 +72,7 @@ That's it, assuming nothing goes wrong. There are several environment variables that are the normal settings for the build. These all can be found in `default.settings.sh`. The first three: `ndk`, -`arch`, and `api` are required so set to some example values. The rest are -optional. +`arch`, and `api` are required. The rest are optional. In addition to those, what ACE/TAO and OpenDDS it clones can optionally be controlled using `ACE_TAO_REPO`, `ACE_TAO_BRANCH`, `OPENDDS_REPO`, and diff --git a/assert_ndk_files.sh b/assert_ndk_files.sh new file mode 100755 index 0000000..668b0a8 --- /dev/null +++ b/assert_ndk_files.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash + +set -o pipefail +set -o nounset + +source "known_apis.sh" + +failed=false + +ndks=() +if [ -z "${ndk+x}" ] +then + ndks=(${known_ndks_ndk_only[@]}) +else + if ! [[ ${known_ndks_ndk_only[@]} =~ "${ndk}" ]] + then + echo "$ndk is invalid !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + exit 0 + fi + ndks=($ndk) +fi + +archs=() +if [ -z "${arch+x}" ] +then + arches=(${known_archs[@]}) +else + arches=($arch) +fi + +for ndk in ${ndks[@]} +do + dir="android-ndk-$ndk" + if [ -d $dir ] + then + for arch in ${arches[@]} + do + echo "$ndk-$arch ======================================================================" + known_apis_name="known_apis_${ndk}_${arch}" + declare -n known_apis=$known_apis_name + this_failed=false + for api in ${known_apis[@]} + do + ndk=$ndk arch=$arch api=$api bash assert_ndk_files_for.sh + if [ $? -ne 0 ] + then + this_failed=true + failed=true + fi + done + if ! $this_failed + then + echo "OK" + fi + done + else + echo "$dir not present !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + fi + +done + +if $failed +then + exit 1 +fi diff --git a/assert_ndk_files_for.sh b/assert_ndk_files_for.sh new file mode 100644 index 0000000..d54d58e --- /dev/null +++ b/assert_ndk_files_for.sh @@ -0,0 +1,21 @@ +source setenv.sh + +failed=false +for var in android_cc android_cxx android_ld android_cpp_stdlib +do + file=${!var} + if [ ! -x "$file" ] + then + if ! $failed + then + echo $api ---------------------------------------------------------------------- + failed=true + fi + echo -e "Missing $var=\e[31m$file\e[0m" + fi +done + +if $failed +then + exit 1 +fi diff --git a/build_openssl.sh b/build_openssl.sh index 5c2adb0..e10886c 100755 --- a/build_openssl.sh +++ b/build_openssl.sh @@ -10,6 +10,7 @@ source setenv.sh source make.sh export PATH="$android_toolchain_bin:$PATH" +export ANDROID_NDK_ROOT="${OPENDDS_ANDROID_NDK}" cd openssl_source ./Configure no-tests no-shared android-$arch -D__ANDROID_API__=$api --prefix=$SSL_ROOT diff --git a/build_python2.sh b/build_python2.sh new file mode 100755 index 0000000..e498500 --- /dev/null +++ b/build_python2.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -o pipefail +set -o errexit +set -o nounset + +echo build_python2.sh ========================================================= + +source setenv.sh +source make.sh + +cd python2_source +./configure +$make diff --git a/build_xerces.sh b/build_xerces.sh index 12299f2..1e50d89 100755 --- a/build_xerces.sh +++ b/build_xerces.sh @@ -26,12 +26,20 @@ then popd fi +extra_configure_opts=() + +if [ ! -z "${force_cpp_std+x}" ] +then + extra_configure_opts+=("-DCMAKE_CXX_STANDARD=$force_cpp_std") +fi + pushd xerces_source cmake \ "-DCMAKE_INSTALL_PREFIX=$XERCESCROOT" \ "-DCMAKE_TOOLCHAIN_FILE=$OPENDDS_ANDROID_NDK/build/cmake/android.toolchain.cmake" \ "-DANDROID_ABI=$abi" "-DANDROID_PLATFORM=android-$api" \ - "-DANDROID_CPP_FEATURES=rtti exceptions" + "-DANDROID_CPP_FEATURES=rtti exceptions" \ + "${extra_configure_opts[@]}" $make mkdir -p $XERCESCROOT make install diff --git a/configure.sh b/configure.sh index 513ffb2..0e0e4f1 100755 --- a/configure.sh +++ b/configure.sh @@ -33,13 +33,24 @@ fi if [ $ndk_major_rev -lt 16 ] then - extra_configure_flags+=("--macros=__NDK_MINOR__:=$ndk_minor_rev" "--macros=__NDK_MAJOR__:=$ndk_major_rev") + extra_configure_flags+=( + "--macros=__NDK_MINOR__:=$ndk_minor_rev" + "--macros=__NDK_MAJOR__:=$ndk_major_rev" + # platform_android.GNU should be defining this automatically, but that + # doesn't seem to be working... + '--configh=#define ACE_ANDROID_NDK_MISSING_NDK_VERSION_H' + ) fi if [ $ndk_major_rev -lt 15 ] then extra_configure_flags+=("--macros=android_force_clang:=0") fi +if [ ! -z "${force_cpp_std+x}" ] +then + extra_configure_flags+=("--std=$force_cpp_std") +fi + if ! $use_toolchain then extra_configure_flags+=( @@ -55,16 +66,11 @@ pushd $workspace/OpenDDS > /dev/null --tao=$TAO_ROOT \ --tests \ --no-inline \ - --mpcopts "-workers $logical_cores" \ + --mpc:workers $logical_cores \ --macros=ANDROID_ABI:=$abi \ "${extra_configure_flags[@]}" popd > /dev/null -# Avoid Deprecated POSIX Functions in ACE that OpenDDS Doesn't Use -echo '#define ACE_DISABLE_MKTEMP' >> "$ace_target/ace/config.h" -echo '#define ACE_DISABLE_TEMPNAM' >> "$ace_target/ace/config.h" -echo '#define ACE_LACKS_READDIR_R' >> "$ace_target/ace/config.h" - if $build_ace_tests then pushd $ace_target/tests > /dev/null diff --git a/get_python2.sh b/get_python2.sh new file mode 100755 index 0000000..ffdf5f1 --- /dev/null +++ b/get_python2.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +set -o pipefail +set -o errexit +set -o nounset + +echo get_python2.sh =========================================================== + +source setenv.sh + +function get { + if [ ! -d "$ourname" ] + then + if [ ! \( -f $tarname -o -L $tarname \) ] + then + if [ -f ../$tarname -o -L ../$tarname ] + then + ln -s "../$tarname" "$tarname" + elif [ -f ../../$tarname -o -L ../../$tarname ] + then + ln -s "../../$tarname" "$tarname" + else + download_file "$url" + fi + fi + + if ! ${JUST_CACHE_SOURCES:-false} + then + tar -xzf "$tarname" + mv "$basename" "$ourname" + rm -f "$tarname" + fi + fi +} + +version="2.7.18" +basename="Python-$version" +tarname="$basename.tgz" +url="https://www.python.org/ftp/python/$version/$tarname" +ourname="python2_source" +get diff --git a/get_toolchain.sh b/get_toolchain.sh index a910317..c78ddac 100755 --- a/get_toolchain.sh +++ b/get_toolchain.sh @@ -12,9 +12,14 @@ if $need_toolchain && [ ! -d $toolchain_name ] then echo "Generating Standalone Toolchain" py= - if command -v python2 + if [ -x python2_source/python ] then - py=python2 + py=python2_source/python + else + if command -v python2 + then + py=python2 + fi fi $py $OPENDDS_ANDROID_NDK/build/tools/make_standalone_toolchain.py \ --arch $arch --api $api --install-dir $toolchain_name diff --git a/known_apis.sh b/known_apis.sh new file mode 100644 index 0000000..7f9853f --- /dev/null +++ b/known_apis.sh @@ -0,0 +1,41 @@ +# BEGIN MATRIX +# This part is generated by matrix.py +known_archs=('arm' 'arm64' 'x86' 'x86_64') +known_ndks=('r12b' 'r18b' 'r19c' 'r20b' 'r21e' 'r22b' 'r23b') +known_ndks_ndk_only=('r19c' 'r20b' 'r21e' 'r22b' 'r23b') +known_apis_r12b=('16' '17' '18' '19' '21' '22' '23' '24') +known_apis_r12b_arm=('16' '17' '18' '19' '21' '22' '23' '24') +known_apis_r12b_arm64=('24' '21' '22' '23') +known_apis_r12b_x86=('16' '17' '18' '19' '21' '22' '23' '24') +known_apis_r12b_x86_64=('24' '21' '22' '23') +known_apis_r18b=('16' '17' '18' '19' '21' '22' '23' '24' '26' '27' '28') +known_apis_r18b_arm=('16' '17' '18' '19' '21' '22' '23' '24' '26' '27' '28') +known_apis_r18b_arm64=('21' '22' '23' '24' '26' '27' '28') +known_apis_r18b_x86=('16' '17' '18' '19' '21' '22' '23' '24' '26' '27' '28') +known_apis_r18b_x86_64=('21' '22' '23' '24' '26' '27' '28') +known_apis_r19c=('16' '17' '18' '19' '21' '22' '23' '24' '26' '27' '28') +known_apis_r19c_arm=('16' '17' '18' '19' '21' '22' '23' '24' '26' '27' '28') +known_apis_r19c_arm64=('21' '22' '23' '24' '26' '27' '28') +known_apis_r19c_x86=('16' '17' '18' '19' '21' '22' '23' '24' '26' '27' '28') +known_apis_r19c_x86_64=('21' '22' '23' '24' '26' '27' '28') +known_apis_r20b=('16' '17' '18' '19' '21' '22' '23' '24' '26' '27' '28' '29') +known_apis_r20b_arm=('16' '17' '18' '19' '21' '22' '23' '24' '26' '27' '28' '29') +known_apis_r20b_arm64=('21' '22' '23' '24' '26' '27' '28' '29') +known_apis_r20b_x86=('16' '17' '18' '19' '21' '22' '23' '24' '26' '27' '28' '29') +known_apis_r20b_x86_64=('21' '22' '23' '24' '26' '27' '28' '29') +known_apis_r21e=('16' '17' '18' '19' '21' '22' '23' '24' '26' '27' '28' '29') +known_apis_r21e_arm=('16' '17' '18' '19' '21' '22' '23' '24' '26' '27' '28' '29') +known_apis_r21e_arm64=('21' '22' '23' '24' '26' '27' '28' '29') +known_apis_r21e_x86=('16' '17' '18' '19' '21' '22' '23' '24' '26' '27' '28' '29') +known_apis_r21e_x86_64=('21' '22' '23' '24' '26' '27' '28' '29') +known_apis_r22b=('16' '17' '18' '19' '21' '22' '23' '24' '26' '27' '28' '29' '30') +known_apis_r22b_arm=('16' '17' '18' '19' '21' '22' '23' '24' '26' '27' '28' '29' '30') +known_apis_r22b_arm64=('21' '22' '23' '24' '26' '27' '28' '29' '30') +known_apis_r22b_x86=('16' '17' '18' '19' '21' '22' '23' '24' '26' '27' '28' '29' '30') +known_apis_r22b_x86_64=('21' '22' '23' '24' '26' '27' '28' '29' '30') +known_apis_r23b=('16' '17' '18' '19' '21' '22' '23' '24' '26' '27' '28' '29' '30') +known_apis_r23b_arm=('16' '17' '18' '19' '21' '22' '23' '24' '26' '27' '28' '29' '30') +known_apis_r23b_arm64=('21' '22' '23' '24' '26' '27' '28' '29' '30') +known_apis_r23b_x86=('16' '17' '18' '19' '21' '22' '23' '24' '26' '27' '28' '29' '30') +known_apis_r23b_x86_64=('21' '22' '23' '24' '26' '27' '28' '29' '30') +# END MATRIX diff --git a/matrix.py b/matrix.py index 9a35650..f8b37cc 100755 --- a/matrix.py +++ b/matrix.py @@ -10,11 +10,12 @@ import argparse # Start of matrix data ======================================================== -# This is what needs to be kept to date +# This is what needs to be kept up to date default_default_flags = dict( # TODO: os='ubuntu-latest', os='ubuntu-22.04', + install_python2=False, use_security=False, use_java=False, use_toolchain=False, @@ -22,6 +23,15 @@ ) +all_archs = dict( + # Before 21, Android was 32-bit only + arm=dict(min_api=16, max_api=99999), + arm64=dict(min_api=21,max_api=99999), + x86=dict(min_api=16,max_api=99999), + x86_64=dict(min_api=21,max_api=99999), +) + + def define_ndks(): # Define NDK versions, their min and max API Levels, and if they have # nicknames. @@ -34,11 +44,12 @@ def define_ndks(): Ndk('r12b', 16, 24) -# API Level 25 was Android Wear-only -skip_apis = set([25]) +# API Level 20 was Android Wear-only and 25 isn't in any NDK +skip_apis = set([20, 25]) def default_arch(api): + # Before 21, Android was 32-bit only return "arm64" if api >= 21 else "arm" @@ -54,7 +65,7 @@ def comprehensive(matrix, ndk, extras=False): ), ) - # DOC Group master branch + # DOC Group master branch --------------------------------------------------- doc_group_master_matrix = Matrix( 'doc_group_master', mark='M', url='https://github.com/DOCGroup/ACE_TAO', @@ -94,7 +105,7 @@ def comprehensive(matrix, ndk, extras=False): # ), # ) - # DOC Group master ace6_tao2 branch + # DOC Group master ace6_tao2 branch ----------------------------------------- doc_group_ace6_tao2_matrix = Matrix( 'doc_group_ace6_tao2', mark='6', url='https://github.com/DOCGroup/ACE_TAO/tree/ace6tao2', @@ -107,6 +118,12 @@ def comprehensive(matrix, ndk, extras=False): use_toolchain=True, ), ) + doc_group_ace6_tao2_matrix.add_ndk('r12b', 'minmax', + default_flags=dict( + use_toolchain=True, + install_python2=True, + ), + ) return [ doc_group_master_matrix, @@ -136,8 +153,10 @@ class Ndk: def __init__(self, name, min_api, max_api, latest_stable=False, latest_lts=False): self.name = name + self.as_tuple = convert_ndk(name) self.min_api = min_api self.max_api = max_api + self.ndk_only = self.as_tuple[0] >= 19 self.latest_stable = latest_stable self.latest_lts = latest_lts self.latest_beta = 'beta' in name @@ -160,6 +179,12 @@ def get(cls, name): def all_apis(self): return list(get_api_range((self.min_api, self.max_api))) + def all_apis_for_arch(self, arch): + arch_info = all_archs[arch] + return list(get_api_range(( + max(self.min_api, arch_info['min_api']), + min(self.max_api, arch_info['max_api'])))) + def apis_by_name(self, name): if name == 'all': return self.all_apis() @@ -176,9 +201,6 @@ def __str__(self): return self.name -define_ndks() - - class Build: '''Represents a single build for a particular Android target with a particular set of options. @@ -227,6 +249,7 @@ def case_format(self, format_str, flag_convert): name=str(self), arch=self.arch, ndk=self.ndk, api=self.api, **format_flags) + class Matrix: '''Represents information about a group of builds. @@ -466,18 +489,36 @@ def default_settings(matrices, file, **kw): print(line, file=file) +def bash_array(l): + return '(' + ' '.join([f"'{e}'" for e in l]) + ')' + + +def known_apis(matrices, file, **kw): + ndks = list(reversed(Ndk.all_ndks.values())) + print('known_archs=' + bash_array(all_archs.keys()), file=file) + print('known_ndks=' + bash_array([ndk.name for ndk in ndks]), file=file) + print('known_ndks_ndk_only=' + bash_array([ndk.name for ndk in ndks if ndk.ndk_only]), file=file) + for ndk in ndks: + apis = bash_array(ndk.all_apis()) + print(f'known_apis_{ndk.name}={apis}', file=file) + for arch in all_archs.keys(): + apis = bash_array(ndk.all_apis_for_arch(arch)) + print(f'known_apis_{ndk.name}_{arch}={apis}', file=file) + + class Kind(Enum): - GhActions = ('.github/workflows/matrix.yml', '# {}', github), - ReadMe = ('README.md', '', readme), + GhActions = ('.github/workflows/matrix.yml', '# {}', github, {}) + ReadMe = ('README.md', '', readme, {}) DefaultSettings = ('default.settings.sh', '# {}', default_settings, { 'pass_before': True, - }), + }) + KnownApis = ('known_apis.sh', '# {}', known_apis, {}) def get_comment(kind, *args, **kw): kind = Kind(kind) sep = kw['sep'] if 'sep' in kw else ' ' - return kind.value[0][1].format(sep.join(args)) + return kind.value[1].format(sep.join(args)) def comment(file, kind, *args, **kw): @@ -491,7 +532,7 @@ def read_file(kind): mode = 0 before = [] after = [] - filename = kind.value[0][0] + filename = kind.value[0] with open(filename) as file: for line in file: if mode == 0: @@ -514,6 +555,9 @@ def __exit__(self, *args): pass +define_ndks() + + matrices = get_matrices() for matrix in matrices: if args.debug: @@ -527,7 +571,8 @@ def __exit__(self, *args): for kind in Kind: opts = { 'pass_before': False, - } if len(kind.value[0]) < 4 else kind.value[0][3] + } + opts.update(kind.value[3]) filename, before, after = read_file(kind) if args.debug: file_context = NullContext() @@ -542,6 +587,6 @@ def __exit__(self, *args): for line in before: print(line, end='', file=file) comment(file, kind, 'This part is generated by matrix.py') - kind.value[0][2](matrices, file, **opts) + kind.value[2](matrices, file, **opts) for line in after: print(line, end='', file=file) diff --git a/setenv.sh b/setenv.sh index 563dccd..e12f148 100644 --- a/setenv.sh +++ b/setenv.sh @@ -10,11 +10,11 @@ download_file() { } # Getting Configuration -if [ -z ${ndk+x} ] +if [ -z "${ndk+x}" -o -z "${arch+x}" -o -z "${api+x}" ] then if ! [ -f ${workspace}/settings.sh ] then - echo "Warning: ndk is not set and there are no settings.sh, copying default.settings.sh" 1>&2 + echo 'Warning: $ndk, $arch, or $api not set and there is no settings.sh, copying default.settings.sh' 1>&2 cp ${workspace}/default.settings.sh ${workspace}/settings.sh fi source ${workspace}/settings.sh @@ -29,6 +29,7 @@ fi # Convert arch to target and abi if [ "$arch" = "arm" ] then + export target_compiler=armv7a-linux-androideabi export target=arm-linux-androideabi export abi="armeabi-v7a" elif [ "$arch" = "arm64" ] @@ -50,6 +51,9 @@ else echo "Error: \"$arch\" is invalid, must be arm, arm64, x86, or x86_64" 1>&2 exit 1 fi +export target_cpp_stdlib=${target_cpp_stdlib:-$target} +export target_ld=${target_ld:-$target} +export target_compiler=${target_compiler:-$target} # Android NDK export ndk_major_rev=$(./matrix.py --get-ndk-major $ndk) @@ -83,17 +87,16 @@ case $host_os in esac export OPENDDS_ANDROID_NDK="${OPENDDS_ANDROID_NDK-"$workspace/android-ndk-$ndk"}" export android_toolchain_root="${OPENDDS_ANDROID_NDK}/toolchains/llvm/prebuilt/$ndk_platform_name" -export android_cpp_stdlib="${android_toolchain_root}/sysroot/usr/lib/${target}/libc++_shared.so" +export android_cpp_stdlib="${android_toolchain_root}/sysroot/usr/lib/${target_cpp_stdlib}/libc++_shared.so" export android_toolchain_bin="${android_toolchain_root}/bin" -export android_toolchain_prefix="${android_toolchain_bin}/${target}" -export android_ld="${android_toolchain_prefix}-ld" +export android_ld="${android_toolchain_bin}/${target_ld}-ld" if [ $ndk_major_rev -ge 22 ] then - # ${target}-ld doesn't exist in r22. GNU linker is still there under + # ${target_ld}-ld doesn't exist in r22. GNU linker is still there under # different names, but we should use LLVM linker. export android_ld="${android_toolchain_bin}/ld.lld" fi -export android_cc="${android_toolchain_prefix}${api}-clang" +export android_cc="${android_toolchain_bin}/${target_compiler}${api}-clang" export android_cxx="${android_cc}++" export use_toolchain=${use_toolchain-"false"} export need_toolchain=$use_toolchain @@ -113,6 +116,10 @@ export ace_tao=${ace_tao-'doc_group_master'} case $ace_tao in 'doc_group_master') export ace_tao_default_branch='master' + if [ $ndk_major_rev -lt 27 ] + then + export force_cpp_std="c++17" + fi ;; 'doc_group_ace6_tao2')