Bitrise not respecting public/private headers

I’m building a dynamic framework via a bash step using xcode build.
xcodebuild clean build -scheme <correct scheme> -configuration Release

This kicks off two additional builds in post run script,

xcodebuild -workspace <workspace> -scheme <correct scheme> -sdk iphoneos -configuration Release -derivedDataPath ${BUILD_DIR}
xcodebuild -workspace <workspace> -scheme <correct scheme> -sdk iphonesimulator -configuration Release -derivedDataPath ${BUILD_DIR}

When running locally either via Xcode or using the top command, only the public headers are shown in the MyFramework.framework/Headers folder. But using Bitrise, it populates that folder with all headers - which we’d like to keep private.

If you run the xcodebuild command from a Script step, there’s absolutely no Bitrise specific thing going on. That’s just pure Xcode Command Line tools (xcodebuild), exactly the way you run it.

I’d suggest you to try these local debug/reproduction steps, and let us know if that helps / how that goes: