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
78efd3eb
Unverified
Commit
78efd3eb
authored
Jul 29, 2020
by
Jonah Williams
Committed by
GitHub
Jul 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] ensure desktop builds can run without flutter_tools' package_config (#62426)
parent
50828a13
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
+28
-5
tool_backend.dart
packages/flutter_tools/bin/tool_backend.dart
+18
-5
forbidden_imports_test.dart
...tter_tools/test/general.shard/forbidden_imports_test.dart
+10
-0
No files found.
packages/flutter_tools/bin/tool_backend.dart
View file @
78efd3eb
...
...
@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Do not add package imports to this file.
import
'dart:convert'
;
// ignore: dart_convert_import.
import
'dart:io'
;
// ignore: dart_io_import.
import
'package:path/path.dart'
as
path
;
// ignore: package_path_import.
/// Executes the required flutter tasks for a desktop build.
Future
<
void
>
main
(
List
<
String
>
arguments
)
async
{
...
...
@@ -18,7 +18,7 @@ Future<void> main(List<String> arguments) async {
final
String
flutterEngine
=
Platform
.
environment
[
'FLUTTER_ENGINE'
];
final
String
flutterRoot
=
Platform
.
environment
[
'FLUTTER_ROOT'
];
final
String
flutterTarget
=
Platform
.
environment
[
'FLUTTER_TARGET'
]
??
path
.
join
(
'lib'
,
'main.dart'
);
??
path
Join
(<
String
>[
'lib'
,
'main.dart'
]
);
final
String
localEngine
=
Platform
.
environment
[
'LOCAL_ENGINE'
];
final
String
projectDirectory
=
Platform
.
environment
[
'PROJECT_DIR'
];
final
String
splitDebugInfo
=
Platform
.
environment
[
'SPLIT_DEBUG_INFO'
];
...
...
@@ -42,9 +42,14 @@ or
'''
);
exit
(
1
);
}
final
String
flutterExecutable
=
path
.
join
(
flutterRoot
,
'bin'
,
Platform
.
isWindows
?
'flutter.bat'
:
'flutter'
);
final
String
flutterExecutable
=
pathJoin
(<
String
>[
flutterRoot
,
'bin'
,
if
(
Platform
.
isWindows
)
'flutter.bat'
else
'flutter'
]);
final
String
bundlePlatform
=
targetPlatform
==
'windows-x64'
?
'windows'
:
'linux'
;
final
String
target
=
'
${buildMode}
_bundle_
${bundlePlatform}
_assets'
;
...
...
@@ -89,3 +94,11 @@ or
exit
(
1
);
}
}
/// Perform a simple path join on the segments based on the current platform.
///
/// Does not normalize paths that have repeated separators.
String
pathJoin
(
List
<
String
>
segments
)
{
final
String
separator
=
Platform
.
isWindows
?
r'\'
:
'/'
;
return
segments
.
join
(
separator
);
}
packages/flutter_tools/test/general.shard/forbidden_imports_test.dart
View file @
78efd3eb
...
...
@@ -210,6 +210,16 @@ void main() {
}
}
});
test
(
'no import of packages in tool_backend.dart'
,
()
{
final
File
file
=
globals
.
fs
.
file
(
globals
.
fs
.
path
.
join
(
flutterTools
,
'bin'
,
'tool_backend.dart'
));
for
(
final
String
line
in
file
.
readAsLinesSync
())
{
if
(
line
.
startsWith
(
RegExp
(
r'import.*package:.*'
)))
{
final
String
relativePath
=
globals
.
fs
.
path
.
relative
(
file
.
path
,
from:
flutterTools
);
fail
(
'
$relativePath
imports a package'
);
}
}
});
}
bool
_isDartFile
(
FileSystemEntity
entity
)
=>
entity
is
File
&&
entity
.
path
.
endsWith
(
'.dart'
);
...
...
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