Unverified Commit cb534057 authored by Jackson Gardner's avatar Jackson Gardner Committed by GitHub

Don't specify libraries-spec argument if we are passing a platform dill. (#114045)

parent 7d037f2c
......@@ -763,7 +763,9 @@ class DefaultResidentCompiler implements ResidentCompiler {
'--output-dill',
outputPath,
],
if (librariesSpec != null) ...<String>[
// If we have a platform dill, we don't need to pass the libraries spec,
// since the information is embedded in the .dill file.
if (librariesSpec != null && platformDill == null) ...<String>[
'--libraries-spec',
librariesSpec!,
],
......
......@@ -22,6 +22,7 @@ import '../src/fakes.dart';
void main() {
late ResidentCompiler generator;
late ResidentCompiler generatorWithScheme;
late ResidentCompiler generatorWithPlatformDillAndLibrariesSpec;
late MemoryIOSink frontendServerStdIn;
late BufferLogger testLogger;
late StdoutHandler generatorStdoutHandler;
......@@ -76,6 +77,18 @@ void main() {
fileSystem: MemoryFileSystem.test(),
stdoutHandler: generatorWithSchemeStdoutHandler,
);
generatorWithPlatformDillAndLibrariesSpec = DefaultResidentCompiler(
'sdkroot',
buildMode: BuildMode.debug,
logger: testLogger,
processManager: fakeProcessManager,
artifacts: Artifacts.test(),
platform: FakePlatform(),
fileSystem: MemoryFileSystem.test(),
stdoutHandler: generatorStdoutHandler,
platformDill: '/foo/platform.dill',
librariesSpec: '/bar/libraries.json',
);
});
testWithoutContext('incremental compile single dart compile', () async {
......@@ -431,6 +444,32 @@ void main() {
expect(output?.outputFilename, equals('/path/to/main.dart.dill'));
expect(fakeProcessManager, hasNoRemainingExpectations);
});
testWithoutContext('compile does not pass libraries-spec when using a platform dill', () async {
fakeProcessManager.addCommand(FakeCommand(
command: const <String>[
...frontendServerCommand,
'--platform',
'/foo/platform.dill',
'--verbosity=error'
],
stdout: 'result abc\nline1\nline2\nabc\nabc /path/to/main.dart.dill 0',
stdin: frontendServerStdIn,
));
final CompilerOutput? output = await generatorWithPlatformDillAndLibrariesSpec.recompile(
Uri.parse('/path/to/main.dart'),
null /* invalidatedFiles */,
outputPath: '/build/',
packageConfig: PackageConfig.empty,
fs: MemoryFileSystem(),
projectRootPath: '',
);
expect(frontendServerStdIn.getAndClear(), 'compile /path/to/main.dart\n');
expect(testLogger.errorText, equals('line1\nline2\n'));
expect(output?.outputFilename, equals('/path/to/main.dart.dill'));
expect(fakeProcessManager, hasNoRemainingExpectations);
});
}
Future<void> _recompile(
......
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