diff --git a/dev/bots/prepare_package.dart b/dev/bots/prepare_package.dart index 4083c11a28f..67636764be9 100644 --- a/dev/bots/prepare_package.dart +++ b/dev/bots/prepare_package.dart @@ -533,6 +533,14 @@ class ArchivePublisher { Directory workingDirectory, bool failOk = false, }) async { + if (platform.isWindows) { + return _processRunner.runProcess( + ['python', path.join(platform.environment['DEPOT_TOOLS'], 'gsutil.py'), '--']..addAll(args), + workingDirectory: workingDirectory, + failOk: failOk, + ); + } + return _processRunner.runProcess( ['gsutil.py', '--']..addAll(args), workingDirectory: workingDirectory, diff --git a/dev/bots/test/prepare_package_test.dart b/dev/bots/test/prepare_package_test.dart index 614ae23b14c..a153078fbca 100644 --- a/dev/bots/test/prepare_package_test.dart +++ b/dev/bots/test/prepare_package_test.dart @@ -38,7 +38,9 @@ void main() { for (String platformName in ['macos', 'linux', 'windows']) { final FakePlatform platform = FakePlatform( operatingSystem: platformName, - environment: {}, + environment: { + 'DEPOT_TOOLS': path.join('D:', 'depot_tools'), + }, ); group('ProcessRunner for $platform', () { test('Returns stdout', () async { @@ -256,12 +258,15 @@ void main() { } '''; File(jsonPath).writeAsStringSync(releasesJson); + final String gsutilCall = platform.isWindows + ? 'python ${path.join("D:", "depot_tools", "gsutil.py")}' + : 'gsutil.py'; final Map> calls = >{ - 'gsutil.py -- rm $gsArchivePath': null, - 'gsutil.py -- -h Content-Type:$archiveMime cp $archivePath $gsArchivePath': null, - 'gsutil.py -- cp $gsJsonPath $jsonPath': null, - 'gsutil.py -- rm $gsJsonPath': null, - 'gsutil.py -- -h Content-Type:application/json cp $jsonPath $gsJsonPath': null, + '$gsutilCall -- rm $gsArchivePath': null, + '$gsutilCall -- -h Content-Type:$archiveMime cp $archivePath $gsArchivePath': null, + '$gsutilCall -- cp $gsJsonPath $jsonPath': null, + '$gsutilCall -- rm $gsJsonPath': null, + '$gsutilCall -- -h Content-Type:application/json cp $jsonPath $gsJsonPath': null, }; processManager.fakeResults = calls; final File outputFile = File(path.join(tempDir.absolute.path, archiveName));