Skip to content

Commit

Permalink
fix: **BREAKING ** changes default of CONFIGURATION_BUILD_DIR
Browse files Browse the repository at this point in the history
this aims to fix apache#659 and apache#617
  • Loading branch information
cmfsotelo committed Nov 28, 2022
1 parent 95adac3 commit baea0b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
6 changes: 4 additions & 2 deletions bin/templates/scripts/cordova/lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ function getXcodeBuildArgs (projectName, projectPath, configuration, isDevice, b
];
buildActions = ['archive'];
settings = [
customArgs.configuration_build_dir || `CONFIGURATION_BUILD_DIR=${path.join(projectPath, 'build', 'device')}`,
customArgs.shared_precomps_dir || `SHARED_PRECOMPS_DIR=${path.join(projectPath, 'build', 'sharedpch')}`
];
// Add other matched flags to otherFlags to let xcodebuild present an appropriate error.
Expand All @@ -348,7 +347,6 @@ function getXcodeBuildArgs (projectName, projectPath, configuration, isDevice, b
];
buildActions = ['build'];
settings = [
customArgs.configuration_build_dir || `CONFIGURATION_BUILD_DIR=${path.join(projectPath, 'build', 'emulator')}`,
customArgs.shared_precomps_dir || `SHARED_PRECOMPS_DIR=${path.join(projectPath, 'build', 'sharedpch')}`
];
// Add other matched flags to otherFlags to let xcodebuild present an appropriate error.
Expand All @@ -358,6 +356,10 @@ function getXcodeBuildArgs (projectName, projectPath, configuration, isDevice, b
}
}

if (customArgs.configuration_build_dir) {
settings.push(customArgs.configuration_build_dir);
}

return options.concat(buildActions).concat(settings).concat(customArgs.otherFlags);
}

Expand Down
22 changes: 8 additions & 14 deletions tests/spec/unit/build.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ describe('build', () => {
'-archivePath',
'TestProjectName.xcarchive',
'archive',
`CONFIGURATION_BUILD_DIR=${path.join(testProjectPath, 'build', 'device')}`,
`SHARED_PRECOMPS_DIR=${path.join(testProjectPath, 'build', 'sharedpch')}`
]);
expect(args.length).toEqual(13);
expect(args.length).toEqual(12);
});

it('should generate appropriate args if buildFlags are passed in', () => {
Expand Down Expand Up @@ -78,8 +77,8 @@ describe('build', () => {
'-archivePath',
'TestArchivePathFlag',
'archive',
'CONFIGURATION_BUILD_DIR=TestConfigBuildDirFlag',
'SHARED_PRECOMPS_DIR=TestSharedPrecompsDirFlag'
'SHARED_PRECOMPS_DIR=TestSharedPrecompsDirFlag',
'CONFIGURATION_BUILD_DIR=TestConfigBuildDirFlag'
]);
expect(args.length).toEqual(13);
});
Expand All @@ -99,10 +98,9 @@ describe('build', () => {
'-archivePath',
'TestProjectName.xcarchive',
'archive',
`CONFIGURATION_BUILD_DIR=${path.join(testProjectPath, 'build', 'device')}`,
`SHARED_PRECOMPS_DIR=${path.join(testProjectPath, 'build', 'sharedpch')}`
]);
expect(args.length).toEqual(13);
expect(args.length).toEqual(12);
});

it('should generate appropriate args for simulator', () => {
Expand All @@ -120,10 +118,9 @@ describe('build', () => {
'-destination',
'platform=iOS Simulator,name=iPhone 5s',
'build',
`CONFIGURATION_BUILD_DIR=${path.join(testProjectPath, 'build', 'emulator')}`,
`SHARED_PRECOMPS_DIR=${path.join(testProjectPath, 'build', 'sharedpch')}`
]);
expect(args.length).toEqual(13);
expect(args.length).toEqual(12);
});

it('should add matched flags that are not overriding for device', () => {
Expand All @@ -143,12 +140,11 @@ describe('build', () => {
'-archivePath',
'TestProjectName.xcarchive',
'archive',
`CONFIGURATION_BUILD_DIR=${path.join(testProjectPath, 'build', 'device')}`,
`SHARED_PRECOMPS_DIR=${path.join(testProjectPath, 'build', 'sharedpch')}`,
'-sdk',
'TestSdkFlag'
]);
expect(args.length).toEqual(15);
expect(args.length).toEqual(14);
});

it('should add matched flags that are not overriding for simulator', () => {
Expand All @@ -168,12 +164,11 @@ describe('build', () => {
'-destination',
'platform=iOS Simulator,name=iPhone 5s',
'build',
`CONFIGURATION_BUILD_DIR=${path.join(testProjectPath, 'build', 'emulator')}`,
`SHARED_PRECOMPS_DIR=${path.join(testProjectPath, 'build', 'sharedpch')}`,
'-archivePath',
'TestArchivePathFlag'
]);
expect(args.length).toEqual(15);
expect(args.length).toEqual(14);
});

it('should generate appropriate args for automatic provisioning', () => {
Expand All @@ -192,10 +187,9 @@ describe('build', () => {
'TestProjectName.xcarchive',
'-allowProvisioningUpdates',
'archive',
`CONFIGURATION_BUILD_DIR=${path.join(testProjectPath, 'build', 'device')}`,
`SHARED_PRECOMPS_DIR=${path.join(testProjectPath, 'build', 'sharedpch')}`
]);
expect(args.length).toEqual(14);
expect(args.length).toEqual(13);
});
});

Expand Down

0 comments on commit baea0b6

Please sign in to comment.