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
270878fc
Unverified
Commit
270878fc
authored
Sep 12, 2019
by
Jonah Williams
Committed by
GitHub
Sep 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix copy command and remove resolve sync for macOS assemble (#40294)
parent
b9399216
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
9 deletions
+67
-9
build_system.dart
...ages/flutter_tools/lib/src/build_system/build_system.dart
+29
-4
macos.dart
...ges/flutter_tools/lib/src/build_system/targets/macos.dart
+4
-1
assemble.dart
packages/flutter_tools/lib/src/commands/assemble.dart
+1
-1
macos_test.dart
...s/test/general.shard/build_system/targets/macos_test.dart
+33
-3
No files found.
packages/flutter_tools/lib/src/build_system/build_system.dart
View file @
270878fc
...
@@ -146,11 +146,11 @@ abstract class Target {
...
@@ -146,11 +146,11 @@ abstract class Target {
final
File
stamp
=
_findStampFile
(
environment
);
final
File
stamp
=
_findStampFile
(
environment
);
final
List
<
String
>
inputPaths
=
<
String
>[];
final
List
<
String
>
inputPaths
=
<
String
>[];
for
(
File
input
in
inputs
)
{
for
(
File
input
in
inputs
)
{
inputPaths
.
add
(
input
.
resolveSymbolicLinksSync
()
);
inputPaths
.
add
(
input
.
path
);
}
}
final
List
<
String
>
outputPaths
=
<
String
>[];
final
List
<
String
>
outputPaths
=
<
String
>[];
for
(
File
output
in
outputs
)
{
for
(
File
output
in
outputs
)
{
outputPaths
.
add
(
output
.
resolveSymbolicLinksSync
()
);
outputPaths
.
add
(
output
.
path
);
}
}
final
Map
<
String
,
Object
>
result
=
<
String
,
Object
>{
final
Map
<
String
,
Object
>
result
=
<
String
,
Object
>{
'inputs'
:
inputPaths
,
'inputs'
:
inputPaths
,
...
@@ -502,7 +502,7 @@ class _BuildInstance {
...
@@ -502,7 +502,7 @@ class _BuildInstance {
outputFiles
[
output
.
path
]
=
output
;
outputFiles
[
output
.
path
]
=
output
;
}
}
}
else
{
}
else
{
printStatus
(
'
${node.target.name}
: Starting'
);
printStatus
(
'
${node.target.name}
: Starting
due to
${node.invalidatedReasons}
'
);
await
node
.
target
.
build
(
environment
);
await
node
.
target
.
build
(
environment
);
printStatus
(
'
${node.target.name}
: Complete'
);
printStatus
(
'
${node.target.name}
: Complete'
);
...
@@ -653,9 +653,14 @@ class Node {
...
@@ -653,9 +653,14 @@ class Node {
/// Output file paths from the previous invocation of this build node.
/// Output file paths from the previous invocation of this build node.
final
Set
<
String
>
previousOutputs
=
<
String
>{};
final
Set
<
String
>
previousOutputs
=
<
String
>{};
/// In
o
ut file paths from the previous invocation of this build node.
/// In
p
ut file paths from the previous invocation of this build node.
final
Set
<
String
>
previousInputs
=
<
String
>{};
final
Set
<
String
>
previousInputs
=
<
String
>{};
/// One or more reasons why a task was invalidated.
///
/// May be empty if the task was skipped.
final
Set
<
InvalidedReason
>
invalidatedReasons
=
<
InvalidedReason
>{};
/// Whether this node needs an action performed.
/// Whether this node needs an action performed.
bool
get
dirty
=>
_dirty
;
bool
get
dirty
=>
_dirty
;
bool
_dirty
=
false
;
bool
_dirty
=
false
;
...
@@ -685,6 +690,7 @@ class Node {
...
@@ -685,6 +690,7 @@ class Node {
if
(
fileHashStore
.
currentHashes
.
containsKey
(
absolutePath
))
{
if
(
fileHashStore
.
currentHashes
.
containsKey
(
absolutePath
))
{
final
String
currentHash
=
fileHashStore
.
currentHashes
[
absolutePath
];
final
String
currentHash
=
fileHashStore
.
currentHashes
[
absolutePath
];
if
(
currentHash
!=
previousHash
)
{
if
(
currentHash
!=
previousHash
)
{
invalidatedReasons
.
add
(
InvalidedReason
.
inputChanged
);
_dirty
=
true
;
_dirty
=
true
;
}
}
}
else
{
}
else
{
...
@@ -698,11 +704,13 @@ class Node {
...
@@ -698,11 +704,13 @@ class Node {
// output paths changed.
// output paths changed.
if
(!
currentOutputPaths
.
contains
(
previousOutput
))
{
if
(!
currentOutputPaths
.
contains
(
previousOutput
))
{
_dirty
=
true
;
_dirty
=
true
;
invalidatedReasons
.
add
(
InvalidedReason
.
outputSetChanged
);
// if this isn't a current output file there is no reason to compute the hash.
// if this isn't a current output file there is no reason to compute the hash.
continue
;
continue
;
}
}
final
File
file
=
fs
.
file
(
previousOutput
);
final
File
file
=
fs
.
file
(
previousOutput
);
if
(!
file
.
existsSync
())
{
if
(!
file
.
existsSync
())
{
invalidatedReasons
.
add
(
InvalidedReason
.
outputMissing
);
_dirty
=
true
;
_dirty
=
true
;
continue
;
continue
;
}
}
...
@@ -711,6 +719,7 @@ class Node {
...
@@ -711,6 +719,7 @@ class Node {
if
(
fileHashStore
.
currentHashes
.
containsKey
(
absolutePath
))
{
if
(
fileHashStore
.
currentHashes
.
containsKey
(
absolutePath
))
{
final
String
currentHash
=
fileHashStore
.
currentHashes
[
absolutePath
];
final
String
currentHash
=
fileHashStore
.
currentHashes
[
absolutePath
];
if
(
currentHash
!=
previousHash
)
{
if
(
currentHash
!=
previousHash
)
{
invalidatedReasons
.
add
(
InvalidedReason
.
outputChanged
);
_dirty
=
true
;
_dirty
=
true
;
}
}
}
else
{
}
else
{
...
@@ -728,9 +737,25 @@ class Node {
...
@@ -728,9 +737,25 @@ class Node {
if
(
sourcesToHash
.
isNotEmpty
)
{
if
(
sourcesToHash
.
isNotEmpty
)
{
final
List
<
File
>
dirty
=
await
fileHashStore
.
hashFiles
(
sourcesToHash
);
final
List
<
File
>
dirty
=
await
fileHashStore
.
hashFiles
(
sourcesToHash
);
if
(
dirty
.
isNotEmpty
)
{
if
(
dirty
.
isNotEmpty
)
{
invalidatedReasons
.
add
(
InvalidedReason
.
inputChanged
);
_dirty
=
true
;
_dirty
=
true
;
}
}
}
}
return
!
_dirty
;
return
!
_dirty
;
}
}
}
}
/// A description of why a task was rerun.
enum
InvalidedReason
{
/// An input file has an updated hash.
inputChanged
,
/// An output file has an updated hash.
outputChanged
,
/// An output file that is expected is missing.
outputMissing
,
/// The set of expected output files changed.
outputSetChanged
,
}
packages/flutter_tools/lib/src/build_system/targets/macos.dart
View file @
270878fc
...
@@ -122,7 +122,9 @@ abstract class UnpackMacOS extends Target {
...
@@ -122,7 +122,9 @@ abstract class UnpackMacOS extends Target {
final
Directory
targetDirectory
=
environment
final
Directory
targetDirectory
=
environment
.
outputDir
.
outputDir
.
childDirectory
(
'FlutterMacOS.framework'
);
.
childDirectory
(
'FlutterMacOS.framework'
);
if
(
targetDirectory
.
existsSync
())
{
targetDirectory
.
deleteSync
(
recursive:
true
);
}
final
ProcessResult
result
=
await
processManager
final
ProcessResult
result
=
await
processManager
.
run
(<
String
>[
'cp'
,
'-R'
,
basePath
,
targetDirectory
.
path
]);
.
run
(<
String
>[
'cp'
,
'-R'
,
basePath
,
targetDirectory
.
path
]);
if
(
result
.
exitCode
!=
0
)
{
if
(
result
.
exitCode
!=
0
)
{
...
@@ -285,6 +287,7 @@ abstract class MacOSBundleFlutterAssets extends Target {
...
@@ -285,6 +287,7 @@ abstract class MacOSBundleFlutterAssets extends Target {
@override
@override
List
<
Source
>
get
inputs
=>
const
<
Source
>[
List
<
Source
>
get
inputs
=>
const
<
Source
>[
Source
.
pattern
(
'{PROJECT_DIR}/pubspec.yaml'
),
Source
.
pattern
(
'{PROJECT_DIR}/pubspec.yaml'
),
Source
.
pattern
(
'{BUILD_DIR}/App.framework/App'
),
Source
.
behavior
(
MacOSAssetBehavior
())
Source
.
behavior
(
MacOSAssetBehavior
())
];
];
...
...
packages/flutter_tools/lib/src/commands/assemble.dart
View file @
270878fc
...
@@ -149,7 +149,7 @@ void writeListIfChanged(List<File> files, String path) {
...
@@ -149,7 +149,7 @@ void writeListIfChanged(List<File> files, String path) {
final
StringBuffer
buffer
=
StringBuffer
();
final
StringBuffer
buffer
=
StringBuffer
();
// These files are already sorted.
// These files are already sorted.
for
(
File
file
in
files
)
{
for
(
File
file
in
files
)
{
buffer
.
writeln
(
file
.
resolveSymbolicLinksSync
()
);
buffer
.
writeln
(
file
.
path
);
}
}
final
String
newContents
=
buffer
.
toString
();
final
String
newContents
=
buffer
.
toString
();
if
(!
file
.
existsSync
())
{
if
(!
file
.
existsSync
())
{
...
...
packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart
View file @
270878fc
...
@@ -85,11 +85,21 @@ void main() {
...
@@ -85,11 +85,21 @@ void main() {
for
(
File
input
in
inputs
)
{
for
(
File
input
in
inputs
)
{
input
.
createSync
(
recursive:
true
);
input
.
createSync
(
recursive:
true
);
}
}
// Create output directory so we can test that it is deleted.
environment
.
outputDir
.
childDirectory
(
_kOutputPrefix
)
.
createSync
(
recursive:
true
);
when
(
processManager
.
run
(
any
)).
thenAnswer
((
Invocation
invocation
)
async
{
when
(
processManager
.
run
(
any
)).
thenAnswer
((
Invocation
invocation
)
async
{
final
List
<
String
>
arguments
=
invocation
.
positionalArguments
.
first
;
final
List
<
String
>
arguments
=
invocation
.
positionalArguments
.
first
;
final
Directory
source
=
fs
.
directory
(
arguments
[
arguments
.
length
-
2
]);
final
String
sourcePath
=
arguments
[
arguments
.
length
-
2
];
final
Directory
target
=
fs
.
directory
(
arguments
.
last
)
final
String
targetPath
=
arguments
.
last
;
..
createSync
(
recursive:
true
);
final
Directory
source
=
fs
.
directory
(
sourcePath
);
final
Directory
target
=
fs
.
directory
(
targetPath
);
// verify directory was deleted by command.
expect
(
target
.
existsSync
(),
false
);
target
.
createSync
(
recursive:
true
);
for
(
FileSystemEntity
entity
in
source
.
listSync
(
recursive:
true
))
{
for
(
FileSystemEntity
entity
in
source
.
listSync
(
recursive:
true
))
{
if
(
entity
is
File
)
{
if
(
entity
is
File
)
{
final
String
relative
=
fs
.
path
.
relative
(
entity
.
path
,
from:
source
.
path
);
final
String
relative
=
fs
.
path
.
relative
(
entity
.
path
,
from:
source
.
path
);
...
@@ -163,6 +173,26 @@ void main() {
...
@@ -163,6 +173,26 @@ void main() {
expect
(
fs
.
file
(
precompiledIsolate
).
existsSync
(),
false
);
expect
(
fs
.
file
(
precompiledIsolate
).
existsSync
(),
false
);
}));
}));
test
(
'release/profile macOS application updates when App.framework updates'
,
()
=>
testbed
.
run
(()
async
{
fs
.
file
(
fs
.
path
.
join
(
'bin'
,
'cache'
,
'artifacts'
,
'engine'
,
'darwin-x64'
,
'vm_isolate_snapshot.bin'
)).
createSync
(
recursive:
true
);
fs
.
file
(
fs
.
path
.
join
(
'bin'
,
'cache'
,
'artifacts'
,
'engine'
,
'darwin-x64'
,
'isolate_snapshot.bin'
)).
createSync
(
recursive:
true
);
final
File
inputFramework
=
fs
.
file
(
fs
.
path
.
join
(
environment
.
buildDir
.
path
,
'App.framework'
,
'App'
))
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'ABC'
);
await
const
ProfileMacOSBundleFlutterAssets
().
build
(
environment
..
defines
[
kBuildMode
]
=
'profile'
);
final
File
outputFramework
=
fs
.
file
(
fs
.
path
.
join
(
environment
.
outputDir
.
path
,
'App.framework'
,
'App'
));
expect
(
outputFramework
.
readAsStringSync
(),
'ABC'
);
inputFramework
.
writeAsStringSync
(
'DEF'
);
await
const
ProfileMacOSBundleFlutterAssets
().
build
(
environment
..
defines
[
kBuildMode
]
=
'profile'
);
expect
(
outputFramework
.
readAsStringSync
(),
'DEF'
);
}));
test
(
'release/profile macOS compilation uses correct gen_snapshot'
,
()
=>
testbed
.
run
(()
async
{
test
(
'release/profile macOS compilation uses correct gen_snapshot'
,
()
=>
testbed
.
run
(()
async
{
when
(
genSnapshot
.
run
(
when
(
genSnapshot
.
run
(
snapshotType:
anyNamed
(
'snapshotType'
),
snapshotType:
anyNamed
(
'snapshotType'
),
...
...
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