More details:
We share a particularly complex package structure under iOS and macOS projects, it has multiple subpackages and a total of dozens of targets, each subpackage on the iOS side needs to be packaged into dynamic frameworks using the xcodebuild archive, and on the Mac side the outermost package into .a static library
Before is to use some strange third-party tools to regenerate the Xcode project from package, now is to streamline the process directly with xcodebuild and swift build to compile swift package, and then ran into this problem: if I set the subpackage into a dynamic library, the Mac's static library can not be packaged, and vice versa. If I set the subpackage to a dynamic library, the Mac can't package it, and vice versa, so I'm trying to control it with environment variables, but it doesn't work with xcodebuild.