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
db930ba3
Unverified
Commit
db930ba3
authored
Jun 15, 2021
by
Jenn Magder
Committed by
GitHub
Jun 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate build_macos and web_test_compiler to null safety (#84469)
parent
ef2879a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
33 deletions
+25
-33
build_macos.dart
packages/flutter_tools/lib/src/macos/build_macos.dart
+10
-14
web_test_compiler.dart
packages/flutter_tools/lib/src/test/web_test_compiler.dart
+15
-19
No files found.
packages/flutter_tools/lib/src/macos/build_macos.dart
View file @
db930ba3
...
...
@@ -2,10 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:meta/meta.dart'
;
import
'../base/analyze_size.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
...
...
@@ -27,11 +23,11 @@ final RegExp _anyOutput = RegExp('.*');
/// Builds the macOS project through xcodebuild.
// TODO(jonahwilliams): refactor to share code with the existing iOS code.
Future
<
void
>
buildMacOS
({
FlutterProject
flutterProject
,
BuildInfo
buildInfo
,
String
targetOverride
,
@
required
bool
verboseLogging
,
SizeAnalyzer
sizeAnalyzer
,
required
FlutterProject
flutterProject
,
required
BuildInfo
buildInfo
,
String
?
targetOverride
,
required
bool
verboseLogging
,
SizeAnalyzer
?
sizeAnalyzer
,
})
async
{
if
(!
flutterProject
.
macos
.
xcodeWorkspace
.
existsSync
())
{
throwToolExit
(
'No macOS desktop project configured. '
...
...
@@ -77,16 +73,16 @@ Future<void> buildMacOS({
// If the standard project exists, specify it to getInfo to handle the case where there are
// other Xcode projects in the macos/ directory. Otherwise pass no name, which will work
// regardless of the project name so long as there is exactly one project.
final
String
xcodeProjectName
=
xcodeProject
.
existsSync
()
?
xcodeProject
.
basename
:
null
;
final
XcodeProjectInfo
projectInfo
=
await
globals
.
xcodeProjectInterpreter
.
getInfo
(
final
String
?
xcodeProjectName
=
xcodeProject
.
existsSync
()
?
xcodeProject
.
basename
:
null
;
final
XcodeProjectInfo
projectInfo
=
await
globals
.
xcodeProjectInterpreter
!
.
getInfo
(
xcodeProject
.
parent
.
path
,
projectFilename:
xcodeProjectName
,
);
final
String
scheme
=
projectInfo
.
schemeFor
(
buildInfo
);
final
String
?
scheme
=
projectInfo
.
schemeFor
(
buildInfo
);
if
(
scheme
==
null
)
{
projectInfo
.
reportFlavorNotFoundAndExit
();
}
final
String
configuration
=
projectInfo
.
buildConfigurationFor
(
buildInfo
,
scheme
);
final
String
?
configuration
=
projectInfo
.
buildConfigurationFor
(
buildInfo
,
scheme
);
if
(
configuration
==
null
)
{
throwToolExit
(
'Unable to find expected configuration in Xcode project.'
);
}
...
...
@@ -141,7 +137,7 @@ Future<void> buildMacOS({
.
firstWhere
((
Directory
directory
)
{
return
globals
.
fs
.
path
.
extension
(
directory
.
path
)
==
'.app'
;
});
final
Map
<
String
,
Object
>
output
=
await
sizeAnalyzer
.
analyzeAotSnapshot
(
final
Map
<
String
,
Object
?
>
output
=
await
sizeAnalyzer
.
analyzeAotSnapshot
(
aotSnapshot:
aotSnapshot
,
precompilerTrace:
precompilerTrace
,
outputDirectory:
appDirectory
,
...
...
packages/flutter_tools/lib/src/test/web_test_compiler.dart
View file @
db930ba3
...
...
@@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:meta/meta.dart'
;
import
'package:package_config/package_config.dart'
;
import
'package:process/process.dart'
;
...
...
@@ -26,12 +23,12 @@ import 'test_config.dart';
/// A web compiler for the test runner.
class
WebTestCompiler
{
WebTestCompiler
({
@
required
FileSystem
fileSystem
,
@
required
Logger
logger
,
@
required
Artifacts
artifacts
,
@
required
Platform
platform
,
@
required
ProcessManager
processManager
,
@
required
Config
config
,
required
FileSystem
fileSystem
,
required
Logger
logger
,
required
Artifacts
artifacts
,
required
Platform
platform
,
required
ProcessManager
processManager
,
required
Config
config
,
})
:
_logger
=
logger
,
_fileSystem
=
fileSystem
,
_artifacts
=
artifacts
,
...
...
@@ -47,24 +44,23 @@ class WebTestCompiler {
final
Config
_config
;
Future
<
WebMemoryFS
>
initialize
({
@
required
Directory
projectDirectory
,
@
required
String
testOutputDir
,
@
required
List
<
String
>
testFiles
,
@
required
BuildInfo
buildInfo
,
required
Directory
projectDirectory
,
required
String
testOutputDir
,
required
List
<
String
>
testFiles
,
required
BuildInfo
buildInfo
,
})
async
{
LanguageVersion
languageVersion
=
LanguageVersion
(
2
,
8
);
HostArtifact
platformDillArtifact
;
HostArtifact
platformDillArtifact
=
HostArtifact
.
webPlatformSoundKernelDill
;
// TODO(jonahwilliams): to support autodetect this would need to partition the source code into a
// a sound and unsound set and perform separate compilations.
final
List
<
String
>
extraFrontEndOptions
=
List
<
String
>.
of
(
buildInfo
.
extraFrontEndOptions
??
<
String
>[]
);
final
List
<
String
>
extraFrontEndOptions
=
List
<
String
>.
of
(
buildInfo
.
extraFrontEndOptions
);
if
(
buildInfo
.
nullSafetyMode
==
NullSafetyMode
.
unsound
||
buildInfo
.
nullSafetyMode
==
NullSafetyMode
.
autodetect
)
{
platformDillArtifact
=
HostArtifact
.
webPlatformKernelDill
;
if
(!
extraFrontEndOptions
.
contains
(
'--no-sound-null-safety'
))
{
extraFrontEndOptions
.
add
(
'--no-sound-null-safety'
);
}
}
else
if
(
buildInfo
.
nullSafetyMode
==
NullSafetyMode
.
sound
)
{
platformDillArtifact
=
HostArtifact
.
webPlatformSoundKernelDill
;
languageVersion
=
currentLanguageVersion
(
_fileSystem
,
Cache
.
flutterRoot
);
languageVersion
=
currentLanguageVersion
(
_fileSystem
,
Cache
.
flutterRoot
!);
if
(!
extraFrontEndOptions
.
contains
(
'--sound-null-safety'
))
{
extraFrontEndOptions
.
add
(
'--sound-null-safety'
);
}
...
...
@@ -133,7 +129,7 @@ class WebTestCompiler {
fileSystem:
_fileSystem
,
);
final
CompilerOutput
output
=
await
residentCompiler
.
recompile
(
final
CompilerOutput
?
output
=
await
residentCompiler
.
recompile
(
Uri
.
parse
(
'org-dartlang-app:///main.dart'
),
<
Uri
>[],
outputPath:
outputDirectory
.
childFile
(
'out'
).
path
,
...
...
@@ -141,7 +137,7 @@ class WebTestCompiler {
fs:
_fileSystem
,
projectRootPath:
projectDirectory
.
absolute
.
path
,
);
if
(
output
.
errorCount
>
0
)
{
if
(
output
==
null
||
output
.
errorCount
>
0
)
{
throwToolExit
(
'Failed to compile'
);
}
// Cache the output kernel file to speed up subsequent compiles.
...
...
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