xcodebuild clean deletes non-target files in BUILD_DIR - new in Xcode 12.5

803 views Asked by At

I have our Xcode build system setup to place all build products in a pair of directories, one for Debug configuration and the other for Release using the build setting

BUILD_DIR = /Library/DevWork/BuildProducts

specified in a shared .xconfig file.

This worked fine up through Xcode 12.4 as the xcodebuild clean command would delete only the target and leave all the other files in the build products directory intact.

New with Xcode 12.5, xcodebuild clean deletes the entire contents of the build products directory. Is there a way to disable this behavior?

1

There are 1 answers

1
Caleb On

New with Xcode 12.5, xcodebuild clean deletes the entire contents of the build products directory. Is there a way to disable this behavior?

The behavior isn't actually new with Xcode 12.5; it's been part of the "new build system" since it was introduced in Xcode 10:

The new build system uses the “clean build folder” behavior. The legacy “clean” behavior is not supported.

The "legacy" build system has been deprecated for a while. I don't know if it's still available at all in Xcode 12.5, but whether it is or not, it's time to make the move to the new system.

Is there a way to disable this behavior?

No.

If you really need to keep old build artifacts around, you could add a post-build script that copies them to another location.