diff --git a/pkgs/cronet_http/tool/prepare_for_embedded.dart b/pkgs/cronet_http/tool/prepare_for_embedded.dart index 3a1a567d04..2ced3597e0 100644 --- a/pkgs/cronet_http/tool/prepare_for_embedded.dart +++ b/pkgs/cronet_http/tool/prepare_for_embedded.dart @@ -40,9 +40,7 @@ final _cronetVersionUri = Uri.https( 'android/maven2/org/chromium/net/group-index.xml', ); -/// Runs `prepare_for_embedded.dart true` for publishing, -/// or only the Android dependency will be modified. -void main(List args) async { +void main() async { if (Directory.current.path.endsWith('tool')) { _packageDirectory = Directory.current.parent; } else { @@ -51,10 +49,8 @@ void main(List args) async { final latestVersion = await _getLatestCronetVersion(); updateCronetDependency(latestVersion); - if (args.isNotEmpty && args.first == 'true') { - updatePubSpec(); - updateReadme(); - } + updatePubSpec(); + updateReadme(); } Future _getLatestCronetVersion() async { @@ -73,7 +69,7 @@ Future _getLatestCronetVersion() async { return versions.last; } -/// Update android/build.gradle +/// Update android/build.gradle. void updateCronetDependency(String latestVersion) { final fBuildGradle = File('${_packageDirectory.path}/android/build.gradle'); final gradleContent = fBuildGradle.readAsStringSync(); @@ -92,22 +88,25 @@ void updateCronetDependency(String latestVersion) { fBuildGradle.writeAsStringSync(newGradleContent); } -/// Update pubspec.yaml and example/pubspec.yaml +/// Update pubspec.yaml and example/pubspec.yaml. void updatePubSpec() { + print('Updating pubspec.yaml'); final fPubspec = File('${_packageDirectory.path}/pubspec.yaml'); final yamlEditor = YamlEditor(fPubspec.readAsStringSync()) ..update(['name'], _packageName) ..update(['description'], _packageDescription); fPubspec.writeAsStringSync(yamlEditor.toString()); - final examplePubspec = File('${_packageDirectory.path}/pubspec.yaml'); + print('Updating example/pubspec.yaml'); + final examplePubspec = File('${_packageDirectory.path}/example/pubspec.yaml'); final replaced = examplePubspec .readAsStringSync() .replaceAll('cronet_http:', 'cronet_http_embedded:'); examplePubspec.writeAsStringSync(replaced); } -/// Move README_EMBEDDED.md to replace README.md +/// Move README_EMBEDDED.md to replace README.md. void updateReadme() { + print('Updating README.md from README_EMBEDDED.md'); File('${_packageDirectory.path}/README.md').deleteSync(); File('${_packageDirectory.path}/README_EMBEDDED.md') .renameSync('${_packageDirectory.path}/README.md');