[flutter_tools] port deprecated settings test to flutter integration shard (#65806)
Port the deprecated settings devicelab test to tool integration shard. Tests that apps can be built using the deprecated android/settings.gradle file. Part of #65790
This commit is contained in:
parent
50f929f98e
commit
b88f308af7
@ -1243,7 +1243,6 @@ Future<void> _runHostOnlyDeviceLabTests() async {
|
|||||||
// TODO(ianh): Fails on macOS looking for "dexdump", https://github.com/flutter/flutter/issues/42494
|
// TODO(ianh): Fails on macOS looking for "dexdump", https://github.com/flutter/flutter/issues/42494
|
||||||
if (!Platform.isMacOS) () => _runDevicelabTest('gradle_jetifier_test', environment: gradleEnvironment),
|
if (!Platform.isMacOS) () => _runDevicelabTest('gradle_jetifier_test', environment: gradleEnvironment),
|
||||||
() => _runDevicelabTest('gradle_non_android_plugin_test', environment: gradleEnvironment),
|
() => _runDevicelabTest('gradle_non_android_plugin_test', environment: gradleEnvironment),
|
||||||
() => _runDevicelabTest('gradle_deprecated_settings_test', environment: gradleEnvironment),
|
|
||||||
() => _runDevicelabTest('gradle_plugin_bundle_test', environment: gradleEnvironment),
|
() => _runDevicelabTest('gradle_plugin_bundle_test', environment: gradleEnvironment),
|
||||||
() => _runDevicelabTest('gradle_plugin_fat_apk_test', environment: gradleEnvironment),
|
() => _runDevicelabTest('gradle_plugin_fat_apk_test', environment: gradleEnvironment),
|
||||||
() => _runDevicelabTest('gradle_plugin_light_apk_test', environment: gradleEnvironment),
|
() => _runDevicelabTest('gradle_plugin_light_apk_test', environment: gradleEnvironment),
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
// Copyright 2014 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.
|
|
||||||
|
|
||||||
import 'dart:async';
|
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter_devicelab/framework/framework.dart';
|
|
||||||
import 'package:flutter_devicelab/framework/utils.dart';
|
|
||||||
import 'package:path/path.dart' as path;
|
|
||||||
|
|
||||||
/// Tests that apps can be built using the deprecated `android/settings.gradle` file.
|
|
||||||
/// This test should be removed once apps have been migrated to this new file.
|
|
||||||
// TODO(egarciad): Migrate existing files, https://github.com/flutter/flutter/issues/54566
|
|
||||||
Future<void> main() async {
|
|
||||||
await task(() async {
|
|
||||||
|
|
||||||
section('Find Java');
|
|
||||||
|
|
||||||
final String javaHome = await findJavaHome();
|
|
||||||
if (javaHome == null)
|
|
||||||
return TaskResult.failure('Could not find Java');
|
|
||||||
print('\nUsing JAVA_HOME=$javaHome');
|
|
||||||
|
|
||||||
final Directory projectDirectory =
|
|
||||||
dir('${flutterDirectory.path}/dev/integration_tests/gradle_deprecated_settings');
|
|
||||||
try {
|
|
||||||
section('Build debug APK using deprecated settings.gradle');
|
|
||||||
await inDirectory(projectDirectory, () async {
|
|
||||||
await flutter(
|
|
||||||
'build',
|
|
||||||
options: <String>[
|
|
||||||
'apk',
|
|
||||||
'--debug',
|
|
||||||
'--target-platform', 'android-arm',
|
|
||||||
'--no-shrink',
|
|
||||||
'--verbose',
|
|
||||||
],
|
|
||||||
);
|
|
||||||
});
|
|
||||||
final File debugApk = File(path.join(
|
|
||||||
projectDirectory.path,
|
|
||||||
'build',
|
|
||||||
'app',
|
|
||||||
'outputs',
|
|
||||||
'flutter-apk',
|
|
||||||
'app-debug.apk',
|
|
||||||
));
|
|
||||||
if (!exists(debugApk)) {
|
|
||||||
return TaskResult.failure('Failed to build debug APK.');
|
|
||||||
}
|
|
||||||
return TaskResult.success(null);
|
|
||||||
} catch (e) {
|
|
||||||
return TaskResult.failure(e.toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright 2014 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.
|
||||||
|
|
||||||
|
import 'package:file_testing/file_testing.dart';
|
||||||
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
|
|
||||||
|
import '../src/common.dart';
|
||||||
|
import 'test_utils.dart';
|
||||||
|
|
||||||
|
/// Tests that apps can be built using the deprecated `android/settings.gradle` file.
|
||||||
|
/// This test should be removed once apps have been migrated to this new file.
|
||||||
|
// TODO(egarciad): Migrate existing files, https://github.com/flutter/flutter/issues/54566
|
||||||
|
void main() {
|
||||||
|
test('android project using deprecated settings.gradle will still build', () async {
|
||||||
|
final String woringDirectory = fileSystem.path.join(getFlutterRoot(), 'dev', 'integration_tests', 'gradle_deprecated_settings');
|
||||||
|
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
|
||||||
|
|
||||||
|
final ProcessResult result = await processManager.run(<String>[
|
||||||
|
flutterBin,
|
||||||
|
'build',
|
||||||
|
'apk',
|
||||||
|
'--debug',
|
||||||
|
'--target-platform', 'android-arm',
|
||||||
|
'--no-shrink',
|
||||||
|
'--verbose',
|
||||||
|
], workingDirectory: woringDirectory);
|
||||||
|
print(result.stdout);
|
||||||
|
print(result.stderr);
|
||||||
|
|
||||||
|
expect(result.exitCode, 0);
|
||||||
|
|
||||||
|
final String apkPath = fileSystem.path.join(
|
||||||
|
woringDirectory, 'build', 'app', 'outputs', 'flutter-apk', 'app-debug.apk');
|
||||||
|
expect(fileSystem.file(apkPath), exists);
|
||||||
|
});
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user