From 23bd9aa4f8f6fc39516a070fbb615303c5c6c2ad Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 11 May 2024 20:02:50 -0700 Subject: [PATCH] wip --- .github/actions/android-ndk/action.yml | 57 +++++++++++++++----------- .github/workflows/main.yml | 2 +- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/.github/actions/android-ndk/action.yml b/.github/actions/android-ndk/action.yml index 7312e0bc0fa2..bb0d401471e8 100644 --- a/.github/actions/android-ndk/action.yml +++ b/.github/actions/android-ndk/action.yml @@ -2,33 +2,44 @@ name: 'Install Android SDK' description: 'Install the android SDK' inputs: - cargo-ndk: - description: 'Version of Cargo NDK to install' - required: false - default: '3.5.4' - android-target: + target: description: 'Android target to activate' required: true + android-platform: + description: 'SOMETHING' + required: false + default: '26' runs: using: composite steps: - - run: find $ANDROID_NDK - shell: bash - - name: Set Up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - name: Setup Android SDK - uses: android-actions/setup-android@v3 - - uses: actions/cache@v4 - with: - path: ${{ runner.tool_cache }}/cargo-ndk - key: cargo-ndk-bin-${{ inputs.cargo-ndk }} - - run: echo "${{ runner.tool_cache }}/cargo-ndk/bin" >> $GITHUB_PATH - shell: bash - - run: cargo install --root ${{ runner.tool_cache }}/cargo-ndk --version ${{ inputs.cargo-ndk }} cargo-ndk --locked - shell: bash - - run: cargo ndk-env -t ${{ inputs.android-target }} --json | jq -r 'to_entries[] | [.key, .value] | @tsv' | sed 's/\t/=/' | grep -v LINKER >> $GITHUB_ENV + # - run: find $ANDROID_NDK + # shell: bash + - run: | + rust=${{ inputs.target }} + which=$ANDROID_NDK/ndk-which + upcase=$(echo $rust | awk '{ print toupper($0) }' | sed 's/-/_/g') + ndk_bin=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin + linker=$ndk_bin/${rust}${{ inputs.android-platform }}-clang + echo CARGO_TARGET_${upcase}_LINKER=$linker >> $GITHUB_ENV + echo CC_${rust}=$linker >> $GITHUB_ENV + echo RANLIB_${rust}=$ndk_bin/llvm-ranlib >> $GITHUB_ENV + echo AR_${rust}=$ndk_bin/llvm-ar >> $GITHUB_ENV shell: bash + # - name: Set Up JDK 17 + # uses: actions/setup-java@v4 + # with: + # java-version: '17' + # distribution: 'temurin' + # - name: Setup Android SDK + # uses: android-actions/setup-android@v3 + # - uses: actions/cache@v4 + # with: + # path: ${{ runner.tool_cache }}/cargo-ndk + # key: cargo-ndk-bin-${{ inputs.cargo-ndk }} + # - run: echo "${{ runner.tool_cache }}/cargo-ndk/bin" >> $GITHUB_PATH + # shell: bash + # - run: cargo install --root ${{ runner.tool_cache }}/cargo-ndk --version ${{ inputs.cargo-ndk }} cargo-ndk --locked + # shell: bash + # - run: cargo ndk-env -t ${{ inputs.android-target }} --json | jq -r 'to_entries[] | [.key, .value] | @tsv' | sed 's/\t/=/' | grep -v LINKER >> $GITHUB_ENV + # shell: bash diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 54e4f05a0774..18f99075fdff 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -900,7 +900,7 @@ jobs: - uses: ./.github/actions/android-ndk if: matrix.android-target != '' with: - android-target: ${{ matrix.android-target }} + target: ${{ matrix.target }} - run: $CENTOS ./ci/build-release-artifacts.sh "${{ matrix.build }}" "${{ matrix.target }}"