mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Force regeneration of old Podfile (#70735)
This commit is contained in:
parent
830bdfa301
commit
e26c7f98ff
@ -134,6 +134,7 @@ Future<T> runInContext<T>(
|
|||||||
logger: globals.logger,
|
logger: globals.logger,
|
||||||
platform: globals.platform,
|
platform: globals.platform,
|
||||||
xcodeProjectInterpreter: globals.xcodeProjectInterpreter,
|
xcodeProjectInterpreter: globals.xcodeProjectInterpreter,
|
||||||
|
artifacts: globals.artifacts,
|
||||||
),
|
),
|
||||||
CocoaPodsValidator: () => CocoaPodsValidator(
|
CocoaPodsValidator: () => CocoaPodsValidator(
|
||||||
globals.cocoaPods,
|
globals.cocoaPods,
|
||||||
|
@ -25,14 +25,15 @@ import '../reporting/reporting.dart';
|
|||||||
final RegExp _settingExpr = RegExp(r'(\w+)\s*=\s*(.*)$');
|
final RegExp _settingExpr = RegExp(r'(\w+)\s*=\s*(.*)$');
|
||||||
final RegExp _varExpr = RegExp(r'\$\(([^)]*)\)');
|
final RegExp _varExpr = RegExp(r'\$\(([^)]*)\)');
|
||||||
|
|
||||||
String flutterFrameworkDir(BuildMode mode) {
|
String flutterMacOSFrameworkDir(BuildMode mode, FileSystem fileSystem,
|
||||||
return globals.fs.path.normalize(globals.fs.path.dirname(globals.artifacts.getArtifactPath(
|
Artifacts artifacts) {
|
||||||
Artifact.flutterFramework, platform: TargetPlatform.ios, mode: mode)));
|
final String flutterMacOSFramework = artifacts.getArtifactPath(
|
||||||
}
|
Artifact.flutterMacOSFramework,
|
||||||
|
platform: TargetPlatform.darwin_x64,
|
||||||
String flutterMacOSFrameworkDir(BuildMode mode) {
|
mode: mode,
|
||||||
return globals.fs.path.normalize(globals.fs.path.dirname(globals.artifacts.getArtifactPath(
|
);
|
||||||
Artifact.flutterMacOSFramework, platform: TargetPlatform.darwin_x64, mode: mode)));
|
return fileSystem.path
|
||||||
|
.normalize(fileSystem.path.dirname(flutterMacOSFramework));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Writes or rewrites Xcode property files with the specified information.
|
/// Writes or rewrites Xcode property files with the specified information.
|
||||||
@ -185,14 +186,13 @@ List<String> _xcodeBuildSettingsLines({
|
|||||||
xcodeBuildSettings.add(r'OTHER_LDFLAGS=$(inherited) -framework Flutter');
|
xcodeBuildSettings.add(r'OTHER_LDFLAGS=$(inherited) -framework Flutter');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!project.isModule) {
|
if (!project.isModule && useMacOSConfig) {
|
||||||
// For module projects we do not want to write the FLUTTER_FRAMEWORK_DIR
|
// For module projects we do not want to write the FLUTTER_FRAMEWORK_DIR
|
||||||
// explicitly. Rather we rely on the xcode backend script and the Podfile
|
// explicitly. Rather we rely on the xcode backend script and the Podfile
|
||||||
// logic to derive it from FLUTTER_ROOT and FLUTTER_BUILD_MODE.
|
// logic to derive it from FLUTTER_ROOT and FLUTTER_BUILD_MODE.
|
||||||
// However, this is necessary for regular projects using Cocoapods.
|
// However, this is necessary for regular macOS projects using Cocoapods.
|
||||||
final String frameworkDir = useMacOSConfig
|
final String frameworkDir =
|
||||||
? flutterMacOSFrameworkDir(buildInfo.mode)
|
flutterMacOSFrameworkDir(buildInfo.mode, globals.fs, globals.artifacts);
|
||||||
: flutterFrameworkDir(buildInfo.mode);
|
|
||||||
xcodeBuildSettings.add('FLUTTER_FRAMEWORK_DIR=$frameworkDir');
|
xcodeBuildSettings.add('FLUTTER_FRAMEWORK_DIR=$frameworkDir');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
import '../base/fingerprint.dart';
|
import '../base/fingerprint.dart';
|
||||||
import '../build_info.dart';
|
import '../build_info.dart';
|
||||||
import '../globals.dart' as globals;
|
import '../globals.dart' as globals;
|
||||||
import '../ios/xcodeproj.dart';
|
|
||||||
import '../plugins.dart';
|
import '../plugins.dart';
|
||||||
import '../project.dart';
|
import '../project.dart';
|
||||||
|
|
||||||
@ -14,8 +13,7 @@ import '../project.dart';
|
|||||||
Future<void> processPodsIfNeeded(
|
Future<void> processPodsIfNeeded(
|
||||||
XcodeBasedProject xcodeProject,
|
XcodeBasedProject xcodeProject,
|
||||||
String buildDirectory,
|
String buildDirectory,
|
||||||
BuildMode buildMode,
|
BuildMode buildMode) async {
|
||||||
) async {
|
|
||||||
final FlutterProject project = xcodeProject.parent;
|
final FlutterProject project = xcodeProject.parent;
|
||||||
// Ensure that the plugin list is up to date, since hasPlugins relies on it.
|
// Ensure that the plugin list is up to date, since hasPlugins relies on it.
|
||||||
await refreshPluginsList(project, macOSPlatform: project.macos.existsSync());
|
await refreshPluginsList(project, macOSPlatform: project.macos.existsSync());
|
||||||
@ -37,7 +35,7 @@ Future<void> processPodsIfNeeded(
|
|||||||
|
|
||||||
final bool didPodInstall = await globals.cocoaPods.processPods(
|
final bool didPodInstall = await globals.cocoaPods.processPods(
|
||||||
xcodeProject: xcodeProject,
|
xcodeProject: xcodeProject,
|
||||||
engineDir: flutterFrameworkDir(buildMode),
|
buildMode: buildMode,
|
||||||
dependenciesChanged: !fingerprinter.doesFingerprintMatch(),
|
dependenciesChanged: !fingerprinter.doesFingerprintMatch(),
|
||||||
);
|
);
|
||||||
if (didPodInstall) {
|
if (didPodInstall) {
|
||||||
|
@ -6,6 +6,7 @@ import 'package:file/file.dart';
|
|||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
import 'package:process/process.dart';
|
import 'package:process/process.dart';
|
||||||
|
|
||||||
|
import '../artifacts.dart';
|
||||||
import '../base/common.dart';
|
import '../base/common.dart';
|
||||||
import '../base/error_handling_io.dart';
|
import '../base/error_handling_io.dart';
|
||||||
import '../base/file_system.dart';
|
import '../base/file_system.dart';
|
||||||
@ -14,6 +15,7 @@ import '../base/logger.dart';
|
|||||||
import '../base/platform.dart';
|
import '../base/platform.dart';
|
||||||
import '../base/process.dart';
|
import '../base/process.dart';
|
||||||
import '../base/version.dart';
|
import '../base/version.dart';
|
||||||
|
import '../build_info.dart';
|
||||||
import '../cache.dart';
|
import '../cache.dart';
|
||||||
import '../ios/xcodeproj.dart';
|
import '../ios/xcodeproj.dart';
|
||||||
import '../project.dart';
|
import '../project.dart';
|
||||||
@ -79,11 +81,13 @@ class CocoaPods {
|
|||||||
@required XcodeProjectInterpreter xcodeProjectInterpreter,
|
@required XcodeProjectInterpreter xcodeProjectInterpreter,
|
||||||
@required Logger logger,
|
@required Logger logger,
|
||||||
@required Platform platform,
|
@required Platform platform,
|
||||||
|
@required Artifacts artifacts,
|
||||||
}) : _fileSystem = fileSystem,
|
}) : _fileSystem = fileSystem,
|
||||||
_processManager = processManager,
|
_processManager = processManager,
|
||||||
_xcodeProjectInterpreter = xcodeProjectInterpreter,
|
_xcodeProjectInterpreter = xcodeProjectInterpreter,
|
||||||
_logger = logger,
|
_logger = logger,
|
||||||
_platform = platform,
|
_platform = platform,
|
||||||
|
_artifacts = artifacts,
|
||||||
_processUtils = ProcessUtils(processManager: processManager, logger: logger),
|
_processUtils = ProcessUtils(processManager: processManager, logger: logger),
|
||||||
_fileSystemUtils = FileSystemUtils(fileSystem: fileSystem, platform: platform);
|
_fileSystemUtils = FileSystemUtils(fileSystem: fileSystem, platform: platform);
|
||||||
|
|
||||||
@ -94,6 +98,7 @@ class CocoaPods {
|
|||||||
final XcodeProjectInterpreter _xcodeProjectInterpreter;
|
final XcodeProjectInterpreter _xcodeProjectInterpreter;
|
||||||
final Logger _logger;
|
final Logger _logger;
|
||||||
final Platform _platform;
|
final Platform _platform;
|
||||||
|
final Artifacts _artifacts;
|
||||||
|
|
||||||
Future<String> _versionText;
|
Future<String> _versionText;
|
||||||
|
|
||||||
@ -164,8 +169,7 @@ class CocoaPods {
|
|||||||
|
|
||||||
Future<bool> processPods({
|
Future<bool> processPods({
|
||||||
@required XcodeBasedProject xcodeProject,
|
@required XcodeBasedProject xcodeProject,
|
||||||
// For backward compatibility with previously created Podfile only.
|
@required BuildMode buildMode,
|
||||||
@required String engineDir,
|
|
||||||
bool dependenciesChanged = true,
|
bool dependenciesChanged = true,
|
||||||
}) async {
|
}) async {
|
||||||
if (!xcodeProject.podfile.existsSync()) {
|
if (!xcodeProject.podfile.existsSync()) {
|
||||||
@ -176,7 +180,7 @@ class CocoaPods {
|
|||||||
if (!await _checkPodCondition()) {
|
if (!await _checkPodCondition()) {
|
||||||
throwToolExit('CocoaPods not installed or not in valid state.');
|
throwToolExit('CocoaPods not installed or not in valid state.');
|
||||||
}
|
}
|
||||||
await _runPodInstall(xcodeProject, engineDir);
|
await _runPodInstall(xcodeProject, buildMode);
|
||||||
podsProcessed = true;
|
podsProcessed = true;
|
||||||
}
|
}
|
||||||
_warnIfPodfileOutOfDate(xcodeProject);
|
_warnIfPodfileOutOfDate(xcodeProject);
|
||||||
@ -329,13 +333,16 @@ class CocoaPods {
|
|||||||
|| podfileLockFile.readAsStringSync() != manifestLockFile.readAsStringSync();
|
|| podfileLockFile.readAsStringSync() != manifestLockFile.readAsStringSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _runPodInstall(XcodeBasedProject xcodeProject, String engineDirectory) async {
|
Future<void> _runPodInstall(XcodeBasedProject xcodeProject, BuildMode buildMode) async {
|
||||||
final Status status = _logger.startProgress('Running pod install...');
|
final Status status = _logger.startProgress('Running pod install...');
|
||||||
final ProcessResult result = await _processManager.run(
|
final ProcessResult result = await _processManager.run(
|
||||||
<String>['pod', 'install', '--verbose'],
|
<String>['pod', 'install', '--verbose'],
|
||||||
workingDirectory: _fileSystem.path.dirname(xcodeProject.podfile.path),
|
workingDirectory: _fileSystem.path.dirname(xcodeProject.podfile.path),
|
||||||
environment: <String, String>{
|
environment: <String, String>{
|
||||||
'FLUTTER_FRAMEWORK_DIR': engineDirectory,
|
// For macOS Podfile only.
|
||||||
|
if (xcodeProject is MacOSProject)
|
||||||
|
'FLUTTER_FRAMEWORK_DIR':
|
||||||
|
flutterMacOSFrameworkDir(buildMode, _fileSystem, _artifacts),
|
||||||
// See https://github.com/flutter/flutter/issues/10873.
|
// See https://github.com/flutter/flutter/issues/10873.
|
||||||
// CocoaPods analytics adds a lot of latency.
|
// CocoaPods analytics adds a lot of latency.
|
||||||
'COCOAPODS_DISABLE_STATS': 'true',
|
'COCOAPODS_DISABLE_STATS': 'true',
|
||||||
@ -391,12 +398,11 @@ class CocoaPods {
|
|||||||
'flutter',
|
'flutter',
|
||||||
));
|
));
|
||||||
if (flutterSymlink.existsSync()) {
|
if (flutterSymlink.existsSync()) {
|
||||||
_logger.printError(
|
throwToolExit(
|
||||||
'Warning: Podfile is out of date\n'
|
'Warning: Podfile is out of date\n'
|
||||||
'$outOfDateFrameworksPodfileConsequence\n'
|
'$outOfDateFrameworksPodfileConsequence\n'
|
||||||
'To regenerate the Podfile, run:\n'
|
'To regenerate the Podfile, run:\n'
|
||||||
'$podfileMigrationInstructions\n',
|
'$podfileMigrationInstructions\n',
|
||||||
emphasis: true,
|
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -406,12 +412,11 @@ class CocoaPods {
|
|||||||
// plugin_pods = parse_KV_file('../.flutter-plugins')
|
// plugin_pods = parse_KV_file('../.flutter-plugins')
|
||||||
if (xcodeProject.podfile.existsSync() &&
|
if (xcodeProject.podfile.existsSync() &&
|
||||||
xcodeProject.podfile.readAsStringSync().contains('.flutter-plugins\'')) {
|
xcodeProject.podfile.readAsStringSync().contains('.flutter-plugins\'')) {
|
||||||
_logger.printError(
|
throwToolExit(
|
||||||
'Warning: Podfile is out of date\n'
|
'Warning: Podfile is out of date\n'
|
||||||
'$outOfDatePluginsPodfileConsequence\n'
|
'$outOfDatePluginsPodfileConsequence\n'
|
||||||
'To regenerate the Podfile, run:\n'
|
'To regenerate the Podfile, run:\n'
|
||||||
'$podfileMigrationInstructions\n',
|
'$podfileMigrationInstructions\n',
|
||||||
emphasis: true,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
|
import 'package:flutter_tools/src/artifacts.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
@ -258,6 +259,7 @@ void main() {
|
|||||||
'DART_OBFUSCATION=true',
|
'DART_OBFUSCATION=true',
|
||||||
'EXTRA_FRONT_END_OPTIONS=--enable-experiment%3Dnon-nullable',
|
'EXTRA_FRONT_END_OPTIONS=--enable-experiment%3Dnon-nullable',
|
||||||
'EXTRA_GEN_SNAPSHOT_OPTIONS=--enable-experiment%3Dnon-nullable',
|
'EXTRA_GEN_SNAPSHOT_OPTIONS=--enable-experiment%3Dnon-nullable',
|
||||||
|
'FLUTTER_FRAMEWORK_DIR=.',
|
||||||
'SPLIT_DEBUG_INFO=foo/',
|
'SPLIT_DEBUG_INFO=foo/',
|
||||||
'TRACK_WIDGET_CREATION=true',
|
'TRACK_WIDGET_CREATION=true',
|
||||||
'TREE_SHAKE_ICONS=true',
|
'TREE_SHAKE_ICONS=true',
|
||||||
@ -271,6 +273,7 @@ void main() {
|
|||||||
]),
|
]),
|
||||||
Platform: () => macosPlatform,
|
Platform: () => macosPlatform,
|
||||||
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
|
||||||
|
Artifacts: () => Artifacts.test(),
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('macOS build supports build-name and build-number', () async {
|
testUsingContext('macOS build supports build-name and build-number', () async {
|
||||||
|
@ -4,10 +4,12 @@
|
|||||||
|
|
||||||
import 'package:file/file.dart';
|
import 'package:file/file.dart';
|
||||||
import 'package:file/memory.dart';
|
import 'package:file/memory.dart';
|
||||||
|
import 'package:flutter_tools/src/artifacts.dart';
|
||||||
import 'package:flutter_tools/src/base/common.dart';
|
import 'package:flutter_tools/src/base/common.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
import 'package:flutter_tools/src/base/logger.dart';
|
import 'package:flutter_tools/src/base/logger.dart';
|
||||||
import 'package:flutter_tools/src/base/platform.dart';
|
import 'package:flutter_tools/src/base/platform.dart';
|
||||||
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals.dart' as globals;
|
||||||
import 'package:flutter_tools/src/ios/xcodeproj.dart';
|
import 'package:flutter_tools/src/ios/xcodeproj.dart';
|
||||||
@ -65,11 +67,13 @@ void main() {
|
|||||||
mockXcodeProjectInterpreter = MockXcodeProjectInterpreter();
|
mockXcodeProjectInterpreter = MockXcodeProjectInterpreter();
|
||||||
projectUnderTest = FlutterProject.fromDirectory(fileSystem.directory('project'));
|
projectUnderTest = FlutterProject.fromDirectory(fileSystem.directory('project'));
|
||||||
projectUnderTest.ios.xcodeProject.createSync(recursive: true);
|
projectUnderTest.ios.xcodeProject.createSync(recursive: true);
|
||||||
|
projectUnderTest.macos.xcodeProject.createSync(recursive: true);
|
||||||
cocoaPodsUnderTest = CocoaPods(
|
cocoaPodsUnderTest = CocoaPods(
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
processManager: mockProcessManager,
|
processManager: mockProcessManager,
|
||||||
logger: logger,
|
logger: logger,
|
||||||
platform: FakePlatform(),
|
platform: FakePlatform(),
|
||||||
|
artifacts: Artifacts.test(),
|
||||||
xcodeProjectInterpreter: mockXcodeProjectInterpreter,
|
xcodeProjectInterpreter: mockXcodeProjectInterpreter,
|
||||||
);
|
);
|
||||||
pretendPodVersionIs('1.8.0');
|
pretendPodVersionIs('1.8.0');
|
||||||
@ -96,12 +100,12 @@ void main() {
|
|||||||
when(mockProcessManager.run(
|
when(mockProcessManager.run(
|
||||||
<String>['pod', 'install', '--verbose'],
|
<String>['pod', 'install', '--verbose'],
|
||||||
workingDirectory: 'project/ios',
|
workingDirectory: 'project/ios',
|
||||||
environment: <String, String>{'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true', 'LANG': 'en_US.UTF-8'},
|
environment: <String, String>{'COCOAPODS_DISABLE_STATS': 'true', 'LANG': 'en_US.UTF-8'},
|
||||||
)).thenAnswer((_) async => exitsHappy());
|
)).thenAnswer((_) async => exitsHappy());
|
||||||
when(mockProcessManager.run(
|
when(mockProcessManager.run(
|
||||||
<String>['pod', 'install', '--verbose'],
|
<String>['pod', 'install', '--verbose'],
|
||||||
workingDirectory: 'project/macos',
|
workingDirectory: 'project/macos',
|
||||||
environment: <String, String>{'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true', 'LANG': 'en_US.UTF-8'},
|
environment: <String, String>{'FLUTTER_FRAMEWORK_DIR': '.', 'COCOAPODS_DISABLE_STATS': 'true', 'LANG': 'en_US.UTF-8'},
|
||||||
)).thenAnswer((_) async => exitsHappy());
|
)).thenAnswer((_) async => exitsHappy());
|
||||||
fileSystem.file('.packages').writeAsStringSync('\n');
|
fileSystem.file('.packages').writeAsStringSync('\n');
|
||||||
});
|
});
|
||||||
@ -329,7 +333,7 @@ void main() {
|
|||||||
projectUnderTest.ios.podfile.createSync();
|
projectUnderTest.ios.podfile.createSync();
|
||||||
final Function invokeProcessPods = () async => await cocoaPodsUnderTest.processPods(
|
final Function invokeProcessPods = () async => await cocoaPodsUnderTest.processPods(
|
||||||
xcodeProject: projectUnderTest.ios,
|
xcodeProject: projectUnderTest.ios,
|
||||||
engineDir: 'engine/path',
|
buildMode: BuildMode.debug,
|
||||||
);
|
);
|
||||||
expect(invokeProcessPods, throwsToolExit());
|
expect(invokeProcessPods, throwsToolExit());
|
||||||
verifyNever(mockProcessManager.run(
|
verifyNever(mockProcessManager.run(
|
||||||
@ -344,7 +348,7 @@ void main() {
|
|||||||
projectUnderTest.ios.podfile.createSync();
|
projectUnderTest.ios.podfile.createSync();
|
||||||
final Function invokeProcessPods = () async => await cocoaPodsUnderTest.processPods(
|
final Function invokeProcessPods = () async => await cocoaPodsUnderTest.processPods(
|
||||||
xcodeProject: projectUnderTest.ios,
|
xcodeProject: projectUnderTest.ios,
|
||||||
engineDir: 'engine/path',
|
buildMode: BuildMode.debug,
|
||||||
);
|
);
|
||||||
expect(invokeProcessPods, throwsToolExit());
|
expect(invokeProcessPods, throwsToolExit());
|
||||||
verifyNever(mockProcessManager.run(
|
verifyNever(mockProcessManager.run(
|
||||||
@ -354,7 +358,7 @@ void main() {
|
|||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('prints warning, if Podfile creates the Flutter engine symlink', () async {
|
testWithoutContext('exits if Podfile creates the Flutter engine symlink', () async {
|
||||||
pretendPodIsInstalled();
|
pretendPodIsInstalled();
|
||||||
|
|
||||||
fileSystem.file(fileSystem.path.join('project', 'ios', 'Podfile'))
|
fileSystem.file(fileSystem.path.join('project', 'ios', 'Podfile'))
|
||||||
@ -365,25 +369,23 @@ void main() {
|
|||||||
..createSync(recursive: true);
|
..createSync(recursive: true);
|
||||||
symlinks.childLink('flutter').createSync('cache');
|
symlinks.childLink('flutter').createSync('cache');
|
||||||
|
|
||||||
await cocoaPodsUnderTest.processPods(
|
await expectLater(cocoaPodsUnderTest.processPods(
|
||||||
xcodeProject: projectUnderTest.ios,
|
xcodeProject: projectUnderTest.ios,
|
||||||
engineDir: 'engine/path',
|
buildMode: BuildMode.debug,
|
||||||
);
|
), throwsToolExit(message: 'Podfile is out of date'));
|
||||||
expect(logger.errorText, contains('Warning: Podfile is out of date'));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('prints warning, if Podfile parses .flutter-plugins', () async {
|
testWithoutContext('exits if Podfile parses .flutter-plugins', () async {
|
||||||
pretendPodIsInstalled();
|
pretendPodIsInstalled();
|
||||||
|
|
||||||
fileSystem.file(fileSystem.path.join('project', 'ios', 'Podfile'))
|
fileSystem.file(fileSystem.path.join('project', 'ios', 'Podfile'))
|
||||||
..createSync()
|
..createSync()
|
||||||
..writeAsStringSync('plugin_pods = parse_KV_file(\'../.flutter-plugins\')');
|
..writeAsStringSync('plugin_pods = parse_KV_file(\'../.flutter-plugins\')');
|
||||||
|
|
||||||
await cocoaPodsUnderTest.processPods(
|
await expectLater(cocoaPodsUnderTest.processPods(
|
||||||
xcodeProject: projectUnderTest.ios,
|
xcodeProject: projectUnderTest.ios,
|
||||||
engineDir: 'engine/path',
|
buildMode: BuildMode.debug,
|
||||||
);
|
), throwsToolExit(message: 'Podfile is out of date'));
|
||||||
expect(logger.errorText, contains('Warning: Podfile is out of date'));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('throws, if Podfile is missing.', () async {
|
testWithoutContext('throws, if Podfile is missing.', () async {
|
||||||
@ -391,7 +393,7 @@ void main() {
|
|||||||
try {
|
try {
|
||||||
await cocoaPodsUnderTest.processPods(
|
await cocoaPodsUnderTest.processPods(
|
||||||
xcodeProject: projectUnderTest.ios,
|
xcodeProject: projectUnderTest.ios,
|
||||||
engineDir: 'engine/path',
|
buildMode: BuildMode.debug,
|
||||||
);
|
);
|
||||||
fail('ToolExit expected');
|
fail('ToolExit expected');
|
||||||
} on Exception catch (e) {
|
} on Exception catch (e) {
|
||||||
@ -414,7 +416,6 @@ void main() {
|
|||||||
<String>['pod', 'install', '--verbose'],
|
<String>['pod', 'install', '--verbose'],
|
||||||
workingDirectory: 'project/ios',
|
workingDirectory: 'project/ios',
|
||||||
environment: <String, String>{
|
environment: <String, String>{
|
||||||
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
|
|
||||||
'COCOAPODS_DISABLE_STATS': 'true',
|
'COCOAPODS_DISABLE_STATS': 'true',
|
||||||
'LANG': 'en_US.UTF-8',
|
'LANG': 'en_US.UTF-8',
|
||||||
},
|
},
|
||||||
@ -437,7 +438,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
try {
|
try {
|
||||||
await cocoaPodsUnderTest.processPods(
|
await cocoaPodsUnderTest.processPods(
|
||||||
xcodeProject: projectUnderTest.ios,
|
xcodeProject: projectUnderTest.ios,
|
||||||
engineDir: 'engine/path',
|
buildMode: BuildMode.debug,
|
||||||
);
|
);
|
||||||
fail('ToolExit expected');
|
fail('ToolExit expected');
|
||||||
} on Exception catch (e) {
|
} on Exception catch (e) {
|
||||||
@ -459,18 +460,18 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
..writeAsStringSync('Existing lock file.');
|
..writeAsStringSync('Existing lock file.');
|
||||||
final bool didInstall = await cocoaPodsUnderTest.processPods(
|
final bool didInstall = await cocoaPodsUnderTest.processPods(
|
||||||
xcodeProject: projectUnderTest.ios,
|
xcodeProject: projectUnderTest.ios,
|
||||||
engineDir: 'engine/path',
|
buildMode: BuildMode.debug,
|
||||||
dependenciesChanged: false,
|
dependenciesChanged: false,
|
||||||
);
|
);
|
||||||
expect(didInstall, isTrue);
|
expect(didInstall, isTrue);
|
||||||
verify(mockProcessManager.run(
|
verify(mockProcessManager.run(
|
||||||
<String>['pod', 'install', '--verbose'],
|
<String>['pod', 'install', '--verbose'],
|
||||||
workingDirectory: 'project/ios',
|
workingDirectory: 'project/ios',
|
||||||
environment: <String, String>{'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true', 'LANG': 'en_US.UTF-8'},
|
environment: <String, String>{'COCOAPODS_DISABLE_STATS': 'true', 'LANG': 'en_US.UTF-8'},
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('runs pod install, if Manifest.lock is missing', () async {
|
testWithoutContext('runs iOS pod install, if Manifest.lock is missing', () async {
|
||||||
pretendPodIsInstalled();
|
pretendPodIsInstalled();
|
||||||
projectUnderTest.ios.podfile
|
projectUnderTest.ios.podfile
|
||||||
..createSync()
|
..createSync()
|
||||||
@ -480,7 +481,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
..writeAsStringSync('Existing lock file.');
|
..writeAsStringSync('Existing lock file.');
|
||||||
final bool didInstall = await cocoaPodsUnderTest.processPods(
|
final bool didInstall = await cocoaPodsUnderTest.processPods(
|
||||||
xcodeProject: projectUnderTest.ios,
|
xcodeProject: projectUnderTest.ios,
|
||||||
engineDir: 'engine/path',
|
buildMode: BuildMode.debug,
|
||||||
dependenciesChanged: false,
|
dependenciesChanged: false,
|
||||||
);
|
);
|
||||||
expect(didInstall, isTrue);
|
expect(didInstall, isTrue);
|
||||||
@ -488,7 +489,31 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
<String>['pod', 'install', '--verbose'],
|
<String>['pod', 'install', '--verbose'],
|
||||||
workingDirectory: 'project/ios',
|
workingDirectory: 'project/ios',
|
||||||
environment: <String, String>{
|
environment: <String, String>{
|
||||||
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
|
'COCOAPODS_DISABLE_STATS': 'true',
|
||||||
|
'LANG': 'en_US.UTF-8',
|
||||||
|
},
|
||||||
|
));
|
||||||
|
});
|
||||||
|
|
||||||
|
testWithoutContext('runs macOS pod install, if Manifest.lock is missing', () async {
|
||||||
|
pretendPodIsInstalled();
|
||||||
|
projectUnderTest.macos.podfile
|
||||||
|
..createSync()
|
||||||
|
..writeAsStringSync('Existing Podfile');
|
||||||
|
projectUnderTest.macos.podfileLock
|
||||||
|
..createSync()
|
||||||
|
..writeAsStringSync('Existing lock file.');
|
||||||
|
final bool didInstall = await cocoaPodsUnderTest.processPods(
|
||||||
|
xcodeProject: projectUnderTest.macos,
|
||||||
|
buildMode: BuildMode.debug,
|
||||||
|
dependenciesChanged: false,
|
||||||
|
);
|
||||||
|
expect(didInstall, isTrue);
|
||||||
|
verify(mockProcessManager.run(
|
||||||
|
<String>['pod', 'install', '--verbose'],
|
||||||
|
workingDirectory: 'project/macos',
|
||||||
|
environment: <String, String>{
|
||||||
|
'FLUTTER_FRAMEWORK_DIR': '.',
|
||||||
'COCOAPODS_DISABLE_STATS': 'true',
|
'COCOAPODS_DISABLE_STATS': 'true',
|
||||||
'LANG': 'en_US.UTF-8',
|
'LANG': 'en_US.UTF-8',
|
||||||
},
|
},
|
||||||
@ -508,7 +533,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
..writeAsStringSync('Different lock file.');
|
..writeAsStringSync('Different lock file.');
|
||||||
final bool didInstall = await cocoaPodsUnderTest.processPods(
|
final bool didInstall = await cocoaPodsUnderTest.processPods(
|
||||||
xcodeProject: projectUnderTest.ios,
|
xcodeProject: projectUnderTest.ios,
|
||||||
engineDir: 'engine/path',
|
buildMode: BuildMode.debug,
|
||||||
dependenciesChanged: false,
|
dependenciesChanged: false,
|
||||||
);
|
);
|
||||||
expect(didInstall, isTrue);
|
expect(didInstall, isTrue);
|
||||||
@ -516,7 +541,6 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
<String>['pod', 'install', '--verbose'],
|
<String>['pod', 'install', '--verbose'],
|
||||||
workingDirectory: 'project/ios',
|
workingDirectory: 'project/ios',
|
||||||
environment: <String, String>{
|
environment: <String, String>{
|
||||||
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
|
|
||||||
'COCOAPODS_DISABLE_STATS': 'true',
|
'COCOAPODS_DISABLE_STATS': 'true',
|
||||||
'LANG': 'en_US.UTF-8',
|
'LANG': 'en_US.UTF-8',
|
||||||
},
|
},
|
||||||
@ -536,7 +560,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
..writeAsStringSync('Existing lock file.');
|
..writeAsStringSync('Existing lock file.');
|
||||||
final bool didInstall = await cocoaPodsUnderTest.processPods(
|
final bool didInstall = await cocoaPodsUnderTest.processPods(
|
||||||
xcodeProject: projectUnderTest.ios,
|
xcodeProject: projectUnderTest.ios,
|
||||||
engineDir: 'engine/path',
|
buildMode: BuildMode.debug,
|
||||||
dependenciesChanged: true,
|
dependenciesChanged: true,
|
||||||
);
|
);
|
||||||
expect(didInstall, isTrue);
|
expect(didInstall, isTrue);
|
||||||
@ -544,7 +568,6 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
<String>['pod', 'install', '--verbose'],
|
<String>['pod', 'install', '--verbose'],
|
||||||
workingDirectory: 'project/ios',
|
workingDirectory: 'project/ios',
|
||||||
environment: <String, String>{
|
environment: <String, String>{
|
||||||
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
|
|
||||||
'COCOAPODS_DISABLE_STATS': 'true',
|
'COCOAPODS_DISABLE_STATS': 'true',
|
||||||
'LANG': 'en_US.UTF-8',
|
'LANG': 'en_US.UTF-8',
|
||||||
},
|
},
|
||||||
@ -567,14 +590,13 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
.writeAsStringSync('Updated Podfile');
|
.writeAsStringSync('Updated Podfile');
|
||||||
await cocoaPodsUnderTest.processPods(
|
await cocoaPodsUnderTest.processPods(
|
||||||
xcodeProject: projectUnderTest.ios,
|
xcodeProject: projectUnderTest.ios,
|
||||||
engineDir: 'engine/path',
|
buildMode: BuildMode.debug,
|
||||||
dependenciesChanged: false,
|
dependenciesChanged: false,
|
||||||
);
|
);
|
||||||
verify(mockProcessManager.run(
|
verify(mockProcessManager.run(
|
||||||
<String>['pod', 'install', '--verbose'],
|
<String>['pod', 'install', '--verbose'],
|
||||||
workingDirectory: 'project/ios',
|
workingDirectory: 'project/ios',
|
||||||
environment: <String, String>{
|
environment: <String, String>{
|
||||||
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
|
|
||||||
'COCOAPODS_DISABLE_STATS': 'true',
|
'COCOAPODS_DISABLE_STATS': 'true',
|
||||||
'LANG': 'en_US.UTF-8',
|
'LANG': 'en_US.UTF-8',
|
||||||
},
|
},
|
||||||
@ -594,7 +616,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
..writeAsStringSync('Existing lock file.');
|
..writeAsStringSync('Existing lock file.');
|
||||||
final bool didInstall = await cocoaPodsUnderTest.processPods(
|
final bool didInstall = await cocoaPodsUnderTest.processPods(
|
||||||
xcodeProject: projectUnderTest.ios,
|
xcodeProject: projectUnderTest.ios,
|
||||||
engineDir: 'engine/path',
|
buildMode: BuildMode.debug,
|
||||||
dependenciesChanged: false,
|
dependenciesChanged: false,
|
||||||
);
|
);
|
||||||
expect(didInstall, isFalse);
|
expect(didInstall, isFalse);
|
||||||
@ -621,7 +643,6 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
<String>['pod', 'install', '--verbose'],
|
<String>['pod', 'install', '--verbose'],
|
||||||
workingDirectory: 'project/ios',
|
workingDirectory: 'project/ios',
|
||||||
environment: <String, String>{
|
environment: <String, String>{
|
||||||
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
|
|
||||||
'COCOAPODS_DISABLE_STATS': 'true',
|
'COCOAPODS_DISABLE_STATS': 'true',
|
||||||
'LANG': 'en_US.UTF-8',
|
'LANG': 'en_US.UTF-8',
|
||||||
},
|
},
|
||||||
@ -632,7 +653,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
try {
|
try {
|
||||||
await cocoaPodsUnderTest.processPods(
|
await cocoaPodsUnderTest.processPods(
|
||||||
xcodeProject: projectUnderTest.ios,
|
xcodeProject: projectUnderTest.ios,
|
||||||
engineDir: 'engine/path',
|
buildMode: BuildMode.debug,
|
||||||
dependenciesChanged: true,
|
dependenciesChanged: true,
|
||||||
);
|
);
|
||||||
fail('Tool throw expected when pod install fails');
|
fail('Tool throw expected when pod install fails');
|
||||||
@ -650,7 +671,6 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
when(mockProcessManager.canRun(any)).thenReturn(true);
|
when(mockProcessManager.canRun(any)).thenReturn(true);
|
||||||
cocoapodsRepoDir = podsIsInCustomDir();
|
cocoapodsRepoDir = podsIsInCustomDir();
|
||||||
environment = <String, String>{
|
environment = <String, String>{
|
||||||
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
|
|
||||||
'COCOAPODS_DISABLE_STATS': 'true',
|
'COCOAPODS_DISABLE_STATS': 'true',
|
||||||
'CP_REPOS_DIR': cocoapodsRepoDir,
|
'CP_REPOS_DIR': cocoapodsRepoDir,
|
||||||
'LANG': 'en_US.UTF8',
|
'LANG': 'en_US.UTF8',
|
||||||
@ -669,7 +689,7 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
|
|||||||
)).thenAnswer((_) async => exitsHappy());
|
)).thenAnswer((_) async => exitsHappy());
|
||||||
final bool success = await cocoaPodsUnderTest.processPods(
|
final bool success = await cocoaPodsUnderTest.processPods(
|
||||||
xcodeProject: projectUnderTest.ios,
|
xcodeProject: projectUnderTest.ios,
|
||||||
engineDir: 'engine/path',
|
buildMode: BuildMode.debug,
|
||||||
);
|
);
|
||||||
expect(success, true);
|
expect(success, true);
|
||||||
});
|
});
|
||||||
|
@ -43,7 +43,7 @@ void main() {
|
|||||||
expect(generatedConfig, exists);
|
expect(generatedConfig, exists);
|
||||||
expect(generatedConfig.readAsStringSync(), allOf(
|
expect(generatedConfig.readAsStringSync(), allOf(
|
||||||
contains('DART_OBFUSCATION=true'),
|
contains('DART_OBFUSCATION=true'),
|
||||||
contains('FLUTTER_FRAMEWORK_DIR=${fileSystem.path.absolute(getFlutterRoot(), 'bin', 'cache', 'artifacts', 'engine')}'),
|
isNot(contains('FLUTTER_FRAMEWORK_DIR')),
|
||||||
));
|
));
|
||||||
|
|
||||||
// file that only exists if app was fully built.
|
// file that only exists if app was fully built.
|
||||||
|
Loading…
Reference in New Issue
Block a user