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
44b22c7b
Unverified
Commit
44b22c7b
authored
Mar 26, 2019
by
Jonah Williams
Committed by
GitHub
Mar 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix cache location, artifacts, and re-enable dart2js test (#29783)
parent
7cf4a6df
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
24 deletions
+54
-24
test.dart
dev/bots/test.dart
+11
-12
artifacts.dart
packages/flutter_tools/lib/src/artifacts.dart
+18
-2
cache.dart
packages/flutter_tools/lib/src/cache.dart
+15
-2
build_web.dart
packages/flutter_tools/lib/src/commands/build_web.dart
+6
-2
compile.dart
packages/flutter_tools/lib/src/web/compile.dart
+2
-3
compile_test.dart
packages/flutter_tools/test/web/compile_test.dart
+2
-3
No files found.
dev/bots/test.dart
View file @
44b22c7b
...
...
@@ -213,22 +213,21 @@ Future<void> _runBuildTests() async {
await
_flutterBuildApk
(
path
);
await
_flutterBuildIpa
(
path
);
}
// TODO(jonahwilliams): re-enable when engine rolls.
//await _flutterBuildDart2js(path.join('dev', 'integration_tests', 'web'));
await
_flutterBuildDart2js
(
path
.
join
(
'dev'
,
'integration_tests'
,
'web'
));
print
(
'
${bold}
DONE: All build tests successful.
$reset
'
);
}
//
Future<void> _flutterBuildDart2js(String relativePathToApplication) async {
//
print('Running Dart2JS build tests...');
//
await runCommand(flutter,
//
<String>['build', 'web', '-v'],
//
workingDirectory: path.join(flutterRoot, relativePathToApplication),
//
expectNonZeroExit: false,
//
timeout: _kShortTimeout,
//
);
//
print('Done.');
//
}
Future
<
void
>
_flutterBuildDart2js
(
String
relativePathToApplication
)
async
{
print
(
'Running Dart2JS build tests...'
);
await
runCommand
(
flutter
,
<
String
>[
'build'
,
'web'
,
'-v'
],
workingDirectory:
path
.
join
(
flutterRoot
,
relativePathToApplication
),
expectNonZeroExit:
false
,
timeout:
_kShortTimeout
,
);
print
(
'Done.'
);
}
Future
<
void
>
_flutterBuildAot
(
String
relativePathToApplication
)
async
{
print
(
'Running AOT build tests...'
);
...
...
packages/flutter_tools/lib/src/artifacts.dart
View file @
44b22c7b
...
...
@@ -28,6 +28,7 @@ enum Artifact {
engineDartBinary
,
dart2jsSnapshot
,
kernelWorkerSnapshot
,
flutterWebSdk
,
}
String
_artifactToFileName
(
Artifact
artifact
,
[
TargetPlatform
platform
,
BuildMode
mode
])
{
...
...
@@ -66,6 +67,9 @@ String _artifactToFileName(Artifact artifact, [ TargetPlatform platform, BuildMo
case
Artifact
.
flutterPatchedSdkPath
:
assert
(
false
,
'No filename for sdk path, should not be invoked'
);
return
null
;
case
Artifact
.
flutterWebSdk
:
assert
(
false
,
'No filename for web sdk path, should not be invoked'
);
return
null
;
case
Artifact
.
engineDartSdkPath
:
return
'dart-sdk'
;
case
Artifact
.
frontendServerSnapshotForEngineDartSdk
:
...
...
@@ -73,9 +77,9 @@ String _artifactToFileName(Artifact artifact, [ TargetPlatform platform, BuildMo
case
Artifact
.
engineDartBinary
:
return
'dart'
;
case
Artifact
.
dart2jsSnapshot
:
return
'
flutter_
dart2js.dart.snapshot'
;
return
'dart2js.dart.snapshot'
;
case
Artifact
.
kernelWorkerSnapshot
:
return
'
flutter_
kernel_worker.dart.snapshot'
;
return
'kernel_worker.dart.snapshot'
;
}
assert
(
false
,
'Invalid artifact
$artifact
.'
);
return
null
;
...
...
@@ -174,6 +178,10 @@ class CachedArtifacts extends Artifacts {
return
fs
.
path
.
join
(
engineArtifactsPath
,
'common'
,
'flutter_patched_sdk'
);
}
String
_getFlutterWebSdkPath
()
{
return
cache
.
getWebSdkDirectory
().
path
;
}
String
_getHostArtifactPath
(
Artifact
artifact
,
TargetPlatform
platform
,
BuildMode
mode
)
{
switch
(
artifact
)
{
case
Artifact
.
genSnapshot
:
...
...
@@ -197,6 +205,8 @@ class CachedArtifacts extends Artifacts {
return
fs
.
path
.
join
(
_getFlutterPatchedSdkPath
(),
'lib'
,
_artifactToFileName
(
artifact
));
case
Artifact
.
flutterPatchedSdkPath
:
return
_getFlutterPatchedSdkPath
();
case
Artifact
.
flutterWebSdk
:
return
_getFlutterWebSdkPath
();
case
Artifact
.
dart2jsSnapshot
:
return
fs
.
path
.
join
(
dartSdkPath
,
'bin'
,
'snapshots'
,
_artifactToFileName
(
artifact
));
case
Artifact
.
kernelWorkerSnapshot
:
...
...
@@ -271,6 +281,8 @@ class LocalEngineArtifacts extends Artifacts {
return
fs
.
path
.
join
(
engineOutPath
,
_artifactToFileName
(
artifact
));
case
Artifact
.
flutterPatchedSdkPath
:
return
_getFlutterPatchedSdkPath
();
case
Artifact
.
flutterWebSdk
:
return
_getFlutterWebSdkPath
();
case
Artifact
.
frontendServerSnapshotForEngineDartSdk
:
return
fs
.
path
.
join
(
_hostEngineOutPath
,
'gen'
,
_artifactToFileName
(
artifact
));
case
Artifact
.
engineDartSdkPath
:
...
...
@@ -295,6 +307,10 @@ class LocalEngineArtifacts extends Artifacts {
return
fs
.
path
.
join
(
engineOutPath
,
'flutter_patched_sdk'
);
}
String
_getFlutterWebSdkPath
()
{
return
fs
.
path
.
join
(
engineOutPath
,
'flutter_web_sdk'
);
}
String
_genSnapshotPath
()
{
const
List
<
String
>
clangDirs
=
<
String
>[
'.'
,
'clang_x86'
,
'clang_x64'
,
'clang_i386'
];
final
String
genSnapshotName
=
_artifactToFileName
(
Artifact
.
genSnapshot
);
...
...
packages/flutter_tools/lib/src/cache.dart
View file @
44b22c7b
...
...
@@ -378,7 +378,7 @@ class FlutterWebSdk extends CachedArtifact {
String
get
version
=>
cache
.
getVersionFor
(
'engine'
);
@override
Future
<
void
>
updateInner
()
{
Future
<
void
>
updateInner
()
async
{
String
platformName
=
'flutter-web-sdk-'
;
if
(
platform
.
isMacOS
)
{
platformName
+=
'darwin-x64'
;
...
...
@@ -388,7 +388,20 @@ class FlutterWebSdk extends CachedArtifact {
platformName
+=
'windows-x64'
;
}
final
Uri
url
=
Uri
.
parse
(
'
$_storageBaseUrl
/flutter_infra/flutter/
$version
/
$platformName
.zip'
);
return
_downloadZipArchive
(
'Downloading Web SDK...'
,
url
,
location
);
await
_downloadZipArchive
(
'Downloading Web SDK...'
,
url
,
location
);
// This is a temporary work-around for not being able to safely download into a shared directory.
for
(
FileSystemEntity
entity
in
location
.
listSync
(
recursive:
true
))
{
if
(
entity
is
File
)
{
final
List
<
String
>
segments
=
fs
.
path
.
split
(
entity
.
path
);
segments
.
remove
(
'flutter_web_sdk'
);
final
String
newPath
=
fs
.
path
.
joinAll
(
segments
);
final
File
newFile
=
fs
.
file
(
newPath
);
if
(!
newFile
.
existsSync
())
{
newFile
.
createSync
(
recursive:
true
);
}
entity
.
copySync
(
newPath
);
}
}
}
}
...
...
packages/flutter_tools/lib/src/commands/build_web.dart
View file @
44b22c7b
...
...
@@ -4,10 +4,11 @@
import
'dart:async'
;
import
'../base/common.dart'
;
import
'../base/logger.dart'
;
import
'../build_info.dart'
;
import
'../globals.dart'
;
import
'../runner/flutter_command.dart'
show
ExitStatus
,
FlutterCommandResult
;
import
'../runner/flutter_command.dart'
show
FlutterCommandResult
;
import
'../web/compile.dart'
;
import
'build.dart'
;
...
...
@@ -33,6 +34,9 @@ class BuildWebCommand extends BuildSubCommand {
final
Status
status
=
logger
.
startProgress
(
'Compiling
$target
to JavaScript...'
,
timeout:
null
);
final
int
result
=
await
webCompiler
.
compile
(
target:
target
);
status
.
stop
();
return
FlutterCommandResult
(
result
==
0
?
ExitStatus
.
success
:
ExitStatus
.
fail
);
if
(
result
==
1
)
{
throwToolExit
(
'Failed to compile
$target
to JavaScript.'
);
}
return
null
;
}
}
packages/flutter_tools/lib/src/web/compile.dart
View file @
44b22c7b
...
...
@@ -28,8 +28,8 @@ class WebCompiler {
Future
<
int
>
compile
({
@required
String
target
,
bool
minify
=
true
,
bool
enabledAssertions
=
false
})
async
{
final
String
engineDartPath
=
artifacts
.
getArtifactPath
(
Artifact
.
engineDartBinary
);
final
String
dart2jsPath
=
artifacts
.
getArtifactPath
(
Artifact
.
dart2jsSnapshot
);
final
String
flutter
PatchedSdkPath
=
artifacts
.
getArtifactPath
(
Artifact
.
flutterPatchedSdkPath
);
final
String
librariesPath
=
fs
.
path
.
join
(
flutter
Patched
SdkPath
,
'libraries.json'
);
final
String
flutter
WebSdkPath
=
artifacts
.
getArtifactPath
(
Artifact
.
flutterWebSdk
);
final
String
librariesPath
=
fs
.
path
.
join
(
flutter
Web
SdkPath
,
'libraries.json'
);
final
Directory
outputDir
=
fs
.
directory
(
getWebBuildDirectory
());
if
(!
outputDir
.
existsSync
())
{
outputDir
.
createSync
(
recursive:
true
);
...
...
@@ -46,7 +46,6 @@ class WebCompiler {
'-o'
,
'
$outputPath
'
,
'--libraries-spec=
$librariesPath
'
,
'--platform-binaries=
$flutterPatchedSdkPath
'
,
];
if
(
minify
)
{
command
.
add
(
'-m'
);
...
...
packages/flutter_tools/test/web/compile_test.dart
View file @
44b22c7b
...
...
@@ -22,8 +22,8 @@ void main() {
const
WebCompiler
webCompiler
=
WebCompiler
();
final
String
engineDartPath
=
artifacts
.
getArtifactPath
(
Artifact
.
engineDartBinary
);
final
String
dart2jsPath
=
artifacts
.
getArtifactPath
(
Artifact
.
dart2jsSnapshot
);
final
String
flutter
PatchedSdkPath
=
artifacts
.
getArtifactPath
(
Artifact
.
flutterPatchedSdkPath
);
final
String
librariesPath
=
fs
.
path
.
join
(
flutter
Patched
SdkPath
,
'libraries.json'
);
final
String
flutter
WebSdkPath
=
artifacts
.
getArtifactPath
(
Artifact
.
flutterWebSdk
);
final
String
librariesPath
=
fs
.
path
.
join
(
flutter
Web
SdkPath
,
'libraries.json'
);
when
(
mockProcess
.
stdout
).
thenAnswer
((
Invocation
invocation
)
=>
const
Stream
<
List
<
int
>>.
empty
());
when
(
mockProcess
.
stderr
).
thenAnswer
((
Invocation
invocation
)
=>
const
Stream
<
List
<
int
>>.
empty
());
...
...
@@ -41,7 +41,6 @@ void main() {
'-o'
,
outputPath
,
'--libraries-spec=
$librariesPath
'
,
'--platform-binaries=
$flutterPatchedSdkPath
'
,
'-m'
,
])).
called
(
1
);
},
overrides:
<
Type
,
Generator
>{
...
...
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