Add trace logging to local engine path autodetection (#78482)
This commit is contained in:
@@ -66,6 +66,7 @@ class LocalEngineLocator {
|
|||||||
Uri engineUri = packageConfig[kFlutterEnginePackageName]?.packageUriRoot;
|
Uri engineUri = packageConfig[kFlutterEnginePackageName]?.packageUriRoot;
|
||||||
final String cachedPath = _fileSystem.path.join(_flutterRoot, 'bin', 'cache', 'pkg', kFlutterEnginePackageName, 'lib');
|
final String cachedPath = _fileSystem.path.join(_flutterRoot, 'bin', 'cache', 'pkg', kFlutterEnginePackageName, 'lib');
|
||||||
if (engineUri != null && _fileSystem.identicalSync(cachedPath, engineUri.path)) {
|
if (engineUri != null && _fileSystem.identicalSync(cachedPath, engineUri.path)) {
|
||||||
|
_logger.printTrace('Local engine auto-detection sky_engine in $packagePath is the same version in bin/cache.');
|
||||||
engineUri = null;
|
engineUri = null;
|
||||||
}
|
}
|
||||||
// If sky_engine is specified and the engineSourcePath not set, try to
|
// If sky_engine is specified and the engineSourcePath not set, try to
|
||||||
@@ -92,7 +93,8 @@ class LocalEngineLocator {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} on FileSystemException {
|
} on FileSystemException catch (e) {
|
||||||
|
_logger.printTrace('Local engine auto-detection file exception: $e');
|
||||||
engineSourcePath = null;
|
engineSourcePath = null;
|
||||||
}
|
}
|
||||||
// If engineSourcePath is still not set, try to determine it by flutter root.
|
// If engineSourcePath is still not set, try to determine it by flutter root.
|
||||||
@@ -109,7 +111,10 @@ class LocalEngineLocator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (engineSourcePath != null) {
|
if (engineSourcePath != null) {
|
||||||
|
_logger.printTrace('Local engine source at $engineSourcePath');
|
||||||
return _findEngineBuildPath(localEngine, engineSourcePath);
|
return _findEngineBuildPath(localEngine, engineSourcePath);
|
||||||
|
} else if (localEngine != null) {
|
||||||
|
_logger.printTrace('Could not find engine source for $localEngine, skipping');
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,10 +36,11 @@ void main() {
|
|||||||
.file('bin/cache/pkg/sky_engine/lib')
|
.file('bin/cache/pkg/sky_engine/lib')
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
|
final BufferLogger logger = BufferLogger.test();
|
||||||
final LocalEngineLocator localEngineLocator = LocalEngineLocator(
|
final LocalEngineLocator localEngineLocator = LocalEngineLocator(
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
flutterRoot: '',
|
flutterRoot: '',
|
||||||
logger: BufferLogger.test(),
|
logger: logger,
|
||||||
userMessages: UserMessages(),
|
userMessages: UserMessages(),
|
||||||
platform: FakePlatform(environment: <String, String>{}),
|
platform: FakePlatform(environment: <String, String>{}),
|
||||||
);
|
);
|
||||||
@@ -51,6 +52,7 @@ void main() {
|
|||||||
targetEngine: '/arbitrary/engine/src/out/ios_debug',
|
targetEngine: '/arbitrary/engine/src/out/ios_debug',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
expect(logger.traceText, contains('Local engine source at /arbitrary/engine/src'));
|
||||||
|
|
||||||
// Verify that this also works if the sky_engine path is a symlink to the engine root.
|
// Verify that this also works if the sky_engine path is a symlink to the engine root.
|
||||||
fileSystem.link('/symlink').createSync(kArbitraryEngineRoot);
|
fileSystem.link('/symlink').createSync(kArbitraryEngineRoot);
|
||||||
@@ -65,6 +67,7 @@ void main() {
|
|||||||
targetEngine: '/symlink/src/out/ios_debug',
|
targetEngine: '/symlink/src/out/ios_debug',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
expect(logger.traceText, contains('Local engine source at /symlink/src'));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('works if --local-engine is specified and --local-engine-src-path '
|
testWithoutContext('works if --local-engine is specified and --local-engine-src-path '
|
||||||
@@ -74,10 +77,11 @@ void main() {
|
|||||||
fileSystem.directory('$kArbitraryEngineRoot/src/out/ios_debug').createSync(recursive: true);
|
fileSystem.directory('$kArbitraryEngineRoot/src/out/ios_debug').createSync(recursive: true);
|
||||||
fileSystem.directory('$kArbitraryEngineRoot/src/out/host_debug').createSync(recursive: true);
|
fileSystem.directory('$kArbitraryEngineRoot/src/out/host_debug').createSync(recursive: true);
|
||||||
|
|
||||||
|
final BufferLogger logger = BufferLogger.test();
|
||||||
final LocalEngineLocator localEngineLocator = LocalEngineLocator(
|
final LocalEngineLocator localEngineLocator = LocalEngineLocator(
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
flutterRoot: '',
|
flutterRoot: '',
|
||||||
logger: BufferLogger.test(),
|
logger: logger,
|
||||||
userMessages: UserMessages(),
|
userMessages: UserMessages(),
|
||||||
platform: FakePlatform(environment: <String, String>{}),
|
platform: FakePlatform(environment: <String, String>{}),
|
||||||
);
|
);
|
||||||
@@ -89,6 +93,7 @@ void main() {
|
|||||||
targetEngine: '/arbitrary/engine/src/out/ios_debug',
|
targetEngine: '/arbitrary/engine/src/out/ios_debug',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
expect(logger.traceText, contains('Local engine source at /arbitrary/engine/src'));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('works if --local-engine is specified and --local-engine-src-path '
|
testWithoutContext('works if --local-engine is specified and --local-engine-src-path '
|
||||||
@@ -105,10 +110,11 @@ void main() {
|
|||||||
.file('bin/cache/pkg/sky_engine/lib')
|
.file('bin/cache/pkg/sky_engine/lib')
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
|
final BufferLogger logger = BufferLogger.test();
|
||||||
final LocalEngineLocator localEngineLocator = LocalEngineLocator(
|
final LocalEngineLocator localEngineLocator = LocalEngineLocator(
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
flutterRoot: 'flutter/flutter',
|
flutterRoot: 'flutter/flutter',
|
||||||
logger: BufferLogger.test(),
|
logger: logger,
|
||||||
userMessages: UserMessages(),
|
userMessages: UserMessages(),
|
||||||
platform: FakePlatform(environment: <String, String>{}),
|
platform: FakePlatform(environment: <String, String>{}),
|
||||||
);
|
);
|
||||||
@@ -120,6 +126,7 @@ void main() {
|
|||||||
targetEngine: 'flutter/engine/src/out/ios_debug',
|
targetEngine: 'flutter/engine/src/out/ios_debug',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
expect(logger.traceText, contains('Local engine source at flutter/engine/src'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user