Allow users to pass in Xcode build settings as env variables to flutter build macos FLUTTER_XCODE_ (#81384)
This commit is contained in:
parent
d9014655ab
commit
0bba935b76
@ -114,6 +114,7 @@ Future<void> buildMacOS({
|
|||||||
else
|
else
|
||||||
'-quiet',
|
'-quiet',
|
||||||
'COMPILER_INDEX_STORE_ENABLE=NO',
|
'COMPILER_INDEX_STORE_ENABLE=NO',
|
||||||
|
...environmentVariablesAsXcodeBuildSettings(globals.platform)
|
||||||
],
|
],
|
||||||
trace: true,
|
trace: true,
|
||||||
stdoutErrorMatcher: verboseLogging ? null : _anyOutput,
|
stdoutErrorMatcher: verboseLogging ? null : _anyOutput,
|
||||||
|
@ -45,6 +45,15 @@ final Platform macosPlatform = FakePlatform(
|
|||||||
'HOME': '/',
|
'HOME': '/',
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final FakePlatform macosPlatformCustomEnv = FakePlatform(
|
||||||
|
operatingSystem: 'macos',
|
||||||
|
environment: <String, String>{
|
||||||
|
'FLUTTER_ROOT': '/',
|
||||||
|
'HOME': '/',
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
final Platform notMacosPlatform = FakePlatform(
|
final Platform notMacosPlatform = FakePlatform(
|
||||||
operatingSystem: 'linux',
|
operatingSystem: 'linux',
|
||||||
environment: <String, String>{
|
environment: <String, String>{
|
||||||
@ -55,6 +64,8 @@ final Platform notMacosPlatform = FakePlatform(
|
|||||||
void main() {
|
void main() {
|
||||||
FileSystem fileSystem;
|
FileSystem fileSystem;
|
||||||
TestUsage usage;
|
TestUsage usage;
|
||||||
|
FakeProcessManager fakeProcessManager;
|
||||||
|
XcodeProjectInterpreter xcodeProjectInterpreter;
|
||||||
|
|
||||||
setUpAll(() {
|
setUpAll(() {
|
||||||
Cache.disableLocking();
|
Cache.disableLocking();
|
||||||
@ -63,6 +74,8 @@ void main() {
|
|||||||
setUp(() {
|
setUp(() {
|
||||||
fileSystem = MemoryFileSystem.test();
|
fileSystem = MemoryFileSystem.test();
|
||||||
usage = TestUsage();
|
usage = TestUsage();
|
||||||
|
fakeProcessManager = FakeProcessManager.empty();
|
||||||
|
xcodeProjectInterpreter = FakeXcodeProjectInterpreter();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Sets up the minimal mock project files necessary to look like a Flutter project.
|
// Sets up the minimal mock project files necessary to look like a Flutter project.
|
||||||
@ -301,6 +314,50 @@ void main() {
|
|||||||
Artifacts: () => Artifacts.test(),
|
Artifacts: () => Artifacts.test(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testUsingContext('build settings contains Flutter Xcode environment variables', () async {
|
||||||
|
|
||||||
|
macosPlatformCustomEnv.environment = Map<String, String>.unmodifiable(<String, String>{
|
||||||
|
'FLUTTER_XCODE_ASSETCATALOG_COMPILER_APPICON_NAME': 'AppIcon.special'
|
||||||
|
});
|
||||||
|
|
||||||
|
final FlutterProject flutterProject = FlutterProject.fromDirectory(fileSystem.currentDirectory);
|
||||||
|
final Directory flutterBuildDir = fileSystem.directory(getMacOSBuildDirectory());
|
||||||
|
|
||||||
|
fakeProcessManager.addCommands(<FakeCommand>[
|
||||||
|
FakeCommand(
|
||||||
|
command: <String>[
|
||||||
|
'/usr/bin/env',
|
||||||
|
'xcrun',
|
||||||
|
'xcodebuild',
|
||||||
|
'-workspace', flutterProject.macos.xcodeWorkspace.path,
|
||||||
|
'-configuration', 'Debug',
|
||||||
|
'-scheme', 'Runner',
|
||||||
|
'-derivedDataPath', flutterBuildDir.absolute.path,
|
||||||
|
'OBJROOT=${fileSystem.path.join(flutterBuildDir.absolute.path, 'Build', 'Intermediates.noindex')}',
|
||||||
|
'SYMROOT=${fileSystem.path.join(flutterBuildDir.absolute.path, 'Build', 'Products')}',
|
||||||
|
'-quiet',
|
||||||
|
'COMPILER_INDEX_STORE_ENABLE=NO',
|
||||||
|
'ASSETCATALOG_COMPILER_APPICON_NAME=AppIcon.special',
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
|
final BuildCommand command = BuildCommand();
|
||||||
|
createMinimalMockProjectFiles();
|
||||||
|
|
||||||
|
await createTestCommandRunner(command).run(
|
||||||
|
const <String>['build', 'macos', '--debug', '--no-pub']
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(fakeProcessManager.hasRemainingExpectations, isFalse);
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
FileSystem: () => fileSystem,
|
||||||
|
ProcessManager: () => fakeProcessManager,
|
||||||
|
Platform: () => macosPlatformCustomEnv,
|
||||||
|
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
|
||||||
|
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
||||||
|
});
|
||||||
|
|
||||||
testUsingContext('macOS build supports build-name and build-number', () async {
|
testUsingContext('macOS build supports build-name and build-number', () async {
|
||||||
final BuildCommand command = BuildCommand();
|
final BuildCommand command = BuildCommand();
|
||||||
createMinimalMockProjectFiles();
|
createMinimalMockProjectFiles();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user