Xcode: how to make xcodebuild build a project that contains subprojects

I have an Xcode project that contains several subprojects (wireframe projects that compile as lib files) as part of the main project. The project compiles / builds correctly in Xcode (correctly builds subprojects from the bottom of the gigarchy tree to the main application project).

Now I'm trying to set up a project for Continuous Integration, and when I try to build from the command line using xcodebuild ... the assembly failed because I could not find the .a files that should have been created before the main project.

I can independently create each of the lib files from the cmd line, but the entire consolidated project crashes. Despite the fact that I correctly managed the dependencies in the target scheme, and if I specify the target or scheme when using xcodebuild, it still will not build subprojects.

Is there a way to make xcodebuild build subprojects and then the main project, as in the Xcode IDE? If not, will this work if I transform the entire project into a workspace?

Any help or suggestions would be greatly appreciated. I am running Xcode 5.1.1 on Mavericks.

+6
source share
2 answers

The solution was simple ... using the "-schema" flag instead of the "-target" allowed the project to build correctly (all subprojects / frameworks, and then the target application)

FAILED:

xcodebuild -project MyProject.xcodeproj -target MyProject -sdk "iphoneos" -configuration "Build" archive OBJROOT=../../build_iOS/Obj.root SYMROOT=../../build_iOS/Sym.root 

BUILT IN, EXPECTED:

 xcodebuild -project MyProject.xcodeproj -scheme MyProject -sdk "iphoneos" -configuration "Build" archive OBJROOT=../../build_iOS/Obj.root SYMROOT=../../build_iOS/Sym.root 

There was no need to transform the project into a workspace.

+8
source

You need to use the workspace to create multiple projects. In addition, since you are switching to a CI server, be sure to share your schemes.

+2
source

Source: https://habr.com/ru/post/969361/


All Articles