From 612f035ab76af383505e7766fbdbf96685b77e36 Mon Sep 17 00:00:00 2001 From: Alexander Troshkov <20989940+aednlaxer@users.noreply.github.com> Date: Fri, 9 May 2025 15:02:20 +0300 Subject: [PATCH 01/12] Send attribution Id to native SDK --- .../google_maps_flutter/example/ios/Podfile | 4 +- .../android/build.gradle | 2 +- .../flutter/plugins/googlemaps/Constants.java | 11 + .../googlemaps/GoogleMapInitializer.java | 8 + .../version_check.yaml | 5 + .../example/ios14/ios/Podfile | 2 +- .../example/ios14/ios/Runner/AppDelegate.m | 4 + .../ios/Classes/FGMConstants.h | 11 + .../ios/google_maps_flutter_ios.podspec | 4 +- .../version_check.yaml | 5 + .../lib/src/constants.dart | 6 + .../version_check.yaml | 5 + .../lib/src/common/repository_package.dart | 4 + .../tool/lib/src/version_check_command.dart | 108 ++++++++ .../tool/test/version_check_command_test.dart | 258 ++++++++++++++++++ 15 files changed, 431 insertions(+), 6 deletions(-) create mode 100644 packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Constants.java create mode 100644 packages/google_maps_flutter/google_maps_flutter_android/version_check.yaml create mode 100644 packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConstants.h create mode 100644 packages/google_maps_flutter/google_maps_flutter_ios/version_check.yaml create mode 100644 packages/google_maps_flutter/google_maps_flutter_web/lib/src/constants.dart create mode 100644 packages/google_maps_flutter/google_maps_flutter_web/version_check.yaml diff --git a/packages/google_maps_flutter/google_maps_flutter/example/ios/Podfile b/packages/google_maps_flutter/google_maps_flutter/example/ios/Podfile index ab60843f560..1226dadd4e7 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/ios/Podfile +++ b/packages/google_maps_flutter/google_maps_flutter/example/ios/Podfile @@ -1,5 +1,5 @@ -# The current iOS implementation only supports back to iOS 14. -platform :ios, '14.0' +# The current iOS implementation only supports back to iOS 15. +platform :ios, '15.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle b/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle index 260a842616c..4af61cefe39 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle @@ -38,7 +38,7 @@ android { dependencies { implementation "androidx.annotation:annotation:1.9.1" implementation 'com.google.android.gms:play-services-maps:18.2.0' - implementation 'com.google.maps.android:android-maps-utils:3.6.0' + implementation 'com.google.maps.android:android-maps-utils:3.13.0' androidTestImplementation 'androidx.test:runner:1.6.2' androidTestImplementation 'androidx.test:rules:1.6.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Constants.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Constants.java new file mode 100644 index 00000000000..8381af31d4d --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Constants.java @@ -0,0 +1,11 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package io.flutter.plugins.googlemaps; + +abstract class Constants { + + // Current package version. + public static final String PREFIX_PLUGIN_VERSION = "2.16.1"; +} diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java index e4bea6b8ffa..30653f112dd 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java @@ -8,13 +8,16 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; +import com.google.android.gms.maps.MapsApiSettings; import com.google.android.gms.maps.MapsInitializer; +import com.google.android.gms.maps.MapsInitializer.Renderer; import com.google.android.gms.maps.OnMapsSdkInitializedCallback; import io.flutter.plugin.common.BinaryMessenger; /** GoogleMaps initializer used to initialize the Google Maps SDK with preferred settings. */ final class GoogleMapInitializer implements OnMapsSdkInitializedCallback, Messages.MapsInitializerApi { + private final Context context; private static Messages.Result initializationResult; private boolean rendererInitialized = false; @@ -59,6 +62,11 @@ public void onMapsSdkInitialized(@NonNull MapsInitializer.Renderer renderer) { if (initializationResult != null) { switch (renderer) { case LATEST: + MapsApiSettings.addInternalUsageAttributionId( + context, + "gmp_flutter_googlemapsflutter_v" + Constants.PREFIX_PLUGIN_VERSION + "_android" + ); + initializationResult.success(Messages.PlatformRendererType.LATEST); break; case LEGACY: diff --git a/packages/google_maps_flutter/google_maps_flutter_android/version_check.yaml b/packages/google_maps_flutter/google_maps_flutter_android/version_check.yaml new file mode 100644 index 00000000000..70c9911ac44 --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter_android/version_check.yaml @@ -0,0 +1,5 @@ +# This file is used to check that the version string in the Constants.java file is up to date and matches +# the version in pubspec.yaml. +filepath: android/src/main/java/io/flutter/plugins/googlemaps/Constants.java +regexp: public static final String PREFIX_PLUGIN_VERSION = "([\.0-9]+)"; +errorMessage: "Version string in Constants.java is not up to date. Please update it to the latest version." diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Podfile b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Podfile index 391330adc7d..37d20e51d60 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Podfile +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -platform :ios, '14.0' +platform :ios, '15.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner/AppDelegate.m b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner/AppDelegate.m index 55733442b4c..8da2260cc2d 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner/AppDelegate.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner/AppDelegate.m @@ -4,6 +4,7 @@ #import "AppDelegate.h" #import "GeneratedPluginRegistrant.h" +#import "FGMConstants.h" @import GoogleMaps; @@ -17,6 +18,9 @@ - (BOOL)application:(UIApplication *)application mapsApiKey = @"YOUR KEY HERE"; } [GMSServices provideAPIKey:mapsApiKey]; + + NSString *attributionId = [NSString stringWithFormat:@"gmp_flutter_googlemapsflutter_v%sandroid", PREFIX_PLUGIN_VERSION]; + [GMSServices addInternalUsageAttributionID:attributionId]; // Register Flutter plugins. [GeneratedPluginRegistrant registerWithRegistry:self]; diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConstants.h b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConstants.h new file mode 100644 index 00000000000..d0dfc5ce7e6 --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConstants.h @@ -0,0 +1,11 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FGMCONSTANTS_H +#define FGMCONSTANTS_H + +// Google Maps Flutter Plugin version +#define PREFIX_PLUGIN_VERSION "2.15.2" + +#endif \ No newline at end of file diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/google_maps_flutter_ios.podspec b/packages/google_maps_flutter/google_maps_flutter_ios/ios/google_maps_flutter_ios.podspec index f744daa6853..0b9dc74a860 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/google_maps_flutter_ios.podspec +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/google_maps_flutter_ios.podspec @@ -24,12 +24,12 @@ Downloaded by pub (not CocoaPods). # broad as possible. # Versions earlier than 8.4 can't be supported because that's the first version # that supports privacy manifests. - s.dependency 'GoogleMaps', '>= 8.4', '< 10.0' + s.dependency 'GoogleMaps', '>= 9.0', '< 10.0' # Google-Maps-iOS-Utils 5.x supports GoogleMaps 8.x and iOS 14.0+ # Google-Maps-iOS-Utils 6.x supports GoogleMaps 9.x and iOS 15.0+ s.dependency 'Google-Maps-iOS-Utils', '>= 5.0', '< 7.0' s.static_framework = true - s.platform = :ios, '14.0' + s.platform = :ios, '15.0' # "Google-Maps-iOS-Utils" is static and contains Swift classes. # Find the Swift runtime when these plugins are built as libraries without `use_frameworks!` s.swift_version = '5.9' diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/version_check.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/version_check.yaml new file mode 100644 index 00000000000..9f6a1deea8d --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter_ios/version_check.yaml @@ -0,0 +1,5 @@ +# This file is used to check that the version string in the FGMConstants.h file is up to date and matches +# the version in pubspec.yaml. +filepath: ios/Classes/FGMConstants.h +regexp: define PREFIX_PLUGIN_VERSION "([\.0-9]+)" +errorMessage: "Version string in FGMConstants.h is not up to date. Please update it to the latest version." diff --git a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/constants.dart b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/constants.dart new file mode 100644 index 00000000000..bb8c6c260a6 --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/constants.dart @@ -0,0 +1,6 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/// Google Maps Flutter Web plugin version. +const String prefixPluginVersion = '0.5.12'; diff --git a/packages/google_maps_flutter/google_maps_flutter_web/version_check.yaml b/packages/google_maps_flutter/google_maps_flutter_web/version_check.yaml new file mode 100644 index 00000000000..ebf865b25ec --- /dev/null +++ b/packages/google_maps_flutter/google_maps_flutter_web/version_check.yaml @@ -0,0 +1,5 @@ +# This file is used to check that the version string in the Constants.dart file is up to date and matches +# the version in pubspec.yaml. +filepath: lib/src/constants.dart +regexp: const String prefixPluginVersion = '([\.0-9]+)'; +errorMessage: "Version string in constants.dart is not up to date. Please update it to the latest version." diff --git a/script/tool/lib/src/common/repository_package.dart b/script/tool/lib/src/common/repository_package.dart index 2a18c2e6e2b..c527421c6e8 100644 --- a/script/tool/lib/src/common/repository_package.dart +++ b/script/tool/lib/src/common/repository_package.dart @@ -74,6 +74,10 @@ class RepositoryPackage { File get prePublishScript => directory.childDirectory('tool').childFile('pre_publish.dart'); + /// The verion_check.yaml file that is used to check the version of + /// the package present in the platform implementation. + File get versionCheckFile => directory.childFile('version_check.yaml'); + /// Returns the directory containing support for [platform]. Directory platformDirectory(FlutterPlatform platform) { late final String directoryName; diff --git a/script/tool/lib/src/version_check_command.dart b/script/tool/lib/src/version_check_command.dart index c3e36bb7087..d601976e7b5 100644 --- a/script/tool/lib/src/version_check_command.dart +++ b/script/tool/lib/src/version_check_command.dart @@ -7,6 +7,7 @@ import 'package:http/http.dart' as http; import 'package:meta/meta.dart'; import 'package:path/path.dart' as p; import 'package:pub_semver/pub_semver.dart'; +import 'package:yaml/yaml.dart'; import 'common/git_version_finder.dart'; import 'common/output_utils.dart'; @@ -223,6 +224,15 @@ class VersionCheckCommand extends PackageLoopingCommand { errors.add('CHANGELOG.md failed validation.'); } + final YamlMap? versionCheckYaml = tryParseVersionCheckYaml(package); + if (!validateVersionCheckYamlVersion( + versionCheckYaml: versionCheckYaml, + pubspec: pubspec, + package: package, + )) { + errors.add('Invalid version_check.yaml.'); + } + // If there are no other issues, make sure that there isn't a missing // change to the version and/or CHANGELOG. if (getBoolArg(_checkForMissingChanges) && @@ -583,4 +593,102 @@ ${indentation}The first version listed in CHANGELOG.md is $fromChangeLog. return null; } + + @visibleForTesting + YamlMap? tryParseVersionCheckYaml(RepositoryPackage package) { + final File versionCheckFile = + package.directory.childFile('version_check.yaml'); + if (!versionCheckFile.existsSync()) { + return null; + } + + try { + final String content = versionCheckFile.readAsStringSync(); + return loadYaml(content) as YamlMap; + } catch (e) { + printError('Invalid version_check.yaml format: $e'); + return null; + } + } + + /// Validates versions using the version_check.yaml file. + /// + /// This checks that the version in the specified file matches the version + /// in the pubspec.yaml file. + /// + /// version_check.yaml should contain: + /// - filepath: The path to the file to check (could be platform-specific, + /// e.g. .java on Android, .h on iOS etc). + /// - regexp: The regex pattern to match the version string. Group 1 of the + /// regex should contain the version string (e.g. 1.0.4). + /// - errorMessage: The error message to display if the version does + /// not match. + /// + /// No validation is performed if the version_check.yaml file does not exist. + /// + /// Returns true if the validation passes, false otherwise. + @visibleForTesting + bool validateVersionCheckYamlVersion({ + required YamlMap? versionCheckYaml, + required Pubspec pubspec, + required RepositoryPackage package, + }) { + // Skip validation if the yaml file doesn't exist. + if (versionCheckYaml == null) { + return true; + } + + final String? filepath = versionCheckYaml['filepath'] as String?; + final String? regex = versionCheckYaml['regexp'] as String?; + final String? errorMessage = versionCheckYaml['errorMessage'] as String?; + + if (filepath == null || filepath.isEmpty) { + printError('Invalid version_check.yaml: Missing filepath.'); + return false; + } + + if (regex == null || regex.isEmpty) { + printError('Invalid version_check.yaml: Missing regexp.'); + return false; + } + + if (errorMessage == null || filepath.isEmpty) { + printError('Invalid version_check.yaml: Missing errorMessage.'); + return false; + } + + final File targetFile = package.directory.childFile(filepath); + if (!targetFile.existsSync()) { + printError( + 'File "$filepath" specified in version_check.yaml does not exist.', + ); + return false; + } + + if (!targetFile.absolute.path.startsWith(package.directory.path)) { + printError( + 'File path "$filepath" in version_check.yaml targets outside the package directory.', + ); + return false; + } + + final RegExp versionRegex = RegExp(regex); + final String fileContent = targetFile.readAsStringSync(); + final Match? match = versionRegex.firstMatch(fileContent); + + if (match == null || match.groupCount < 1) { + printError( + 'No version string found in "$filepath" using the provided regex.', + ); + return false; + } + + final String foundVersion = match.group(1)!; + if (foundVersion != pubspec.version.toString()) { + printError(errorMessage); + return false; + } + + return true; + } } diff --git a/script/tool/test/version_check_command_test.dart b/script/tool/test/version_check_command_test.dart index a2e04bd710e..9485e2a6a9a 100644 --- a/script/tool/test/version_check_command_test.dart +++ b/script/tool/test/version_check_command_test.dart @@ -1552,6 +1552,264 @@ ${indentation}HTTP response: null ])); }); }); + + group('validateVersionCheckYamlVersion', () { + test('validation passes if version_check.yaml is not present', () { + final RepositoryPackage plugin = + createFakePlugin('plugin', packagesDir, version: '1.0.0'); + final VersionCheckCommand command = + runner.commands['version-check']! as VersionCheckCommand; + expect(plugin.versionCheckFile.existsSync(), isFalse); + + final bool result = command.validateVersionCheckYamlVersion( + versionCheckYaml: null, + pubspec: Pubspec('name'), + package: plugin, + ); + expect(result, isTrue); + }); + }); + + test('validation failed when filepath is not present', () async { + final RepositoryPackage plugin = + createFakePlugin('plugin', packagesDir, version: '1.0.0'); + expect(plugin.versionCheckFile.existsSync(), isFalse); + plugin.versionCheckFile.createSync(); + plugin.versionCheckFile.writeAsStringSync(r''' +regexp: const prefixPluginVersion = "([\.0-9]+)" +errorMessage: "Version string is not up to date." +'''); + + bool hasError = false; + final List log = await runCapturingPrint( + runner, + ['version-check'], + errorHandler: (Error e) { + expect(e, isA()); + hasError = true; + }, + ); + expect(hasError, isTrue); + expect( + log.contains('Invalid version_check.yaml: Missing filepath.'), + isTrue, + ); + }); + + test( + 'validation failed when regexp is not present', + () async { + final RepositoryPackage plugin = + createFakePlugin('plugin', packagesDir, version: '1.0.0'); + expect(plugin.versionCheckFile.existsSync(), isFalse); + plugin.versionCheckFile.createSync(); + plugin.versionCheckFile.writeAsStringSync(r''' +filepath: constants.dart +errorMessage: "Version string is not up to date." +'''); + + bool hasError = false; + final List log = await runCapturingPrint( + runner, + ['version-check'], + errorHandler: (Error e) { + expect(e, isA()); + hasError = true; + }, + ); + expect(hasError, isTrue); + expect( + log.contains('Invalid version_check.yaml: Missing regexp.'), + isTrue, + ); + }, + ); + + test('validation failed when errorMessage is not present', () async { + final RepositoryPackage plugin = + createFakePlugin('plugin', packagesDir, version: '1.0.0'); + expect(plugin.versionCheckFile.existsSync(), isFalse); + plugin.versionCheckFile.createSync(); + plugin.versionCheckFile.writeAsStringSync(r''' +filepath: constants.dart +regexp: const prefixPluginVersion = "([\.0-9]+)" +'''); + + bool hasError = false; + final List log = await runCapturingPrint( + runner, + ['version-check'], + errorHandler: (Error e) { + expect(e, isA()); + hasError = true; + }, + ); + expect(hasError, isTrue); + expect( + log.contains('Invalid version_check.yaml: Missing errorMessage.'), + isTrue, + ); + }); + + test("validation fails when file doesn't exist", () async { + final RepositoryPackage plugin = + createFakePlugin('plugin', packagesDir, version: '1.0.0'); + expect(plugin.versionCheckFile.existsSync(), isFalse); + plugin.versionCheckFile.createSync(); + plugin.versionCheckFile.writeAsStringSync(r''' +filepath: constants.dart +regexp: const prefixPluginVersion = "([\.0-9]+)" +errorMessage: "Version string is not up to date." +'''); + + bool hasError = false; + final List log = await runCapturingPrint( + runner, + ['version-check'], + errorHandler: (Error e) { + expect(e, isA()); + hasError = true; + }, + ); + expect(hasError, isTrue); + expect( + log.contains( + 'File "constants.dart" specified in version_check.yaml does not exist.', + ), + isTrue, + ); + }); + + test('validation fails file is outside the package direcry', () async { + final RepositoryPackage plugin = + createFakePlugin('plugin', packagesDir, version: '1.0.0'); + expect(plugin.versionCheckFile.existsSync(), isFalse); + plugin.versionCheckFile.createSync(); + plugin.versionCheckFile.writeAsStringSync(r''' +filepath: /home/user/constants.dart +regexp: const prefixPluginVersion = "([\.0-9]+)" +errorMessage: "Version string is not up to date." +'''); + + final File constantsFile = + plugin.directory.fileSystem.file('/home/user/constants.dart'); + constantsFile.createSync(recursive: true); + expect(constantsFile.existsSync(), isTrue); + constantsFile.writeAsStringSync('const prefixPluginVersion = "0.1.0";'); + + bool hasError = false; + final List log = await runCapturingPrint( + runner, + ['version-check'], + errorHandler: (Error e) { + expect(e, isA()); + hasError = true; + }, + ); + expect(hasError, isTrue); + expect( + log.contains( + 'File path "/home/user/constants.dart" in version_check.yaml targets outside the package directory.', + ), + isTrue, + ); + }); + + test('validation fails when no text matching regex found', () async { + final RepositoryPackage plugin = + createFakePlugin('plugin', packagesDir, version: '1.0.0'); + expect(plugin.versionCheckFile.existsSync(), isFalse); + plugin.versionCheckFile.createSync(); + plugin.versionCheckFile.writeAsStringSync(r''' +filepath: lib/constants.dart +regexp: const prefixPluginVersion = "([\.0-9]+)" +errorMessage: "Version string is not up to date." +'''); + + final File constantsFile = + plugin.directory.childFile('lib/constants.dart'); + constantsFile.createSync(recursive: true); + expect(constantsFile.existsSync(), isTrue); + constantsFile.writeAsStringSync(''' +const String version = "0.1.0"; +'''); + + bool hasError = false; + final List log = await runCapturingPrint( + runner, + ['version-check'], + errorHandler: (Error e) { + expect(e, isA()); + hasError = true; + }, + ); + expect(hasError, isTrue); + expect( + log.contains( + 'No version string found in "lib/constants.dart" using the provided regex.', + ), + isTrue, + ); + }); + + test('validation fails on versions mismatch', () async { + final RepositoryPackage plugin = + createFakePlugin('plugin', packagesDir, version: '1.0.0'); + expect(plugin.versionCheckFile.existsSync(), isFalse); + plugin.versionCheckFile.createSync(); + plugin.versionCheckFile.writeAsStringSync(r''' +filepath: lib/constants.dart +regexp: const prefixPluginVersion = "([\.0-9]+)" +errorMessage: "Version string is not up to date." +'''); + + final File constantsFile = + plugin.directory.childFile('lib/constants.dart'); + constantsFile.createSync(recursive: true); + expect(constantsFile.existsSync(), isTrue); + constantsFile.writeAsStringSync('const prefixPluginVersion = "0.1.0";'); + + bool hasError = false; + final List log = await runCapturingPrint( + runner, + ['version-check'], + errorHandler: (Error e) { + expect(e, isA()); + hasError = true; + }, + ); + expect(hasError, isTrue); + expect(log.contains('Version string is not up to date.'), isTrue); + }); + + test('validation passes on no version mismatch', () async { + final RepositoryPackage plugin = + createFakePlugin('plugin', packagesDir, version: '1.0.0'); + expect(plugin.versionCheckFile.existsSync(), isFalse); + plugin.versionCheckFile.createSync(); + plugin.versionCheckFile.writeAsStringSync(r''' +filepath: lib/constants.dart +regexp: const prefixPluginVersion = "([\.0-9]+)" +errorMessage: "Version string is not up to date." +'''); + + final File constantsFile = + plugin.directory.childFile('lib/constants.dart'); + constantsFile.createSync(recursive: true); + expect(constantsFile.existsSync(), isTrue); + constantsFile.writeAsStringSync('const prefixPluginVersion = "1.0.0";'); + + bool hasError = false; + await runCapturingPrint( + runner, + ['version-check'], + errorHandler: (Error e) { + expect(e, isA()); + hasError = true; + }, + ); + expect(hasError, isFalse); + }); }); group('Pre 1.0', () { From b9d1dc7d72a6ed3535c54708f9962ea2cdcb1776 Mon Sep 17 00:00:00 2001 From: Alexander Troshkov <20989940+aednlaxer@users.noreply.github.com> Date: Mon, 12 May 2025 10:09:57 +0300 Subject: [PATCH 02/12] Rename constant and add licence header --- .../main/java/io/flutter/plugins/googlemaps/Constants.java | 2 +- .../io/flutter/plugins/googlemaps/GoogleMapInitializer.java | 2 +- .../google_maps_flutter_android/version_check.yaml | 6 +++++- .../example/ios14/ios/Runner/AppDelegate.m | 2 +- .../google_maps_flutter_ios/ios/Classes/FGMConstants.h | 2 +- .../google_maps_flutter_ios/version_check.yaml | 6 +++++- .../google_maps_flutter_web/version_check.yaml | 4 ++++ 7 files changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Constants.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Constants.java index 8381af31d4d..6f6136c1847 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Constants.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Constants.java @@ -7,5 +7,5 @@ abstract class Constants { // Current package version. - public static final String PREFIX_PLUGIN_VERSION = "2.16.1"; + public static final String FGM_PLUGIN_VERSION = "2.16.1"; } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java index 30653f112dd..f5478ed1223 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java @@ -64,7 +64,7 @@ public void onMapsSdkInitialized(@NonNull MapsInitializer.Renderer renderer) { case LATEST: MapsApiSettings.addInternalUsageAttributionId( context, - "gmp_flutter_googlemapsflutter_v" + Constants.PREFIX_PLUGIN_VERSION + "_android" + "gmp_flutter_googlemapsflutter_v" + Constants.FGM_PLUGIN_VERSION + "_android" ); initializationResult.success(Messages.PlatformRendererType.LATEST); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/version_check.yaml b/packages/google_maps_flutter/google_maps_flutter_android/version_check.yaml index 70c9911ac44..2b78d079a85 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/version_check.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_android/version_check.yaml @@ -1,5 +1,9 @@ +# Copyright 2013 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + # This file is used to check that the version string in the Constants.java file is up to date and matches # the version in pubspec.yaml. filepath: android/src/main/java/io/flutter/plugins/googlemaps/Constants.java -regexp: public static final String PREFIX_PLUGIN_VERSION = "([\.0-9]+)"; +regexp: public static final String FGM_PLUGIN_VERSION = "([\.0-9]+)"; errorMessage: "Version string in Constants.java is not up to date. Please update it to the latest version." diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner/AppDelegate.m b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner/AppDelegate.m index 8da2260cc2d..4778b18cdef 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner/AppDelegate.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner/AppDelegate.m @@ -19,7 +19,7 @@ - (BOOL)application:(UIApplication *)application } [GMSServices provideAPIKey:mapsApiKey]; - NSString *attributionId = [NSString stringWithFormat:@"gmp_flutter_googlemapsflutter_v%sandroid", PREFIX_PLUGIN_VERSION]; + NSString *attributionId = [NSString stringWithFormat:@"gmp_flutter_googlemapsflutter_v%sandroid", FGM_PLUGIN_VERSION]; [GMSServices addInternalUsageAttributionID:attributionId]; // Register Flutter plugins. diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConstants.h b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConstants.h index d0dfc5ce7e6..55f225bd779 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConstants.h +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConstants.h @@ -6,6 +6,6 @@ #define FGMCONSTANTS_H // Google Maps Flutter Plugin version -#define PREFIX_PLUGIN_VERSION "2.15.2" +#define FGM_PLUGIN_VERSION "2.15.2" #endif \ No newline at end of file diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/version_check.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/version_check.yaml index 9f6a1deea8d..cca2356ce66 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/version_check.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/version_check.yaml @@ -1,5 +1,9 @@ +# Copyright 2013 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + # This file is used to check that the version string in the FGMConstants.h file is up to date and matches # the version in pubspec.yaml. filepath: ios/Classes/FGMConstants.h -regexp: define PREFIX_PLUGIN_VERSION "([\.0-9]+)" +regexp: define FGM_PLUGIN_VERSION "([\.0-9]+)" errorMessage: "Version string in FGMConstants.h is not up to date. Please update it to the latest version." diff --git a/packages/google_maps_flutter/google_maps_flutter_web/version_check.yaml b/packages/google_maps_flutter/google_maps_flutter_web/version_check.yaml index ebf865b25ec..7fd17505358 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/version_check.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_web/version_check.yaml @@ -1,3 +1,7 @@ +# Copyright 2013 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + # This file is used to check that the version string in the Constants.dart file is up to date and matches # the version in pubspec.yaml. filepath: lib/src/constants.dart From 21b31b5cdf11ef7072ed6bc68e606587050d5779 Mon Sep 17 00:00:00 2001 From: Alexander Troshkov <20989940+aednlaxer@users.noreply.github.com> Date: Mon, 12 May 2025 10:59:47 +0300 Subject: [PATCH 03/12] Add support for multiple checks --- .../version_check.yaml | 7 +- .../version_check.yaml | 9 +- .../version_check.yaml | 9 +- .../tool/lib/src/version_check_command.dart | 107 +++++++++------- .../tool/test/version_check_command_test.dart | 120 +++++++++++++++--- 5 files changed, 176 insertions(+), 76 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter_android/version_check.yaml b/packages/google_maps_flutter/google_maps_flutter_android/version_check.yaml index 2b78d079a85..c87e6aa36b1 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/version_check.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_android/version_check.yaml @@ -4,6 +4,7 @@ # This file is used to check that the version string in the Constants.java file is up to date and matches # the version in pubspec.yaml. -filepath: android/src/main/java/io/flutter/plugins/googlemaps/Constants.java -regexp: public static final String FGM_PLUGIN_VERSION = "([\.0-9]+)"; -errorMessage: "Version string in Constants.java is not up to date. Please update it to the latest version." +checks: + - filepath: android/src/main/java/io/flutter/plugins/googlemaps/Constants.java + regexp: public static final String FGM_PLUGIN_VERSION = "([\.0-9]+)"; + errorMessage: "Version string in Constants.java is not up to date. Please update it to the latest version." diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/version_check.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/version_check.yaml index cca2356ce66..54fd0873705 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/version_check.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/version_check.yaml @@ -2,8 +2,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# This file is used to check that the version string in the FGMConstants.h file is up to date and matches +# This file is used to check that the version string in the FGMConstants.h file is up to date and matches # the version in pubspec.yaml. -filepath: ios/Classes/FGMConstants.h -regexp: define FGM_PLUGIN_VERSION "([\.0-9]+)" -errorMessage: "Version string in FGMConstants.h is not up to date. Please update it to the latest version." +checks: + - filepath: ios/Classes/FGMConstants.h + regexp: define FGM_PLUGIN_VERSION "([\.0-9]+)" + errorMessage: "Version string in FGMConstants.h is not up to date. Please update it to the latest version." diff --git a/packages/google_maps_flutter/google_maps_flutter_web/version_check.yaml b/packages/google_maps_flutter/google_maps_flutter_web/version_check.yaml index 7fd17505358..020fd614cdd 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/version_check.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_web/version_check.yaml @@ -2,8 +2,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# This file is used to check that the version string in the Constants.dart file is up to date and matches +# This file is used to check that the version string in the Constants.dart file is up to date and matches # the version in pubspec.yaml. -filepath: lib/src/constants.dart -regexp: const String prefixPluginVersion = '([\.0-9]+)'; -errorMessage: "Version string in constants.dart is not up to date. Please update it to the latest version." +checks: + - filepath: lib/src/constants.dart + regexp: const String prefixPluginVersion = '([\.0-9]+)'; + errorMessage: "Version string in constants.dart is not up to date. Please update it to the latest version." diff --git a/script/tool/lib/src/version_check_command.dart b/script/tool/lib/src/version_check_command.dart index d601976e7b5..d1549c6a608 100644 --- a/script/tool/lib/src/version_check_command.dart +++ b/script/tool/lib/src/version_check_command.dart @@ -596,8 +596,9 @@ ${indentation}The first version listed in CHANGELOG.md is $fromChangeLog. @visibleForTesting YamlMap? tryParseVersionCheckYaml(RepositoryPackage package) { - final File versionCheckFile = - package.directory.childFile('version_check.yaml'); + final File versionCheckFile = package.directory.childFile( + 'version_check.yaml', + ); if (!versionCheckFile.existsSync()) { return null; } @@ -616,7 +617,8 @@ ${indentation}The first version listed in CHANGELOG.md is $fromChangeLog. /// This checks that the version in the specified file matches the version /// in the pubspec.yaml file. /// - /// version_check.yaml should contain: + /// version_check.yaml should contain a list of checks, each with the + /// following fields: /// - filepath: The path to the file to check (could be platform-specific, /// e.g. .java on Android, .h on iOS etc). /// - regexp: The regex pattern to match the version string. Group 1 of the @@ -638,57 +640,74 @@ ${indentation}The first version listed in CHANGELOG.md is $fromChangeLog. return true; } - final String? filepath = versionCheckYaml['filepath'] as String?; - final String? regex = versionCheckYaml['regexp'] as String?; - final String? errorMessage = versionCheckYaml['errorMessage'] as String?; - - if (filepath == null || filepath.isEmpty) { - printError('Invalid version_check.yaml: Missing filepath.'); + final YamlList? checks = versionCheckYaml['checks'] as YamlList?; + if (checks == null) { + printError('Invalid version_check.yaml: Missing checks.'); return false; } - if (regex == null || regex.isEmpty) { - printError('Invalid version_check.yaml: Missing regexp.'); - return false; - } + bool result = true; + for (final YamlNode entry in checks.nodes) { + final YamlMap node = entry as YamlMap; + final String? filepath = node['filepath'] as String?; + final String? regex = node['regexp'] as String?; + final String? errorMessage = node['errorMessage'] as String?; - if (errorMessage == null || filepath.isEmpty) { - printError('Invalid version_check.yaml: Missing errorMessage.'); - return false; - } + if (filepath == null || filepath.isEmpty) { + printError('Invalid version_check.yaml: Missing filepath.'); + result = false; + continue; + } - final File targetFile = package.directory.childFile(filepath); - if (!targetFile.existsSync()) { - printError( - 'File "$filepath" specified in version_check.yaml does not exist.', - ); - return false; - } + if (regex == null || regex.isEmpty) { + printError('Invalid version_check.yaml: Missing regexp.'); + result = false; + continue; + } - if (!targetFile.absolute.path.startsWith(package.directory.path)) { - printError( - 'File path "$filepath" in version_check.yaml targets outside the package directory.', - ); - return false; - } + if (errorMessage == null || filepath.isEmpty) { + printError('Invalid version_check.yaml: Missing errorMessage.'); + result = false; + continue; + } - final RegExp versionRegex = RegExp(regex); - final String fileContent = targetFile.readAsStringSync(); - final Match? match = versionRegex.firstMatch(fileContent); + final File targetFile = package.directory.childFile(filepath); + if (!targetFile.existsSync()) { + printError( + 'File "$filepath" specified in version_check.yaml does not exist.', + ); + result = false; + continue; + } - if (match == null || match.groupCount < 1) { - printError( - 'No version string found in "$filepath" using the provided regex.', - ); - return false; - } + if (!targetFile.absolute.path.startsWith(package.directory.path)) { + printError( + 'File path "$filepath" in version_check.yaml targets outside the package directory.', + ); + result = false; + continue; + } - final String foundVersion = match.group(1)!; - if (foundVersion != pubspec.version.toString()) { - printError(errorMessage); - return false; + final RegExp versionRegex = RegExp(regex); + final String fileContent = targetFile.readAsStringSync(); + final Match? match = versionRegex.firstMatch(fileContent); + + if (match == null || match.groupCount < 1) { + printError( + 'No version string found in "$filepath" using the provided regex.', + ); + result = false; + continue; + } + + final String foundVersion = match.group(1)!; + if (foundVersion != pubspec.version.toString()) { + printError(errorMessage); + result = false; + continue; + } } - return true; + return result; } } diff --git a/script/tool/test/version_check_command_test.dart b/script/tool/test/version_check_command_test.dart index 9485e2a6a9a..d9d0d1cf5f7 100644 --- a/script/tool/test/version_check_command_test.dart +++ b/script/tool/test/version_check_command_test.dart @@ -1576,8 +1576,9 @@ ${indentation}HTTP response: null expect(plugin.versionCheckFile.existsSync(), isFalse); plugin.versionCheckFile.createSync(); plugin.versionCheckFile.writeAsStringSync(r''' -regexp: const prefixPluginVersion = "([\.0-9]+)" -errorMessage: "Version string is not up to date." +checks: + - regexp: const prefixPluginVersion = "([\.0-9]+)" + errorMessage: "Version string is not up to date." '''); bool hasError = false; @@ -1604,8 +1605,9 @@ errorMessage: "Version string is not up to date." expect(plugin.versionCheckFile.existsSync(), isFalse); plugin.versionCheckFile.createSync(); plugin.versionCheckFile.writeAsStringSync(r''' -filepath: constants.dart -errorMessage: "Version string is not up to date." +checks: + - filepath: constants.dart + errorMessage: "Version string is not up to date." '''); bool hasError = false; @@ -1631,8 +1633,9 @@ errorMessage: "Version string is not up to date." expect(plugin.versionCheckFile.existsSync(), isFalse); plugin.versionCheckFile.createSync(); plugin.versionCheckFile.writeAsStringSync(r''' -filepath: constants.dart -regexp: const prefixPluginVersion = "([\.0-9]+)" +checks: + - filepath: constants.dart + regexp: const prefixPluginVersion = "([\.0-9]+)" '''); bool hasError = false; @@ -1657,9 +1660,10 @@ regexp: const prefixPluginVersion = "([\.0-9]+)" expect(plugin.versionCheckFile.existsSync(), isFalse); plugin.versionCheckFile.createSync(); plugin.versionCheckFile.writeAsStringSync(r''' -filepath: constants.dart -regexp: const prefixPluginVersion = "([\.0-9]+)" -errorMessage: "Version string is not up to date." +checks: + - filepath: constants.dart + regexp: const prefixPluginVersion = "([\.0-9]+)" + errorMessage: "Version string is not up to date." '''); bool hasError = false; @@ -1686,9 +1690,10 @@ errorMessage: "Version string is not up to date." expect(plugin.versionCheckFile.existsSync(), isFalse); plugin.versionCheckFile.createSync(); plugin.versionCheckFile.writeAsStringSync(r''' -filepath: /home/user/constants.dart -regexp: const prefixPluginVersion = "([\.0-9]+)" -errorMessage: "Version string is not up to date." +checks: + - filepath: /home/user/constants.dart + regexp: const prefixPluginVersion = "([\.0-9]+)" + errorMessage: "Version string is not up to date." '''); final File constantsFile = @@ -1721,9 +1726,10 @@ errorMessage: "Version string is not up to date." expect(plugin.versionCheckFile.existsSync(), isFalse); plugin.versionCheckFile.createSync(); plugin.versionCheckFile.writeAsStringSync(r''' -filepath: lib/constants.dart -regexp: const prefixPluginVersion = "([\.0-9]+)" -errorMessage: "Version string is not up to date." +checks: + - filepath: lib/constants.dart + regexp: const prefixPluginVersion = "([\.0-9]+)" + errorMessage: "Version string is not up to date." '''); final File constantsFile = @@ -1752,15 +1758,44 @@ const String version = "0.1.0"; ); }); + test('Validation fails when "checks" item is not present', () async { + final RepositoryPackage plugin = + createFakePlugin('plugin', packagesDir, version: '1.0.0'); + expect(plugin.versionCheckFile.existsSync(), isFalse); + plugin.versionCheckFile.createSync(); + plugin.versionCheckFile.writeAsStringSync(r''' +definitely_not_checks: + - filepath: lib/constants.dart + regexp: const prefixPluginVersion = "([\.0-9]+)" + errorMessage: "Version string is not up to date." +'''); + + bool hasError = false; + final List log = await runCapturingPrint( + runner, + ['version-check'], + errorHandler: (Error e) { + expect(e, isA()); + hasError = true; + }, + ); + expect(hasError, isTrue); + expect( + log.contains('Invalid version_check.yaml: Missing checks.'), + isTrue, + ); + }); + test('validation fails on versions mismatch', () async { final RepositoryPackage plugin = createFakePlugin('plugin', packagesDir, version: '1.0.0'); expect(plugin.versionCheckFile.existsSync(), isFalse); plugin.versionCheckFile.createSync(); plugin.versionCheckFile.writeAsStringSync(r''' -filepath: lib/constants.dart -regexp: const prefixPluginVersion = "([\.0-9]+)" -errorMessage: "Version string is not up to date." +checks: + - filepath: lib/constants.dart + regexp: const prefixPluginVersion = "([\.0-9]+)" + errorMessage: "Version string is not up to date." '''); final File constantsFile = @@ -1782,15 +1817,58 @@ errorMessage: "Version string is not up to date." expect(log.contains('Version string is not up to date.'), isTrue); }); + test('Validation fails when one of the checks fails', () async { + final RepositoryPackage plugin = + createFakePlugin('plugin', packagesDir, version: '1.0.0'); + expect(plugin.versionCheckFile.existsSync(), isFalse); + plugin.versionCheckFile.createSync(); + plugin.versionCheckFile.writeAsStringSync(r''' +checks: + - filepath: lib/constants.dart + regexp: const prefixPluginVersion = "([\.0-9]+)" + errorMessage: "Version string is not up to date." + - filepath: lib/another_constants.dart + regexp: const prefixPluginVersion = "([\.0-9]+)" + errorMessage: "Version string is not up to date 2." +'''); + + final File constantsFile = + plugin.directory.childFile('lib/constants.dart'); + constantsFile.createSync(recursive: true); + expect(constantsFile.existsSync(), isTrue); + constantsFile.writeAsStringSync('const prefixPluginVersion = "1.0.0";'); + + final File anotherConstantsFile = + plugin.directory.childFile('lib/another_constants.dart'); + anotherConstantsFile.createSync(recursive: true); + expect(anotherConstantsFile.existsSync(), isTrue); + anotherConstantsFile + .writeAsStringSync('const prefixPluginVersion = "0.2.0";'); + + bool hasError = false; + final List log = await runCapturingPrint( + runner, + ['version-check'], + errorHandler: (Error e) { + expect(e, isA()); + hasError = true; + }, + ); + expect(hasError, isTrue); + expect(log.contains('Version string is not up to date.'), isFalse); + expect(log.contains('Version string is not up to date 2.'), isTrue); + }); + test('validation passes on no version mismatch', () async { final RepositoryPackage plugin = createFakePlugin('plugin', packagesDir, version: '1.0.0'); expect(plugin.versionCheckFile.existsSync(), isFalse); plugin.versionCheckFile.createSync(); plugin.versionCheckFile.writeAsStringSync(r''' -filepath: lib/constants.dart -regexp: const prefixPluginVersion = "([\.0-9]+)" -errorMessage: "Version string is not up to date." +checks: + - filepath: lib/constants.dart + regexp: const prefixPluginVersion = "([\.0-9]+)" + errorMessage: "Version string is not up to date." '''); final File constantsFile = From 96dfe4f19a7fd7d07607fdd9332bec9ee5e41c88 Mon Sep 17 00:00:00 2001 From: Alexander Troshkov <20989940+aednlaxer@users.noreply.github.com> Date: Mon, 12 May 2025 11:09:04 +0300 Subject: [PATCH 04/12] Show more descriptive version mismatch message --- .../tool/lib/src/version_check_command.dart | 5 ++++- .../tool/test/version_check_command_test.dart | 22 +++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/script/tool/lib/src/version_check_command.dart b/script/tool/lib/src/version_check_command.dart index d1549c6a608..f752b049513 100644 --- a/script/tool/lib/src/version_check_command.dart +++ b/script/tool/lib/src/version_check_command.dart @@ -702,7 +702,10 @@ ${indentation}The first version listed in CHANGELOG.md is $fromChangeLog. final String foundVersion = match.group(1)!; if (foundVersion != pubspec.version.toString()) { - printError(errorMessage); + printError('Version mismatch in "$filepath":\n' + 'Expected: ${pubspec.version}\n' + 'Found: $foundVersion\n' + 'Error message: $errorMessage'); result = false; continue; } diff --git a/script/tool/test/version_check_command_test.dart b/script/tool/test/version_check_command_test.dart index d9d0d1cf5f7..938b0d25c90 100644 --- a/script/tool/test/version_check_command_test.dart +++ b/script/tool/test/version_check_command_test.dart @@ -1814,7 +1814,16 @@ checks: }, ); expect(hasError, isTrue); - expect(log.contains('Version string is not up to date.'), isTrue); + expect( + log.contains( + ''' +Version mismatch in "lib/constants.dart": +Expected: 1.0.0 +Found: 0.1.0 +Error message: Version string is not up to date.''', + ), + isTrue, + ); }); test('Validation fails when one of the checks fails', () async { @@ -1856,7 +1865,16 @@ checks: ); expect(hasError, isTrue); expect(log.contains('Version string is not up to date.'), isFalse); - expect(log.contains('Version string is not up to date 2.'), isTrue); + expect( + log.contains( + ''' +Version mismatch in "lib/another_constants.dart": +Expected: 1.0.0 +Found: 0.2.0 +Error message: Version string is not up to date 2.''', + ), + isTrue, + ); }); test('validation passes on no version mismatch', () async { From 86c3abbcc907d639daedae9c9139003980c69ee5 Mon Sep 17 00:00:00 2001 From: Alexander Troshkov <20989940+aednlaxer@users.noreply.github.com> Date: Mon, 12 May 2025 11:17:40 +0300 Subject: [PATCH 05/12] Pass pubspec version to validateVersionCheckYamlVersion --- script/tool/lib/src/version_check_command.dart | 10 +++++----- script/tool/test/version_check_command_test.dart | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/script/tool/lib/src/version_check_command.dart b/script/tool/lib/src/version_check_command.dart index f752b049513..c21c01341f4 100644 --- a/script/tool/lib/src/version_check_command.dart +++ b/script/tool/lib/src/version_check_command.dart @@ -227,7 +227,7 @@ class VersionCheckCommand extends PackageLoopingCommand { final YamlMap? versionCheckYaml = tryParseVersionCheckYaml(package); if (!validateVersionCheckYamlVersion( versionCheckYaml: versionCheckYaml, - pubspec: pubspec, + version: pubspec.version, package: package, )) { errors.add('Invalid version_check.yaml.'); @@ -632,11 +632,11 @@ ${indentation}The first version listed in CHANGELOG.md is $fromChangeLog. @visibleForTesting bool validateVersionCheckYamlVersion({ required YamlMap? versionCheckYaml, - required Pubspec pubspec, + required Version? version, required RepositoryPackage package, }) { // Skip validation if the yaml file doesn't exist. - if (versionCheckYaml == null) { + if (versionCheckYaml == null || version == null) { return true; } @@ -701,9 +701,9 @@ ${indentation}The first version listed in CHANGELOG.md is $fromChangeLog. } final String foundVersion = match.group(1)!; - if (foundVersion != pubspec.version.toString()) { + if (foundVersion != version.toString()) { printError('Version mismatch in "$filepath":\n' - 'Expected: ${pubspec.version}\n' + 'Expected: $version\n' 'Found: $foundVersion\n' 'Error message: $errorMessage'); result = false; diff --git a/script/tool/test/version_check_command_test.dart b/script/tool/test/version_check_command_test.dart index 938b0d25c90..d4e9c181cd2 100644 --- a/script/tool/test/version_check_command_test.dart +++ b/script/tool/test/version_check_command_test.dart @@ -1563,7 +1563,7 @@ ${indentation}HTTP response: null final bool result = command.validateVersionCheckYamlVersion( versionCheckYaml: null, - pubspec: Pubspec('name'), + version: Version.parse('1.0.0'), package: plugin, ); expect(result, isTrue); From 7572cbef7569fcfc2657179ec7f5727c969cf701 Mon Sep 17 00:00:00 2001 From: Alexander Troshkov <20989940+aednlaxer@users.noreply.github.com> Date: Mon, 12 May 2025 12:40:19 +0300 Subject: [PATCH 06/12] Rename prefixPluginVersion to fgmPluginVersion --- .../google_maps_flutter_web/lib/src/constants.dart | 2 +- .../google_maps_flutter_web/version_check.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/constants.dart b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/constants.dart index bb8c6c260a6..33152f12f23 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/lib/src/constants.dart +++ b/packages/google_maps_flutter/google_maps_flutter_web/lib/src/constants.dart @@ -3,4 +3,4 @@ // found in the LICENSE file. /// Google Maps Flutter Web plugin version. -const String prefixPluginVersion = '0.5.12'; +const String fgmPluginVersion = '0.5.12'; diff --git a/packages/google_maps_flutter/google_maps_flutter_web/version_check.yaml b/packages/google_maps_flutter/google_maps_flutter_web/version_check.yaml index 020fd614cdd..1184b1f3de1 100644 --- a/packages/google_maps_flutter/google_maps_flutter_web/version_check.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_web/version_check.yaml @@ -6,5 +6,5 @@ # the version in pubspec.yaml. checks: - filepath: lib/src/constants.dart - regexp: const String prefixPluginVersion = '([\.0-9]+)'; + regexp: const String fgmPluginVersion = '([\.0-9]+)'; errorMessage: "Version string in constants.dart is not up to date. Please update it to the latest version." From 83eab5cc1e883cbe174008c79887be311fe43f9c Mon Sep 17 00:00:00 2001 From: Alexander Troshkov <20989940+aednlaxer@users.noreply.github.com> Date: Mon, 12 May 2025 13:27:57 +0300 Subject: [PATCH 07/12] Revert iOS version bump --- .../google_maps_flutter/example/ios/Podfile | 4 ++-- .../google_maps_flutter_ios/example/ios14/ios/Podfile | 2 +- .../ios/google_maps_flutter_ios.podspec | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/example/ios/Podfile b/packages/google_maps_flutter/google_maps_flutter/example/ios/Podfile index 1226dadd4e7..ab60843f560 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/ios/Podfile +++ b/packages/google_maps_flutter/google_maps_flutter/example/ios/Podfile @@ -1,5 +1,5 @@ -# The current iOS implementation only supports back to iOS 15. -platform :ios, '15.0' +# The current iOS implementation only supports back to iOS 14. +platform :ios, '14.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Podfile b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Podfile index 37d20e51d60..391330adc7d 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Podfile +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -platform :ios, '15.0' +platform :ios, '14.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/google_maps_flutter_ios.podspec b/packages/google_maps_flutter/google_maps_flutter_ios/ios/google_maps_flutter_ios.podspec index 0b9dc74a860..717a1026acc 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/google_maps_flutter_ios.podspec +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/google_maps_flutter_ios.podspec @@ -29,7 +29,7 @@ Downloaded by pub (not CocoaPods). # Google-Maps-iOS-Utils 6.x supports GoogleMaps 9.x and iOS 15.0+ s.dependency 'Google-Maps-iOS-Utils', '>= 5.0', '< 7.0' s.static_framework = true - s.platform = :ios, '15.0' + s.platform = :ios, '14.0' # "Google-Maps-iOS-Utils" is static and contains Swift classes. # Find the Swift runtime when these plugins are built as libraries without `use_frameworks!` s.swift_version = '5.9' From be2d1188175359e6670ddd3f0061387e6dce6344 Mon Sep 17 00:00:00 2001 From: Alexander Troshkov <20989940+aednlaxer@users.noreply.github.com> Date: Mon, 12 May 2025 14:45:05 +0300 Subject: [PATCH 08/12] Use selector to set attribution Id (iOS) --- .../example/ios14/ios/Runner/AppDelegate.m | 4 ---- .../ios/Classes/FLTGoogleMapsPlugin.m | 10 ++++++++++ .../ios/google_maps_flutter_ios.podspec | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner/AppDelegate.m b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner/AppDelegate.m index 4778b18cdef..55733442b4c 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner/AppDelegate.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner/AppDelegate.m @@ -4,7 +4,6 @@ #import "AppDelegate.h" #import "GeneratedPluginRegistrant.h" -#import "FGMConstants.h" @import GoogleMaps; @@ -18,9 +17,6 @@ - (BOOL)application:(UIApplication *)application mapsApiKey = @"YOUR KEY HERE"; } [GMSServices provideAPIKey:mapsApiKey]; - - NSString *attributionId = [NSString stringWithFormat:@"gmp_flutter_googlemapsflutter_v%sandroid", FGM_PLUGIN_VERSION]; - [GMSServices addInternalUsageAttributionID:attributionId]; // Register Flutter plugins. [GeneratedPluginRegistrant registerWithRegistry:self]; diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapsPlugin.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapsPlugin.m index 70bde9022a0..89af24e46b8 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapsPlugin.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapsPlugin.m @@ -3,6 +3,7 @@ // found in the LICENSE file. #import "FLTGoogleMapsPlugin.h" +#import "FGMConstants.h" #pragma mark - GoogleMaps plugin implementation @@ -10,6 +11,15 @@ @implementation FLTGoogleMapsPlugin + (void)registerWithRegistrar:(NSObject *)registrar { FLTGoogleMapFactory *googleMapFactory = [[FLTGoogleMapFactory alloc] initWithRegistrar:registrar]; + + Class gmssClass = [GMSServices class]; + SEL internalUsageAttributionIDSelector = @selector(addInternalUsageAttributionID:); + + if ([gmssClass respondsToSelector:internalUsageAttributionIDSelector]) { + NSString *attributionId = [NSString stringWithFormat:@"gmp_flutter_googlemapsflutter_v%s_ios", FGM_PLUGIN_VERSION]; + [GMSServices performSelector:internalUsageAttributionIDSelector withObject:attributionId]; + } + [registrar registerViewFactory:googleMapFactory withId:@"plugins.flutter.dev/google_maps_ios" gestureRecognizersBlockingPolicy: diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/google_maps_flutter_ios.podspec b/packages/google_maps_flutter/google_maps_flutter_ios/ios/google_maps_flutter_ios.podspec index 717a1026acc..f744daa6853 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/google_maps_flutter_ios.podspec +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/google_maps_flutter_ios.podspec @@ -24,7 +24,7 @@ Downloaded by pub (not CocoaPods). # broad as possible. # Versions earlier than 8.4 can't be supported because that's the first version # that supports privacy manifests. - s.dependency 'GoogleMaps', '>= 9.0', '< 10.0' + s.dependency 'GoogleMaps', '>= 8.4', '< 10.0' # Google-Maps-iOS-Utils 5.x supports GoogleMaps 8.x and iOS 14.0+ # Google-Maps-iOS-Utils 6.x supports GoogleMaps 9.x and iOS 15.0+ s.dependency 'Google-Maps-iOS-Utils', '>= 5.0', '< 7.0' From 172a51a5deae2a412ec57213d012fab13b35d0f9 Mon Sep 17 00:00:00 2001 From: Alexander Troshkov <20989940+aednlaxer@users.noreply.github.com> Date: Thu, 15 May 2025 14:13:33 +0300 Subject: [PATCH 09/12] Upgrade Play Service Maps library on Android --- .../google_maps_flutter_android/android/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle b/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle index 4af61cefe39..c926d6ff45e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/build.gradle @@ -37,8 +37,8 @@ android { dependencies { implementation "androidx.annotation:annotation:1.9.1" - implementation 'com.google.android.gms:play-services-maps:18.2.0' - implementation 'com.google.maps.android:android-maps-utils:3.13.0' + implementation 'com.google.android.gms:play-services-maps:19.2.0' + implementation 'com.google.maps.android:android-maps-utils:3.6.0' androidTestImplementation 'androidx.test:runner:1.6.2' androidTestImplementation 'androidx.test:rules:1.6.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' From f7a296042ecaa82e0f9b5032f1dd637ac931f3cc Mon Sep 17 00:00:00 2001 From: Alexander Troshkov <20989940+aednlaxer@users.noreply.github.com> Date: Thu, 15 May 2025 14:45:26 +0300 Subject: [PATCH 10/12] Add Android initializer changes draft --- .../plugins/googlemaps/GoogleMapFactory.java | 14 ++++++++++++++ .../plugins/googlemaps/GoogleMapInitializer.java | 16 +++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java index c4208f003c6..448e1773801 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java @@ -7,6 +7,8 @@ import android.content.Context; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.google.android.gms.maps.MapsApiSettings; +import com.google.android.gms.maps.MapsInitializer.Renderer; import com.google.android.gms.maps.model.CameraPosition; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugin.platform.PlatformView; @@ -53,6 +55,18 @@ public PlatformView create(@NonNull Context context, int id, @Nullable Object ar builder.setMapId(cloudMapId); } + final Renderer renderer = googleMapInitializer.initializedRenderer(); + if (renderer == null) { + googleMapInitializer.initializeWithRendererRequest(Renderer.LATEST); + } + + if (renderer == Renderer.LATEST) { + MapsApiSettings.addInternalUsageAttributionId( + context, + "gmp_flutter_googlemapsflutter_v" + Constants.FGM_PLUGIN_VERSION + "_android" + ); + } + return builder.build(id, context, binaryMessenger, lifecycleProvider); } } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java index f5478ed1223..069147dbe55 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java @@ -62,11 +62,6 @@ public void onMapsSdkInitialized(@NonNull MapsInitializer.Renderer renderer) { if (initializationResult != null) { switch (renderer) { case LATEST: - MapsApiSettings.addInternalUsageAttributionId( - context, - "gmp_flutter_googlemapsflutter_v" + Constants.FGM_PLUGIN_VERSION + "_android" - ); - initializationResult.success(Messages.PlatformRendererType.LATEST); break; case LEGACY: @@ -82,4 +77,15 @@ public void onMapsSdkInitialized(@NonNull MapsInitializer.Renderer renderer) { initializationResult = null; } } + + + @Nullable + // TODO doc + MapsInitializer.Renderer initializedRenderer() { + if (rendererInitialized) { + // TODO return renderer type + } + + return null; + } } From a985d147a8373588e1beec8c59dac0c3779c31bc Mon Sep 17 00:00:00 2001 From: Alexander Troshkov <20989940+aednlaxer@users.noreply.github.com> Date: Thu, 15 May 2025 15:28:17 +0300 Subject: [PATCH 11/12] Check if renderer initialization has started --- .../plugins/googlemaps/GoogleMapFactory.java | 18 ++++------- .../googlemaps/GoogleMapInitializer.java | 30 ++++++++----------- 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java index 448e1773801..4bd7a3545b3 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java @@ -7,7 +7,6 @@ import android.content.Context; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.google.android.gms.maps.MapsApiSettings; import com.google.android.gms.maps.MapsInitializer.Renderer; import com.google.android.gms.maps.model.CameraPosition; import io.flutter.plugin.common.BinaryMessenger; @@ -33,6 +32,11 @@ public class GoogleMapFactory extends PlatformViewFactory { @Override @NonNull public PlatformView create(@NonNull Context context, int id, @Nullable Object args) { + final boolean shouldInitializeRenderer = !googleMapInitializer.hasRendererInitializationStarted(); + if (shouldInitializeRenderer) { + googleMapInitializer.initializeWithRendererRequest(Renderer.LATEST); + } + final Messages.PlatformMapViewCreationParams params = Objects.requireNonNull((Messages.PlatformMapViewCreationParams) args); final GoogleMapBuilder builder = new GoogleMapBuilder(); @@ -55,18 +59,6 @@ public PlatformView create(@NonNull Context context, int id, @Nullable Object ar builder.setMapId(cloudMapId); } - final Renderer renderer = googleMapInitializer.initializedRenderer(); - if (renderer == null) { - googleMapInitializer.initializeWithRendererRequest(Renderer.LATEST); - } - - if (renderer == Renderer.LATEST) { - MapsApiSettings.addInternalUsageAttributionId( - context, - "gmp_flutter_googlemapsflutter_v" + Constants.FGM_PLUGIN_VERSION + "_android" - ); - } - return builder.build(id, context, binaryMessenger, lifecycleProvider); } } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java index 069147dbe55..d6d8b74f3ab 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java @@ -7,10 +7,8 @@ import android.content.Context; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.annotation.VisibleForTesting; import com.google.android.gms.maps.MapsApiSettings; import com.google.android.gms.maps.MapsInitializer; -import com.google.android.gms.maps.MapsInitializer.Renderer; import com.google.android.gms.maps.OnMapsSdkInitializedCallback; import io.flutter.plugin.common.BinaryMessenger; @@ -21,6 +19,7 @@ final class GoogleMapInitializer private final Context context; private static Messages.Result initializationResult; private boolean rendererInitialized = false; + private boolean rendererInitializationRequested = false; GoogleMapInitializer(Context context, BinaryMessenger binaryMessenger) { this.context = context; @@ -44,14 +43,9 @@ public void initializeWithPreferredRenderer( } } - /** - * Initializes map renderer to with preferred renderer type. - * - *

