Send relative uri when target physical file path is specified. (#15887)

This commit is contained in:
Alexander Aprelev 2018-03-23 19:18:39 -07:00 committed by GitHub
parent 2eebf6a0f1
commit af74a7253b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions

View file

@ -409,6 +409,7 @@ class DevFS {
ResidentCompiler generator,
String dillOutputPath,
bool fullRestart: false,
String projectRootPath,
}) async {
// Mark all entries as possibly deleted.
for (DevFSContent content in _entries.values) {
@ -503,11 +504,16 @@ class DevFS {
await generator.recompile(mainPath, invalidatedFiles,
outputPath: dillOutputPath ?? fs.path.join(getBuildDirectory(), 'app.dill'),
packagesFilePath : _packagesFilePath);
if (compiledBinary != null && compiledBinary.isNotEmpty)
if (compiledBinary != null && compiledBinary.isNotEmpty) {
final String entryUri = projectRootPath != null ?
fs.path.relative(mainPath, from: projectRootPath):
mainPath;
dirtyEntries.putIfAbsent(
fs.path.toUri(target + '.dill'),
fs.path.toUri(entryUri + '.dill'),
() => new DevFSFileContent(fs.file(compiledBinary))
);
}
}
if (dirtyEntries.isNotEmpty) {
printTrace('Updating files');

View file

@ -376,7 +376,8 @@ class FlutterDevice {
bool bundleFirstUpload: false,
bool bundleDirty: false,
Set<String> fileFilter,
bool fullRestart: false
bool fullRestart: false,
String projectRootPath,
}) async {
final Status devFSStatus = logger.startProgress(
'Syncing files to device ${device.name}...',
@ -395,6 +396,7 @@ class FlutterDevice {
generator: generator,
fullRestart: fullRestart,
dillOutputPath: dillOutputPath,
projectRootPath: projectRootPath,
);
} on DevFSException {
devFSStatus.cancel();

View file

@ -279,7 +279,8 @@ class HotRunner extends ResidentRunner {
bundleFirstUpload: isFirstUpload,
bundleDirty: isFirstUpload == false && rebuildBundle,
fileFilter: _dartDependencies,
fullRestart: fullRestart
fullRestart: fullRestart,
projectRootPath: projectRootPath,
);
if (!result)
return false;