Skip to content

Commit

Permalink
⬇️ Downgrade minSdkVersion to 21
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 committed Jan 5, 2024
1 parent 473a892 commit 77887a5
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 16 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/cronet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ 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' && 'google_apis' || 'playstore' }}
profile: pixel
Expand Down
4 changes: 4 additions & 0 deletions pkgs/cronet_http/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.1-wip

* Support Android API 21+.

## 1.0.0

* No functional changes.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/cronet_http/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ android {
// - .github/workflows/cronet.yml
// - pkgs/cronet_http/android/build.gradle
// - pkgs/cronet_http/example/android/app/build.gradle
minSdkVersion 28
minSdkVersion 21
}

defaultConfig {
Expand Down
4 changes: 1 addition & 3 deletions pkgs/cronet_http/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ android {

defaultConfig {
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.
// 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
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
2 changes: 1 addition & 1 deletion pkgs/cronet_http/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: cronet_http
version: 1.0.0
version: 1.0.1-wip
description: >-
An Android Flutter plugin that provides access to the Cronet HTTP client.
repository: https://github.com/dart-lang/http/tree/master/pkgs/cronet_http
Expand Down
19 changes: 12 additions & 7 deletions pkgs/cronet_http/tool/prepare_for_embedded.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import 'package:http/http.dart' as http;
import 'package:xml/xml.dart';
import 'package:yaml_edit/yaml_edit.dart';

late final String _scriptName;
late final Directory _packageDirectory;

const _gmsDependencyName = 'com.google.android.gms:play-services-cronet';
Expand All @@ -52,12 +53,14 @@ final implementationRegExp = RegExp(
);

void main(List<String> args) async {
if (Directory.current.path.endsWith('tool')) {
_packageDirectory = Directory.current.parent;
} else {
_packageDirectory = Directory.current;
}

final script = Platform.script.toFilePath();
_scriptName = script.split(Platform.pathSeparator).last;
_packageDirectory = Directory(
Uri.directory(
'${script.replaceAll(_scriptName, '')}'
'..${Platform.pathSeparator}',
).toFilePath(),
);
final latestVersion = await _getLatestCronetVersion();
updateBuildGradle(latestVersion);
updateExampleBuildGradle();
Expand Down Expand Up @@ -137,7 +140,9 @@ void updateReadme() {
void updateImports() {
print('Updating imports in Dart files');
for (final file in _packageDirectory.listSync(recursive: true)) {
if (file is File && file.path.endsWith('.dart')) {
if (file is File &&
file.path.endsWith('.dart') &&
!file.path.contains(_scriptName)) {
final updatedSource = file.readAsStringSync().replaceAll(
'package:cronet_http/cronet_http.dart',
'package:cronet_http_embedded/cronet_http_embedded.dart',
Expand Down

0 comments on commit 77887a5

Please sign in to comment.