diff --git a/.github/workflows/cronet.yml b/.github/workflows/cronet.yml index 37e38d5415..0976a756ff 100644 --- a/.github/workflows/cronet.yml +++ b/.github/workflows/cronet.yml @@ -6,12 +6,12 @@ on: - main - master paths: - - '.github/workflows/**' + - '.github/workflows/cronet.yaml' - 'pkgs/cronet_http/**' - 'pkgs/http_client_conformance_tests/**' pull_request: paths: - - '.github/workflows/**' + - '.github/workflows/cronet.yaml' - 'pkgs/cronet_http/**' - 'pkgs/http_client_conformance_tests/**' schedule: @@ -58,8 +58,11 @@ jobs: uses: reactivecircus/android-emulator-runner@v2 if: always() && steps.install.outcome == 'success' with: + # api-level/minSdkVersion should be help in sync in: + # - .github/workflows/cronet.yml + # - pkgs/cronet_http/android/build.gradle + # - pkgs/cronet_http/example/android/app/build.gradle api-level: 28 - target: ${{ matrix.package == 'cronet_http_embedded' && 'default' || 'playstore' }} - arch: x86_64 + target: ${{ matrix.package == 'cronet_http_embedded' && 'google_apis' || 'playstore' }} profile: pixel script: cd 'pkgs/${{ matrix.package }}/example' && flutter test --timeout=1200s integration_test/ diff --git a/pkgs/cronet_http/android/build.gradle b/pkgs/cronet_http/android/build.gradle index 164d96e104..96bb197c73 100644 --- a/pkgs/cronet_http/android/build.gradle +++ b/pkgs/cronet_http/android/build.gradle @@ -46,7 +46,11 @@ android { } defaultConfig { - minSdkVersion 19 + // api-level/minSdkVersion should be help in sync in: + // - .github/workflows/cronet.yml + // - pkgs/cronet_http/android/build.gradle + // - pkgs/cronet_http/example/android/app/build.gradle + minSdkVersion 28 } defaultConfig { diff --git a/pkgs/cronet_http/example/android/app/build.gradle b/pkgs/cronet_http/example/android/app/build.gradle index 02e4b7551e..1f7cd94749 100644 --- a/pkgs/cronet_http/example/android/app/build.gradle +++ b/pkgs/cronet_http/example/android/app/build.gradle @@ -46,7 +46,11 @@ android { applicationId "io.flutter.cronet_http_example" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. - minSdkVersion 21 + // api-level/minSdkVersion should be help in sync in: + // - .github/workflows/cronet.yml + // - pkgs/cronet_http/android/build.gradle + // - pkgs/cronet_http/example/android/app/build.gradle + minSdkVersion 28 targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName diff --git a/pkgs/cronet_http/tool/prepare_for_embedded.dart b/pkgs/cronet_http/tool/prepare_for_embedded.dart index 2093c670b1..3442bc6843 100644 --- a/pkgs/cronet_http/tool/prepare_for_embedded.dart +++ b/pkgs/cronet_http/tool/prepare_for_embedded.dart @@ -13,6 +13,9 @@ /// 1. Modifying the Gradle build file to reference the embedded Cronet. /// 2. Modifying the *name* and *description* in `pubspec.yaml`. /// 3. Replacing `README.md` with `README_EMBEDDED.md`. +/// 4. Change the name of `cronet_http.dart` to `cronet_http_embedded.dart`. +/// 5. Update all the imports from `package:cronet_http/cronet_http.dart` to +/// `package:cronet_http_embedded/cronet_http_embedded.dart` /// /// After running this script, `flutter pub publish` /// can be run to update package:cronet_http_embedded. @@ -40,8 +43,6 @@ final _cronetVersionUri = Uri.https( 'android/maven2/org/chromium/net/group-index.xml', ); -/// Runs `prepare_for_embedded.dart publish` for publishing, -/// or only the Android dependency will be modified. void main(List args) async { if (Directory.current.path.endsWith('tool')) { _packageDirectory = Directory.current.parent; @@ -53,8 +54,8 @@ void main(List args) async { updateCronetDependency(latestVersion); updatePubSpec(); updateReadme(); + updateLibraryName(); updateImports(); - updateEntryPoint(); } Future _getLatestCronetVersion() async { @@ -129,7 +130,7 @@ void updateImports() { } } -void updateEntryPoint() { +void updateLibraryName() { print('Renaming cronet_http.dart to cronet_http_embedded.dart'); File( '${_packageDirectory.path}/lib/cronet_http.dart',