开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (883)
标签 (1072)
master
gh-readonly-queue/master/pr-179670-ee7e28ec979562d0ab722fd24b5e145068ec6b63
gh-readonly-queue/master/pr-179759-cbb7a618809ee9dfb525ca6ea28044e016718ae7
gh-readonly-queue/master/pr-181716-399a692f7db0bd5faba36003d67880776a3767d3
main
test-branch-creation
use-super-tools
use-super-framework
flutter-3.41-candidate.0
stable
beta
flutter-3.42-candidate.0
unawaited-futures-draft
use-super-dev
revert-181685-update_date_localization
flutter-3.38-candidate.0
issue-triage-additional-info
code-assets-install-cache-fix
icon-data-class-modifier
zanderso-patch-3
3.41.2
3.42.0-0.1.pre
3.42.0-0.2.pre
3.41.1
3.38.10
3.42.0-0.0.pre
3.41.0
3.41.0-0.3.pre
3.38.9
3.41.0-0.2.pre
3.38.8
3.41.0-0.1.pre
3.41.0-0.0.pre
3.38.7
3.38.6
3.40.0-0.2.pre
3.38.5
3.40.0-0.1.pre
3.38.4
3.39.0-0.2.pre
master
分支 (883)
标签 (1072)
master
gh-readonly-queue/master/pr-179670-ee7e28ec979562d0ab722fd24b5e145068ec6b63
gh-readonly-queue/master/pr-179759-cbb7a618809ee9dfb525ca6ea28044e016718ae7
gh-readonly-queue/master/pr-181716-399a692f7db0bd5faba36003d67880776a3767d3
main
test-branch-creation
use-super-tools
use-super-framework
flutter-3.41-candidate.0
stable
beta
flutter-3.42-candidate.0
unawaited-futures-draft
use-super-dev
revert-181685-update_date_localization
flutter-3.38-candidate.0
issue-triage-additional-info
code-assets-install-cache-fix
icon-data-class-modifier
zanderso-patch-3
3.41.2
3.42.0-0.1.pre
3.42.0-0.2.pre
3.41.1
3.38.10
3.42.0-0.0.pre
3.41.0
3.41.0-0.3.pre
3.38.9
3.41.0-0.2.pre
3.38.8
3.41.0-0.1.pre
3.41.0-0.0.pre
3.38.7
3.38.6
3.40.0-0.2.pre
3.38.5
3.40.0-0.1.pre
3.38.4
3.39.0-0.2.pre
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (883)
标签 (1072)
master
gh-readonly-queue/master/pr-179670-ee7e28ec979562d0ab722fd24b5e145068ec6b63
gh-readonly-queue/master/pr-179759-cbb7a618809ee9dfb525ca6ea28044e016718ae7
gh-readonly-queue/master/pr-181716-399a692f7db0bd5faba36003d67880776a3767d3
main
test-branch-creation
use-super-tools
use-super-framework
flutter-3.41-candidate.0
stable
beta
flutter-3.42-candidate.0
unawaited-futures-draft
use-super-dev
revert-181685-update_date_localization
flutter-3.38-candidate.0
issue-triage-additional-info
code-assets-install-cache-fix
icon-data-class-modifier
zanderso-patch-3
3.41.2
3.42.0-0.1.pre
3.42.0-0.2.pre
3.41.1
3.38.10
3.42.0-0.0.pre
3.41.0
3.41.0-0.3.pre
3.38.9
3.41.0-0.2.pre
3.38.8
3.41.0-0.1.pre
3.41.0-0.0.pre
3.38.7
3.38.6
3.40.0-0.2.pre
3.38.5
3.40.0-0.1.pre
3.38.4
3.39.0-0.2.pre
flutter
/
bin
/
internal
/
shared.sh
flutter
/
bin
/
internal
/
shared.sh
shared.sh 11.50 KB
一键复制 编辑 原始数据 按行查看 历史
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283
#!/usr/bin/env bash
# Copyright 2014 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# ---------------------------------- NOTE ---------------------------------- #
#
# Please keep the logic in this file consistent with the logic in the
# `shared.bat` script in the same directory to ensure that Flutter & Dart continue
# to work across all platforms!
#
# -------------------------------------------------------------------------- #
set -e
# Needed because if it is set, cd may print the path it changed to.
unset CDPATH
function pub_upgrade_with_retry {
local total_tries="10"
local remaining_tries=$((total_tries - 1))
while [[ "$remaining_tries" -gt 0 ]]; do
(cd "$FLUTTER_TOOLS_DIR" && "$DART" pub upgrade --suppress-analytics >&2) && break
>&2 echo "Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... ($remaining_tries tries left)"
remaining_tries=$((remaining_tries - 1))
sleep 5
done
if [[ "$remaining_tries" == 0 ]]; then
>&2 echo "Command 'pub upgrade' still failed after $total_tries tries, giving up."
return 1
fi
# Touch the pubspec.lock to ensure, even if this was a NOP, it is newer than pubspec.yaml.
# See https://github.com/flutter/flutter/issues/171024.
touch "$FLUTTER_TOOLS_DIR/pubspec.lock" >&2
return 0
}
# Trap function for removing any remaining lock file at exit.
function _rmlock () {
[ -n "$FLUTTER_UPGRADE_LOCK" ] && rm -rf -- "$FLUTTER_UPGRADE_LOCK"
}
# Determines which lock method to use, based on what is available on the system.
# Returns a non-zero value if the lock was not acquired, zero if acquired.
function _lock () {
if hash flock 2>/dev/null; then
flock --nonblock --exclusive 7 2>/dev/null
elif hash shlock 2>/dev/null; then
shlock -f "1ドル" -p $$
else
mkdir "1ドル" 2>/dev/null
fi
}
# Waits for an update lock to be acquired.
#
# To ensure that we don't simultaneously update Dart in multiple parallel
# instances, we try to obtain an exclusive lock on this file descriptor (and
# thus this script's source file) while we are updating Dart and compiling the
# script. To do this, we try to use the command line program "flock", which is
# available on many Unix-like platforms, in particular on most Linux
# distributions. You give it a file descriptor, and it locks the corresponding
# file, having inherited the file descriptor from the shell.
#
# Complicating matters, there are two major scenarios where this will not
# work.
#
# The first is if the platform doesn't have "flock", for example on macOS. There
# is not a direct equivalent, so on platforms that don't have flock, we fall
# back to using trying to use the shlock command, and if that doesn't exist,
# then we use mkdir as an atomic operation to create a lock directory. If mkdir
# is able to create the directory, then the lock is acquired. To determine if we
# have "flock" or "shlock" available, we use the "hash" shell built-in.
#
# The second complication is on network file shares. On NFS, to obtain an
# exclusive lock you need a file descriptor that is open for writing. Thus, we
# ignore errors from flock by redirecting all output to /dev/null, since users
# will typically not care about errors from flock and are more likely to be
# confused by them than helped. The "shlock" method doesn't work for network
# shares, since it is PID-based. The "mkdir" method does work over NFS
# implementations that support atomic directory creation (which is most of
# them). The "schlock" and "flock" commands are more reliable than the mkdir
# method, however, or we would use mkdir in all cases.
#
# The upgrade_flutter function calling _wait_for_lock is executed in a subshell
# with a redirect that pipes the source of this script into file descriptor 7.
# A flock lock is released when this subshell exits and file descriptor 7 is
# closed. The mkdir lock is released via an exit trap from the subshell that
# deletes the lock directory.
function _wait_for_lock () {
FLUTTER_UPGRADE_LOCK="$FLUTTER_ROOT/bin/cache/.upgrade_lock"
local waiting_message_displayed
while ! _lock "$FLUTTER_UPGRADE_LOCK"; do
if [[ -z $waiting_message_displayed ]]; then
# Print with a return so that if the Dart code also prints this message
# when it does its own lock, the message won't appear twice. Be sure that
# the clearing printf below has the same number of space characters.
printf "Waiting for another flutter command to release the startup lock...\r" >&2;
waiting_message_displayed="true"
fi
sleep .1;
done
if [[ $waiting_message_displayed == "true" ]]; then
# Clear the waiting message so it doesn't overlap any following text.
printf " \r" >&2;
fi
unset waiting_message_displayed
# If the lock file is acquired, make sure that it is removed on exit.
trap _rmlock INT TERM EXIT
}
# This function is always run in a subshell. Running the function in a subshell
# is required to make sure any lock directory is cleaned up by the exit trap in
# _wait_for_lock.
function upgrade_flutter () (
mkdir -p "$FLUTTER_ROOT/bin/cache"
# Ensure the engine.version is populated
"$FLUTTER_ROOT/bin/internal/update_engine_version.sh"
local revision="$(git -C "$FLUTTER_ROOT" rev-parse HEAD)"
local compilekey="$revision:$FLUTTER_TOOL_ARGS"
# Invalidate cache if:
# * SNAPSHOT_PATH is not a file, or
# * STAMP_PATH is not a file, or
# * STAMP_PATH is an empty file, or
# * Contents of STAMP_PATH is not what we are going to compile, or
# * pubspec.yaml last modified after pubspec.lock
if [[ ! -f "$SNAPSHOT_PATH" || \
! -s "$STAMP_PATH" || \
"$(< "$STAMP_PATH")" != "$compilekey" || \
"$FLUTTER_TOOLS_DIR/pubspec.yaml" -nt "$FLUTTER_TOOLS_DIR/pubspec.lock" ]]; then
# Waits for the update lock to be acquired. Placing this check inside the
# conditional allows the majority of flutter/dart installations to bypass
# the lock entirely, but as a result this required a second verification that
# the SDK is up to date.
_wait_for_lock
# A different shell process might have updated the tool/SDK.
if [[ -f "$SNAPSHOT_PATH" && -s "$STAMP_PATH" && "$(< "$STAMP_PATH")" == "$compilekey" && "$FLUTTER_TOOLS_DIR/pubspec.yaml" -ot "$FLUTTER_TOOLS_DIR/pubspec.lock" ]]; then
exit $?
fi
# Fetch Dart...
rm -f "$FLUTTER_ROOT/version"
rm -f "$FLUTTER_ROOT/bin/cache/flutter.version.json"
touch "$FLUTTER_ROOT/bin/cache/.dartignore"
"$FLUTTER_ROOT/bin/internal/update_dart_sdk.sh"
if [[ "$BIN_NAME" == 'dart' || "$BIN_NAME" == 'flutter-dev' ]]; then
# Don't try to build tool
return
fi
>&2 echo Building flutter tool...
# Prepare packages...
if [[ "$CI" == "true" || "$BOT" == "true" || "$CONTINUOUS_INTEGRATION" == "true" || "$CHROME_HEADLESS" == "1" ]]; then
PUB_ENVIRONMENT="$PUB_ENVIRONMENT:flutter_bot"
else
export PUB_SUMMARY_ONLY=1
fi
export PUB_ENVIRONMENT="$PUB_ENVIRONMENT:flutter_install"
pub_upgrade_with_retry
# Move the old snapshot - we can't just overwrite it as the VM might currently have it
# memory mapped (e.g. on flutter upgrade). For downloading a new dart sdk the folder is moved,
# so we take the same approach of moving the file here.
SNAPSHOT_PATH_OLD="$SNAPSHOT_PATH.old"
if [ -f "$SNAPSHOT_PATH" ]; then
mv "$SNAPSHOT_PATH" "$SNAPSHOT_PATH_OLD"
fi
# Compile...
"$DART" --verbosity=error $FLUTTER_TOOL_ARGS --snapshot="$SNAPSHOT_PATH" --snapshot-kind="app-jit" --packages="$FLUTTER_TOOLS_DIR/.dart_tool/package_config.json" --no-enable-mirrors "$SCRIPT_PATH" > /dev/null
echo "$compilekey" > "$STAMP_PATH"
# Delete any temporary snapshot path.
if [ -f "$SNAPSHOT_PATH_OLD" ]; then
rm -f "$SNAPSHOT_PATH_OLD"
fi
fi
# The exit here is extraneous since the function is run in a subshell, but
# this serves as documentation that running the function in a subshell is
# required to make sure any lock directory created by mkdir is cleaned up.
exit $?
)
# This function is intended to be executed by entrypoints (e.g. `//bin/flutter`
# and `//bin/dart`). PROG_NAME and BIN_DIR should already be set by those
# entrypoints.
function shared::execute() {
export FLUTTER_ROOT="$(cd "${BIN_DIR}/.." ; pwd -P)"
# If present, run the bootstrap script first
BOOTSTRAP_PATH="$FLUTTER_ROOT/bin/internal/bootstrap.sh"
if [ -f "$BOOTSTRAP_PATH" ]; then
source "$BOOTSTRAP_PATH"
fi
FLUTTER_TOOLS_DIR="$FLUTTER_ROOT/packages/flutter_tools"
SNAPSHOT_PATH="$FLUTTER_ROOT/bin/cache/flutter_tools.snapshot"
STAMP_PATH="$FLUTTER_ROOT/bin/cache/flutter_tools.stamp"
SCRIPT_PATH="$FLUTTER_TOOLS_DIR/bin/flutter_tools.dart"
DART_SDK_PATH="$FLUTTER_ROOT/bin/cache/dart-sdk"
DART="$DART_SDK_PATH/bin/dart"
# If running over git-bash, overrides the default UNIX executables with win32
# executables
case "$(uname -s)" in
MINGW* | MSYS* )
DART="$DART.exe"
;;
esac
# Test if running as superuser – but don't warn if running within Docker or CI.
if [[ "$EUID" == "0" && ! -f /.dockerenv && "$CI" != "true" && "$BOT" != "true" && "$CONTINUOUS_INTEGRATION" != "true" ]]; then
>&2 echo " Woah! You appear to be trying to run flutter as root."
>&2 echo " We strongly recommend running the flutter tool without superuser privileges."
>&2 echo " /"
>&2 echo "📎"
fi
# Test if Git is available on the Host
if ! hash git 2>/dev/null; then
>&2 echo "Error: Unable to find git in your PATH."
exit 1
fi
# Test if the flutter directory is a git clone (otherwise git rev-parse HEAD
# would fail)
if [[ ! -e "$FLUTTER_ROOT/.git" ]]; then
>&2 echo "Error: The Flutter directory is not a clone of the GitHub project."
>&2 echo " The flutter tool requires Git in order to operate properly;"
>&2 echo " to install Flutter, see the instructions at:"
>&2 echo " https://docs.flutter.dev/get-started"
exit 1
fi
BIN_NAME="$(basename "$PROG_NAME")"
# File descriptor 7 is prepared here so that we can use it with
# flock(1) in _lock() (see above).
#
# We use number 7 because it's a luckier number than 3; luck is
# important when making locks work reliably. Also because that way
# if anyone is redirecting other file descriptors there's less
# chance of a conflict.
#
# In any case, the file we redirect into this file descriptor is
# this very source file you are reading right now, because that's
# the only file we can truly guarantee exists, since we're running
# it. We don't use PROG_NAME because otherwise if you run `dart` and
# `flutter` simultaneously they'll end up using different lock files
# and will corrupt each others' downloads.
#
# SHARED_NAME itself is prepared by the caller script.
upgrade_flutter 7< "$SHARED_NAME"
case "$BIN_NAME" in
flutter-dev)
# FLUTTER_TOOL_ARGS aren't quoted below, because it is meant to be
# considered as separate space-separated args.
exec "$DART" run --resident --packages="$FLUTTER_TOOLS_DIR/.dart_tool/package_config.json" $FLUTTER_TOOL_ARGS "$SCRIPT_PATH" "$@"
;;
flutter*)
# FLUTTER_TOOL_ARGS aren't quoted below, because it is meant to be
# considered as separate space-separated args.
exec "$DART" --packages="$FLUTTER_TOOLS_DIR/.dart_tool/package_config.json" $FLUTTER_TOOL_ARGS "$SNAPSHOT_PATH" "$@"
;;
dart*)
exec "$DART" "$@"
;;
*)
>&2 echo "Error! Executable name $BIN_NAME not recognized!"
exit 1
;;
esac
}
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

暂无描述
暂无标签
BSD-3-Clause
使用 BSD-3-Clause 开源许可协议
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ly-code/flutter.git
git@gitee.com:ly-code/flutter.git
ly-code
flutter
flutter
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /