fix invalid format in Prepare Flutter SDKs
Build RustDesk Android / Build RustDesk Android ARM64 (push) Failing after 36s
Build RustDesk Android / Build RustDesk Android ARM64 (push) Failing after 36s
This commit is contained in:
1 file changed
+85
-7
@@ -338,16 +338,48 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
|
||||||
|
# GNU tar inside this runner/container cannot always restore the
|
||||||
|
# UID/GID stored in Flutter archives. Flutter uses the system tar
|
||||||
|
# while filling its cache, so force extraction as the current user.
|
||||||
|
export TAR_OPTIONS="--no-same-owner"
|
||||||
|
|
||||||
flutter_version() {
|
flutter_version() {
|
||||||
local root="$1"
|
local root="$1"
|
||||||
|
local version=""
|
||||||
|
|
||||||
if [ ! -x "${root}/bin/flutter" ]; then
|
if [ ! -x "${root}/bin/flutter" ]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"${root}/bin/flutter" --version 2>/dev/null |
|
# The prebuilt SDK directories can be owned by another UID.
|
||||||
head -n 1 |
|
# Mark them safe before asking Git for the checked-out tag.
|
||||||
awk '{print $2}'
|
git config --global \
|
||||||
|
--add safe.directory "${root}" \
|
||||||
|
>/dev/null 2>&1 \
|
||||||
|
|| true
|
||||||
|
|
||||||
|
# Prefer Git metadata: it is quiet and does not bootstrap/download
|
||||||
|
# Flutter artifacts just to discover the SDK version.
|
||||||
|
version="$(
|
||||||
|
git \
|
||||||
|
-C "${root}" \
|
||||||
|
describe \
|
||||||
|
--tags \
|
||||||
|
--exact-match \
|
||||||
|
HEAD \
|
||||||
|
2>/dev/null \
|
||||||
|
|| true
|
||||||
|
)"
|
||||||
|
|
||||||
|
if [ -n "${version}" ]; then
|
||||||
|
printf '%s\n' "${version}"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fallback for an SDK without usable Git metadata.
|
||||||
|
"${root}/bin/flutter" --version 2>&1 |
|
||||||
|
sed -n 's/^Flutter \([^ ]*\).*/\1/p' |
|
||||||
|
head -n 1
|
||||||
}
|
}
|
||||||
|
|
||||||
ensure_flutter() {
|
ensure_flutter() {
|
||||||
@@ -361,10 +393,17 @@ jobs:
|
|||||||
[ "$(flutter_version "${preferred}" || true)" = "${version}" ]
|
[ "$(flutter_version "${preferred}" || true)" = "${version}" ]
|
||||||
); then
|
); then
|
||||||
root="${preferred}"
|
root="${preferred}"
|
||||||
|
echo \
|
||||||
|
"Using preinstalled ${role} Flutter ${version}: ${root}" \
|
||||||
|
>&2
|
||||||
else
|
else
|
||||||
root="${HOME}/.cache/rustdesk/flutter-${version}"
|
root="${HOME}/.cache/rustdesk/flutter-${version}"
|
||||||
|
|
||||||
if [ "$(flutter_version "${root}" || true)" != "${version}" ]; then
|
if [ "$(flutter_version "${root}" || true)" != "${version}" ]; then
|
||||||
|
echo \
|
||||||
|
"Installing ${role} Flutter ${version}: ${root}" \
|
||||||
|
>&2
|
||||||
|
|
||||||
rm -rf "${root}"
|
rm -rf "${root}"
|
||||||
mkdir -p "$(dirname "${root}")"
|
mkdir -p "$(dirname "${root}")"
|
||||||
|
|
||||||
@@ -372,18 +411,39 @@ jobs:
|
|||||||
--branch "${version}" \
|
--branch "${version}" \
|
||||||
--depth 1 \
|
--depth 1 \
|
||||||
https://github.com/flutter/flutter.git \
|
https://github.com/flutter/flutter.git \
|
||||||
"${root}"
|
"${root}" \
|
||||||
|
>&2
|
||||||
|
else
|
||||||
|
echo \
|
||||||
|
"Using cached ${role} Flutter ${version}: ${root}" \
|
||||||
|
>&2
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git config --global \
|
git config --global \
|
||||||
--add safe.directory "${root}" \
|
--add safe.directory "${root}" \
|
||||||
|
>/dev/null 2>&1 \
|
||||||
|| true
|
|| true
|
||||||
|
|
||||||
"${root}/bin/flutter" config --no-analytics
|
# IMPORTANT: ensure_flutter is used inside $(...).
|
||||||
"${root}/bin/flutter" precache --android
|
# Everything except the final path MUST go to stderr, otherwise
|
||||||
|
# command output becomes part of *_FLUTTER_ROOT.
|
||||||
|
"${root}/bin/flutter" \
|
||||||
|
config \
|
||||||
|
--no-analytics \
|
||||||
|
>&2
|
||||||
|
|
||||||
printf '%s' "${root}"
|
# Bridge generation only needs the Flutter/Dart toolchain and pub.
|
||||||
|
# Download Android engine/Gradle artifacts only for the SDK that
|
||||||
|
# actually builds the APK.
|
||||||
|
if [ "${role}" = "android" ]; then
|
||||||
|
"${root}/bin/flutter" \
|
||||||
|
precache \
|
||||||
|
--android \
|
||||||
|
>&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '%s\n' "${root}"
|
||||||
}
|
}
|
||||||
|
|
||||||
BRIDGE_FLUTTER_ROOT="$(
|
BRIDGE_FLUTTER_ROOT="$(
|
||||||
@@ -400,12 +460,30 @@ jobs:
|
|||||||
android
|
android
|
||||||
)"
|
)"
|
||||||
|
|
||||||
|
# Guard against accidental stdout pollution.
|
||||||
|
if [ ! -x "${BRIDGE_FLUTTER_ROOT}/bin/flutter" ]; then
|
||||||
|
echo \
|
||||||
|
"ERROR: Invalid BRIDGE_FLUTTER_ROOT: ${BRIDGE_FLUTTER_ROOT}" \
|
||||||
|
>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -x "${ANDROID_FLUTTER_ROOT}/bin/flutter" ]; then
|
||||||
|
echo \
|
||||||
|
"ERROR: Invalid ANDROID_FLUTTER_ROOT: ${ANDROID_FLUTTER_ROOT}" \
|
||||||
|
>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "BRIDGE_FLUTTER_ROOT=${BRIDGE_FLUTTER_ROOT}" \
|
echo "BRIDGE_FLUTTER_ROOT=${BRIDGE_FLUTTER_ROOT}" \
|
||||||
>> "${GITHUB_ENV}"
|
>> "${GITHUB_ENV}"
|
||||||
|
|
||||||
echo "ANDROID_FLUTTER_ROOT=${ANDROID_FLUTTER_ROOT}" \
|
echo "ANDROID_FLUTTER_ROOT=${ANDROID_FLUTTER_ROOT}" \
|
||||||
>> "${GITHUB_ENV}"
|
>> "${GITHUB_ENV}"
|
||||||
|
|
||||||
|
echo "TAR_OPTIONS=${TAR_OPTIONS}" \
|
||||||
|
>> "${GITHUB_ENV}"
|
||||||
|
|
||||||
echo "Bridge Flutter:"
|
echo "Bridge Flutter:"
|
||||||
"${BRIDGE_FLUTTER_ROOT}/bin/flutter" --version
|
"${BRIDGE_FLUTTER_ROOT}/bin/flutter" --version
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user