diff --git a/dev/conductor/lib/codesign.dart b/dev/conductor/lib/codesign.dart index 8020eb37dd..2f05e1450d 100644 --- a/dev/conductor/lib/codesign.dart +++ b/dev/conductor/lib/codesign.dart @@ -284,7 +284,7 @@ class CodesignCommand extends Command { // First print all deviations from expectations if (unsignedBinaries.isNotEmpty) { stdio.printError('Found ${unsignedBinaries.length} unsigned binaries:'); - unsignedBinaries.forEach(print); + unsignedBinaries.forEach(stdio.printError); } if (wrongEntitlementBinaries.isNotEmpty) { diff --git a/dev/conductor/lib/globals.dart b/dev/conductor/lib/globals.dart index 54a5d0f1ad..670041c376 100644 --- a/dev/conductor/lib/globals.dart +++ b/dev/conductor/lib/globals.dart @@ -50,23 +50,7 @@ Directory get localFlutterRoot { const FileSystem fileSystem = LocalFileSystem(); const Platform platform = LocalPlatform(); - // If a test - if (platform.script.scheme == 'data') { - final RegExp pattern = RegExp( - r'(file:\/\/[^"]*[/\\]dev\/conductor[/\\][^"]+\.dart)', - multiLine: true, - ); - final Match? match = - pattern.firstMatch(Uri.decodeFull(platform.script.path)); - if (match == null) { - throw Exception( - 'Cannot determine path of script!\n${platform.script.path}', - ); - } - filePath = Uri.parse(match.group(1)!).path.replaceAll(r'%20', ' '); - } else { - filePath = platform.script.toFilePath(); - } + filePath = platform.script.toFilePath(); final String checkoutsDirname = fileSystem.path.normalize( fileSystem.path.join( fileSystem.path.dirname(filePath), diff --git a/dev/conductor/test/codesign_integration_test.dart b/dev/conductor/test/codesign_integration_test.dart index 655d664d39..1581bfc38e 100644 --- a/dev/conductor/test/codesign_integration_test.dart +++ b/dev/conductor/test/codesign_integration_test.dart @@ -31,9 +31,13 @@ void main() { stdio: stdio, ); + final Directory flutterRoot = _flutterRootFromDartBinary( + fileSystem.file(platform.executable), + ); + final CommandRunner runner = CommandRunner('codesign-test', '') ..addCommand( - CodesignCommand(checkouts: checkouts, flutterRoot: localFlutterRoot)); + CodesignCommand(checkouts: checkouts, flutterRoot: flutterRoot)); try { await runner.run([ @@ -44,7 +48,7 @@ void main() { ]); } on ConductorException catch (e) { print(stdio.error); - print(fixItInstructions); + print(_fixItInstructions); fail(e.message); } on Exception { print('stdout:\n${stdio.stdout}'); @@ -54,10 +58,17 @@ void main() { }, onPlatform: { 'windows': const Skip('codesign command is only supported on macos'), 'linux': const Skip('codesign command is only supported on macos'), - }, skip: 'TODO(christopherfujino): https://github.com/flutter/flutter/issues/83448'); + }); } -const String fixItInstructions = ''' +Directory _flutterRootFromDartBinary(File dartBinary) { + final Directory flutterDartSdkDir = dartBinary.parent.parent; + final Directory flutterCache = flutterDartSdkDir.parent; + final Directory flutterSdkDir = flutterCache.parent.parent; + return flutterSdkDir; +} + +const String _fixItInstructions = ''' Codesign integration test failed. This means that the binary files found in the Flutter cache do not match those