This method is visible for testing purposes only and should never be used outside this - * class. - */ - @VisibleForTesting + /** Initializes map renderer with preferred renderer type. */ public void initializeWithRendererRequest(@Nullable MapsInitializer.Renderer renderer) { + rendererInitializationRequested = true; MapsInitializer.initialize(context, renderer, this); } @@ -62,6 +56,12 @@ public void onMapsSdkInitialized(@NonNull MapsInitializer.Renderer renderer) { if (initializationResult != null) { switch (renderer) { case LATEST: + // Set Android-specific Maps SDK attribution Id. This value should not be changed + // without discussing it first with the Flutter team + MapsApiSettings.addInternalUsageAttributionId( + context, + "gmp_flutter_googlemapsflutter_v" + Constants.FGM_PLUGIN_VERSION + "_android" + ); initializationResult.success(Messages.PlatformRendererType.LATEST); break; case LEGACY: @@ -78,14 +78,8 @@ public void onMapsSdkInitialized(@NonNull MapsInitializer.Renderer renderer) { } } - - @Nullable - // TODO doc - MapsInitializer.Renderer initializedRenderer() { - if (rendererInitialized) { - // TODO return renderer type - } - - return null; + /** Returns true if renderer initialization has started or renderer has been initialized. */ + boolean hasRendererInitializationStarted() { + return rendererInitialized || rendererInitializationRequested; } } From cdda7ae9783bfddeb8cd660eea1bc6b6bf4e594b Mon Sep 17 00:00:00 2001 From: Alexander Troshkov <20989940+aednlaxer@users.noreply.github.com> Date: Thu, 15 May 2025 16:35:15 +0300 Subject: [PATCH 12/12] Tweak comment --- .../io/flutter/plugins/googlemaps/GoogleMapInitializer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java index d6d8b74f3ab..ff0eb9063c7 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapInitializer.java @@ -57,7 +57,7 @@ public void onMapsSdkInitialized(@NonNull MapsInitializer.Renderer renderer) { switch (renderer) { case LATEST: // Set Android-specific Maps SDK attribution Id. This value should not be changed - // without discussing it first with the Flutter team + // without discussing it first with code owners. MapsApiSettings.addInternalUsageAttributionId( context, "gmp_flutter_googlemapsflutter_v" + Constants.FGM_PLUGIN_VERSION + "_android"