Make sure add-to-app build bundle from outer xcodebuild/gradlew sends analytics (#36122)
This commit is contained in:
@@ -154,13 +154,18 @@ Future<void> main() async {
|
||||
Directory(path.join(hostApp.path, 'gradle', 'wrapper')),
|
||||
);
|
||||
|
||||
final File analyticsOutputFile = File(path.join(tempDir.path, 'analytics.log'));
|
||||
|
||||
await inDirectory(hostApp, () async {
|
||||
if (!Platform.isWindows) {
|
||||
await exec('chmod', <String>['+x', 'gradlew']);
|
||||
}
|
||||
await exec(gradlewExecutable,
|
||||
<String>['app:assembleDebug'],
|
||||
environment: <String, String>{ 'JAVA_HOME': javaHome },
|
||||
environment: <String, String>{
|
||||
'JAVA_HOME': javaHome,
|
||||
'FLUTTER_ANALYTICS_LOG_FILE': analyticsOutputFile.path,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
@@ -173,10 +178,21 @@ Future<void> main() async {
|
||||
'debug',
|
||||
'app-debug.apk',
|
||||
)));
|
||||
|
||||
if (!existingAppBuilt) {
|
||||
return TaskResult.failure('Failed to build existing app .apk');
|
||||
}
|
||||
|
||||
final String analyticsOutput = analyticsOutputFile.readAsStringSync();
|
||||
if (!analyticsOutput.contains('cd24: android-arm64')
|
||||
|| !analyticsOutput.contains('cd25: true')
|
||||
|| !analyticsOutput.contains('viewName: build/bundle')) {
|
||||
return TaskResult.failure(
|
||||
'Building outer app produced the following analytics: "$analyticsOutput"'
|
||||
'but not the expected strings: "cd24: android-arm64", "cd25: true" and '
|
||||
'"viewName: build/bundle"'
|
||||
);
|
||||
}
|
||||
|
||||
return TaskResult.success(null);
|
||||
} catch (e) {
|
||||
return TaskResult.failure(e.toString());
|
||||
|
||||
@@ -219,6 +219,8 @@ Future<void> main() async {
|
||||
hostApp,
|
||||
);
|
||||
|
||||
final File analyticsOutputFile = File(path.join(tempDir.path, 'analytics.log'));
|
||||
|
||||
await inDirectory(hostApp, () async {
|
||||
await exec('pod', <String>['install']);
|
||||
await exec(
|
||||
@@ -236,6 +238,9 @@ Future<void> main() async {
|
||||
'EXPANDED_CODE_SIGN_IDENTITY=-',
|
||||
'CONFIGURATION_BUILD_DIR=${tempDir.path}',
|
||||
],
|
||||
environment: <String, String> {
|
||||
'FLUTTER_ANALYTICS_LOG_FILE': analyticsOutputFile.path,
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
@@ -244,11 +249,20 @@ Future<void> main() async {
|
||||
'Host.app',
|
||||
'Host',
|
||||
)));
|
||||
|
||||
if (!existingAppBuilt) {
|
||||
return TaskResult.failure('Failed to build existing app .app');
|
||||
}
|
||||
|
||||
final String analyticsOutput = analyticsOutputFile.readAsStringSync();
|
||||
if (!analyticsOutput.contains('cd24: ios')
|
||||
|| !analyticsOutput.contains('cd25: true')
|
||||
|| !analyticsOutput.contains('viewName: build/bundle')) {
|
||||
return TaskResult.failure(
|
||||
'Building outer app produced the following analytics: "$analyticsOutput"'
|
||||
'but not the expected strings: "cd24: ios", "cd25: true", "viewName: build/bundle"'
|
||||
);
|
||||
}
|
||||
|
||||
return TaskResult.success(null);
|
||||
} catch (e) {
|
||||
return TaskResult.failure(e.toString());
|
||||
|
||||
Reference in New Issue
Block a user