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
8a77381e
Unverified
Commit
8a77381e
authored
May 14, 2020
by
Jonah Williams
Committed by
GitHub
May 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] do not set timestamp of package_config file (#57077)
parent
b4788f29
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
20 deletions
+1
-20
pub.dart
packages/flutter_tools/lib/src/dart/pub.dart
+1
-15
pub_get_test.dart
...s/flutter_tools/test/general.shard/dart/pub_get_test.dart
+0
-5
No files found.
packages/flutter_tools/lib/src/dart/pub.dart
View file @
8a77381e
...
...
@@ -223,7 +223,7 @@ class _DefaultPub implements Pub {
}
if
(!
packageConfigFile
.
existsSync
())
{
throwToolExit
(
'
$directory
: pub did not create .
packages
file.'
);
throwToolExit
(
'
$directory
: pub did not create .
dart_tools/package_config.json
file.'
);
}
if
(
pubSpecYaml
.
lastModifiedSync
()
!=
originalPubspecYamlModificationTime
)
{
throwToolExit
(
...
...
@@ -232,8 +232,6 @@ class _DefaultPub implements Pub {
}
// We don't check if dotPackages was actually modified, because as far as we can tell sometimes
// pub will decide it does not need to actually modify it.
// Since we rely on the file having a more recent timestamp, though, we do manually force the
// file to be more recently modified.
final
DateTime
now
=
DateTime
.
now
();
if
(
now
.
isBefore
(
originalPubspecYamlModificationTime
))
{
_logger
.
printError
(
...
...
@@ -243,18 +241,6 @@ class _DefaultPub implements Pub {
'The timestamp was:
$originalPubspecYamlModificationTime
\n
'
'The time now is:
$now
'
);
}
else
{
packageConfigFile
.
setLastModifiedSync
(
now
);
final
DateTime
newDotPackagesTimestamp
=
packageConfigFile
.
lastModifiedSync
();
if
(
newDotPackagesTimestamp
.
isBefore
(
originalPubspecYamlModificationTime
))
{
_logger
.
printError
(
'Warning: Failed to set timestamp of "
${_fileSystem.path.absolute(packageConfigFile.path)}
". '
'Tried to set timestamp to
$now
, but new timestamp is
$newDotPackagesTimestamp
.'
);
if
(
newDotPackagesTimestamp
.
isAfter
(
now
))
{
_logger
.
printError
(
'Maybe the file was concurrently modified?'
);
}
}
}
}
...
...
packages/flutter_tools/test/general.shard/dart/pub_get_test.dart
View file @
8a77381e
...
...
@@ -338,8 +338,6 @@ void main() {
expect
(
logger
.
statusText
,
'Running "flutter pub get" in /...
\n
'
);
expect
(
logger
.
errorText
,
isEmpty
);
expect
(
fileSystem
.
file
(
'pubspec.yaml'
).
lastModifiedSync
(),
DateTime
(
2001
));
// because nothing should touch it
expect
(
fileSystem
.
file
(
'.dart_tool/package_config.json'
).
lastModifiedSync
(),
isNot
(
DateTime
(
2000
)));
// because pub changes it to 2002
expect
(
fileSystem
.
file
(
'.dart_tool/package_config.json'
).
lastModifiedSync
(),
isNot
(
DateTime
(
2002
)));
// because we set the timestamp again after pub
logger
.
clear
();
// bad scenario 1: pub doesn't update file; doesn't matter, because we do instead
...
...
@@ -352,8 +350,6 @@ void main() {
expect
(
logger
.
statusText
,
'Running "flutter pub get" in /...
\n
'
);
expect
(
logger
.
errorText
,
isEmpty
);
expect
(
fileSystem
.
file
(
'pubspec.yaml'
).
lastModifiedSync
(),
DateTime
(
2001
));
// because nothing should touch it
expect
(
fileSystem
.
file
(
'.dart_tool/package_config.json'
).
lastModifiedSync
(),
isNot
(
DateTime
(
2000
)));
// because we set the timestamp
expect
(
fileSystem
.
file
(
'.dart_tool/package_config.json'
).
lastModifiedSync
(),
isNot
(
DateTime
(
2002
)));
// just in case FakeProcessManager is buggy
logger
.
clear
();
// bad scenario 2: pub changes pubspec.yaml instead
...
...
@@ -370,7 +366,6 @@ void main() {
expect
(
logger
.
statusText
,
'Running "flutter pub get" in /...
\n
'
);
expect
(
logger
.
errorText
,
isEmpty
);
expect
(
fileSystem
.
file
(
'pubspec.yaml'
).
lastModifiedSync
(),
DateTime
(
2002
));
// because fake pub above touched it
expect
(
fileSystem
.
file
(
'.dart_tool/package_config.json'
).
lastModifiedSync
(),
DateTime
(
2000
));
// because nothing touched it
// bad scenario 3: pubspec.yaml was created in the future
fileSystem
.
file
(
'.dart_tool/package_config.json'
)
...
...
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