Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
b0bc023f
Unverified
Commit
b0bc023f
authored
Nov 03, 2023
by
Christopher Fujino
Committed by
GitHub
Nov 03, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] do not try to build tool from dart.sh (#129186)
Fixes
https://github.com/flutter/flutter/issues/121894
parent
1c8c5336
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
2 deletions
+71
-2
shared.bat
bin/internal/shared.bat
+1
-0
shared.sh
bin/internal/shared.sh
+7
-2
bash_entrypoint_test.dart
...er_tools/test/integration.shard/bash_entrypoint_test.dart
+63
-0
No files found.
bin/internal/shared.bat
View file @
b0bc023f
...
@@ -130,6 +130,7 @@ GOTO :after_subroutine
...
@@ -130,6 +130,7 @@ GOTO :after_subroutine
IF EXIST "%FLUTTER_ROOT%\version" DEL "%FLUTTER_ROOT%\version"
IF EXIST "%FLUTTER_ROOT%\version" DEL "%FLUTTER_ROOT%\version"
IF EXIST "%FLUTTER_ROOT%\bin\cache\flutter.version.json" DEL "%FLUTTER_ROOT%\bin\cache\flutter.version.json"
IF EXIST "%FLUTTER_ROOT%\bin\cache\flutter.version.json" DEL "%FLUTTER_ROOT%\bin\cache\flutter.version.json"
ECHO: > "%cache_dir%\.dartignore"
ECHO: > "%cache_dir%\.dartignore"
ECHO Building flutter tool... 1>&2
ECHO Building flutter tool... 1>&2
PUSHD "%flutter_tools_dir%"
PUSHD "%flutter_tools_dir%"
...
...
bin/internal/shared.sh
View file @
b0bc023f
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
# Use of this source code is governed by a BSD-style license that can be
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# found in the LICENSE file.
# ---------------------------------- NOTE ---------------------------------- #
# ---------------------------------- NOTE ---------------------------------- #
#
#
# Please keep the logic in this file consistent with the logic in the
# Please keep the logic in this file consistent with the logic in the
...
@@ -144,6 +143,11 @@ function upgrade_flutter () (
...
@@ -144,6 +143,11 @@ function upgrade_flutter () (
touch
"
$FLUTTER_ROOT
/bin/cache/.dartignore"
touch
"
$FLUTTER_ROOT
/bin/cache/.dartignore"
"
$FLUTTER_ROOT
/bin/internal/update_dart_sdk.sh"
"
$FLUTTER_ROOT
/bin/internal/update_dart_sdk.sh"
if
[[
"
$BIN_NAME
"
==
'dart'
]]
;
then
# Don't try to build tool
return
fi
>
&2
echo
Building flutter tool...
>
&2
echo
Building flutter tool...
# Prepare packages...
# Prepare packages...
...
@@ -229,6 +233,8 @@ function shared::execute() {
...
@@ -229,6 +233,8 @@ function shared::execute() {
exit
1
exit
1
fi
fi
BIN_NAME
=
"
$(
basename
"
$PROG_NAME
"
)
"
# File descriptor 7 is prepared here so that we can use it with
# File descriptor 7 is prepared here so that we can use it with
# flock(1) in _lock() (see above).
# flock(1) in _lock() (see above).
#
#
...
@@ -247,7 +253,6 @@ function shared::execute() {
...
@@ -247,7 +253,6 @@ function shared::execute() {
# SHARED_NAME itself is prepared by the caller script.
# SHARED_NAME itself is prepared by the caller script.
upgrade_flutter 7<
"
$SHARED_NAME
"
upgrade_flutter 7<
"
$SHARED_NAME
"
BIN_NAME
=
"
$(
basename
"
$PROG_NAME
"
)
"
case
"
$BIN_NAME
"
in
case
"
$BIN_NAME
"
in
flutter
*
)
flutter
*
)
# FLUTTER_TOOL_ARGS aren't quoted below, because it is meant to be
# FLUTTER_TOOL_ARGS aren't quoted below, because it is meant to be
...
...
packages/flutter_tools/test/integration.shard/bash_entrypoint_test.dart
View file @
b0bc023f
...
@@ -48,6 +48,64 @@ Future<void> main() async {
...
@@ -48,6 +48,64 @@ Future<void> main() async {
expect
(
stdout
,
contains
(
'Successfully received SIGTERM!'
));
expect
(
stdout
,
contains
(
'Successfully received SIGTERM!'
));
},
},
skip:
platform
.
isWindows
);
// [intended] Windows does not use the bash entrypoint
skip:
platform
.
isWindows
);
// [intended] Windows does not use the bash entrypoint
test
(
'shared.sh does not compile flutter tool if PROG_NAME=dart'
,
()
async
{
final
Directory
tempDir
=
fileSystem
.
systemTempDirectory
.
createTempSync
(
'bash_entrypoint_test'
);
try
{
// bash script checks it is in a git repo
ProcessResult
result
=
await
processManager
.
run
(<
String
>[
'git'
,
'init'
],
workingDirectory:
tempDir
.
path
);
expect
(
result
,
const
ProcessResultMatcher
());
result
=
await
processManager
.
run
(<
String
>[
'git'
,
'commit'
,
'--allow-empty'
,
'-m'
,
'init commit'
],
workingDirectory:
tempDir
.
path
);
expect
(
result
,
const
ProcessResultMatcher
());
// copy dart and shared.sh to temp dir
final
File
trueSharedSh
=
flutterRoot
.
childDirectory
(
'bin'
).
childDirectory
(
'internal'
).
childFile
(
'shared.sh'
);
final
File
fakeSharedSh
=
(
tempDir
.
childDirectory
(
'bin'
).
childDirectory
(
'internal'
)
..
createSync
(
recursive:
true
))
.
childFile
(
'shared.sh'
);
trueSharedSh
.
copySync
(
fakeSharedSh
.
path
);
final
File
fakeDartBash
=
tempDir
.
childDirectory
(
'bin'
).
childFile
(
'dart'
);
dartBash
.
copySync
(
fakeDartBash
.
path
);
// mark dart executable
makeExecutable
(
fakeDartBash
);
// create no-op fake update_dart_sdk.sh script
final
File
updateDartSdk
=
tempDir
.
childDirectory
(
'bin'
).
childDirectory
(
'internal'
).
childFile
(
'update_dart_sdk.sh'
)..
writeAsStringSync
(
'''
#!/usr/bin/env bash
echo downloaded dart sdk
'''
);
makeExecutable
(
updateDartSdk
);
// create a fake dart runtime
final
File
dartBin
=
(
tempDir
.
childDirectory
(
'bin'
)
.
childDirectory
(
'cache'
)
.
childDirectory
(
'dart-sdk'
)
.
childDirectory
(
'bin'
)
..
createSync
(
recursive:
true
))
.
childFile
(
'dart'
);
dartBin
.
writeAsStringSync
(
'''
#!/usr/bin/env bash
echo executed dart binary
'''
);
makeExecutable
(
dartBin
);
result
=
await
processManager
.
run
(<
String
>[
fakeDartBash
.
path
]);
expect
(
result
,
const
ProcessResultMatcher
());
expect
(
(
result
.
stdout
as
String
).
split
(
'
\n
'
),
// verify we ran updateDartSdk and dartBin
containsAll
(<
String
>[
'downloaded dart sdk'
,
'executed dart binary'
]),
);
// Verify we did not try to compile the flutter_tool
expect
(
result
.
stderr
,
isNot
(
contains
(
'Building flutter tool...'
)));
}
finally
{
tryToDelete
(
tempDir
);
}
},
skip:
platform
.
isWindows
);
// [intended] Windows does not use the bash entrypoint
}
}
// A test Dart app that will run until it receives SIGTERM
// A test Dart app that will run until it receives SIGTERM
...
@@ -69,3 +127,8 @@ File get dartBash {
...
@@ -69,3 +127,8 @@ File get dartBash {
.
childFile
(
'dart'
)
.
childFile
(
'dart'
)
.
absolute
;
.
absolute
;
}
}
void
makeExecutable
(
File
file
)
{
final
ProcessResult
result
=
processManager
.
runSync
(<
String
>[
'chmod'
,
'+x'
,
file
.
path
]);
expect
(
result
,
const
ProcessResultMatcher
());
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment