Unverified Commit 902dac47 authored by Christopher Fujino's avatar Christopher Fujino Committed by GitHub

ensure no pub output while caching PubDependencies artifact (#121831)

[flutter_tools] ensure no pub output while caching PubDependencies artifact
parent 0d9a0207
...@@ -127,7 +127,8 @@ class PubDependencies extends ArtifactSet { ...@@ -127,7 +127,8 @@ class PubDependencies extends ArtifactSet {
project: _projectFactory.fromDirectory( project: _projectFactory.fromDirectory(
fileSystem.directory(fileSystem.path.join(_flutterRoot(), 'packages', 'flutter_tools')) fileSystem.directory(fileSystem.path.join(_flutterRoot(), 'packages', 'flutter_tools'))
), ),
offline: offline offline: offline,
outputMode: PubOutputMode.none,
); );
} }
} }
......
...@@ -978,6 +978,13 @@ void main() { ...@@ -978,6 +978,13 @@ void main() {
await pubDependencies.update(FakeArtifactUpdater(), logger, fileSystem, FakeOperatingSystemUtils()); await pubDependencies.update(FakeArtifactUpdater(), logger, fileSystem, FakeOperatingSystemUtils());
expect(pub.calledGet, 1); expect(pub.calledGet, 1);
expect(
pub.invocations.first,
predicate<FakePubInvocation>(
(FakePubInvocation invocation) => invocation.outputMode == PubOutputMode.none,
'Pub invoked with PubOutputMode.none',
),
);
}); });
testUsingContext('Check current DevTools version', () async { testUsingContext('Check current DevTools version', () async {
...@@ -1172,8 +1179,17 @@ class FakeVersionedPackageResolver extends Fake implements VersionedPackageResol ...@@ -1172,8 +1179,17 @@ class FakeVersionedPackageResolver extends Fake implements VersionedPackageResol
} }
} }
class FakePubInvocation {
FakePubInvocation({
required this.outputMode,
});
final PubOutputMode outputMode;
}
class FakePub extends Fake implements Pub { class FakePub extends Fake implements Pub {
int calledGet = 0; final List<FakePubInvocation> invocations = <FakePubInvocation>[];
int get calledGet => invocations.length;
@override @override
Future<void> get({ Future<void> get({
...@@ -1188,7 +1204,7 @@ class FakePub extends Fake implements Pub { ...@@ -1188,7 +1204,7 @@ class FakePub extends Fake implements Pub {
bool printProgress = true, bool printProgress = true,
PubOutputMode outputMode = PubOutputMode.all, PubOutputMode outputMode = PubOutputMode.all,
}) async { }) async {
calledGet += 1; invocations.add(FakePubInvocation(outputMode: outputMode));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment