Merge topic 'stable-xcode-projects'
6693590f
Xcode: Refine quoting rules for Stringsa6331eb8
Xcode: Let PrintComment decide if the comment is non-empty6e8952c1
Xcode: PrintComment will prepend a whitespace itself before the comment4bd2544b
Xcode: Do not add whitespace after attribute group opening brace5cb4c838
Xcode: Properly indent PBXFileReference and PBXBuildFilea723427b
Xcode: Remove extra space in PBXProject comment2fe8bca5
Xcode: Add comment after root object2e0e205e
Xcode: Indent using tabs7b68c8df
Xcode: Sort Xcode objects by Id
This commit is contained in:
commit
da65528c36
|
@ -591,6 +591,20 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
|
|||
mf->GetHomeOutputDirectory()) << "\n";
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
static bool objectIdLessThan(cmXCodeObject* l, cmXCodeObject* r)
|
||||
{
|
||||
return l->GetId() < r->GetId();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGlobalXCodeGenerator::SortXCodeObjects()
|
||||
{
|
||||
std::sort(this->XCodeObjects.begin(), this->XCodeObjects.end(),
|
||||
objectIdLessThan);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGlobalXCodeGenerator::ClearXCodeObjects()
|
||||
{
|
||||
|
@ -3372,7 +3386,7 @@ bool cmGlobalXCodeGenerator
|
|||
}
|
||||
configlist->AddAttribute("buildConfigurations", buildConfigurations);
|
||||
|
||||
std::string comment = "Build configuration list for PBXProject ";
|
||||
std::string comment = "Build configuration list for PBXProject";
|
||||
comment += " \"";
|
||||
comment += this->CurrentProject;
|
||||
comment += "\"";
|
||||
|
@ -3713,6 +3727,8 @@ cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
|
|||
cmLocalGenerator* ,
|
||||
std::vector<cmLocalGenerator*>& )
|
||||
{
|
||||
SortXCodeObjects();
|
||||
|
||||
fout << "// !$*UTF8*$!\n";
|
||||
fout << "{\n";
|
||||
cmXCodeObject::Indent(1, fout);
|
||||
|
@ -3740,7 +3756,8 @@ cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream& fout,
|
|||
cmXCodeObject::PrintList(this->XCodeObjects, fout);
|
||||
}
|
||||
cmXCodeObject::Indent(1, fout);
|
||||
fout << "rootObject = " << this->RootObject->GetId() << ";\n";
|
||||
fout << "rootObject = " << this->RootObject->GetId()
|
||||
<< " /* Project object */;\n";
|
||||
fout << "}\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -150,6 +150,7 @@ private:
|
|||
cmXCodeObject* buildSettings,
|
||||
const std::string& buildType);
|
||||
std::string ExtractFlag(const char* flag, std::string& flags);
|
||||
void SortXCodeObjects();
|
||||
// delete all objects in the this->XCodeObjects vector.
|
||||
void ClearXCodeObjects();
|
||||
bool CreateXCodeObjects(cmLocalGenerator* root,
|
||||
|
|
|
@ -31,7 +31,11 @@ void cmXCode21Object::PrintComment(std::ostream& out)
|
|||
cmSystemTools::ReplaceString(this->Comment, "\"", "");
|
||||
}
|
||||
}
|
||||
out << "/* ";
|
||||
if(this->Comment.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
out << " /* ";
|
||||
out << this->Comment;
|
||||
out << " */";
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ void cmXCodeObject::Indent(int level, std::ostream& out)
|
|||
{
|
||||
while(level)
|
||||
{
|
||||
out << " ";
|
||||
out << "\t";
|
||||
level--;
|
||||
}
|
||||
}
|
||||
|
@ -91,18 +91,15 @@ void cmXCodeObject::Print(std::ostream& out)
|
|||
{
|
||||
std::string separator = "\n";
|
||||
int indentFactor = 1;
|
||||
cmXCodeObject::Indent(2*indentFactor, out);
|
||||
if(this->Version > 15
|
||||
&& (this->IsA == PBXFileReference || this->IsA == PBXBuildFile))
|
||||
{
|
||||
separator = " ";
|
||||
indentFactor = 0;
|
||||
}
|
||||
cmXCodeObject::Indent(2*indentFactor, out);
|
||||
out << this->Id << " ";
|
||||
if(!(this->IsA == PBXGroup && this->Comment.size() == 0))
|
||||
{
|
||||
this->PrintComment(out);
|
||||
}
|
||||
out << this->Id;
|
||||
this->PrintComment(out);
|
||||
out << " = {";
|
||||
if(separator == "\n")
|
||||
{
|
||||
|
@ -129,7 +126,7 @@ void cmXCodeObject::Print(std::ostream& out)
|
|||
for(unsigned int k = 0; k < i->second->List.size(); k++)
|
||||
{
|
||||
cmXCodeObject::Indent(4*indentFactor, out);
|
||||
out << i->second->List[k]->Id << " ";
|
||||
out << i->second->List[k]->Id;
|
||||
i->second->List[k]->PrintComment(out);
|
||||
out << "," << separator;
|
||||
}
|
||||
|
@ -139,7 +136,11 @@ void cmXCodeObject::Print(std::ostream& out)
|
|||
else if(object->TypeValue == ATTRIBUTE_GROUP)
|
||||
{
|
||||
std::map<std::string, cmXCodeObject*>::iterator j;
|
||||
out << i->first << " = {" << separator;
|
||||
out << i->first << " = {";
|
||||
if(separator == "\n")
|
||||
{
|
||||
out << separator;
|
||||
}
|
||||
for(j = object->ObjectAttributes.begin(); j !=
|
||||
object->ObjectAttributes.end(); ++j)
|
||||
{
|
||||
|
@ -188,7 +189,6 @@ void cmXCodeObject::Print(std::ostream& out)
|
|||
out << " = " << object->Object->Id;
|
||||
if(object->Object->HasComment() && i->first != "remoteGlobalIDString")
|
||||
{
|
||||
out << " ";
|
||||
object->Object->PrintComment(out);
|
||||
}
|
||||
out << ";" << separator;
|
||||
|
@ -243,7 +243,7 @@ void cmXCodeObject::PrintString(std::ostream& os,std::string String)
|
|||
bool needQuote =
|
||||
(String.empty() ||
|
||||
String.find("//") != String.npos ||
|
||||
String.find_first_of(" <>.+-=@$[],") != String.npos);
|
||||
String.find_first_of(" <>+-*=@[](){},") != String.npos);
|
||||
const char* quote = needQuote? "\"" : "";
|
||||
|
||||
// Print the string, quoted and escaped as necessary.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
set(expect-default "explicitFileType = sourcecode")
|
||||
set(expect-explicit "explicitFileType = \"sourcecode.c.h\"")
|
||||
set(expect-lastKnown "lastKnownFileType = \"sourcecode.c.h\"")
|
||||
set(expect-explicit "explicitFileType = sourcecode.c.h")
|
||||
set(expect-lastKnown "lastKnownFileType = sourcecode.c.h")
|
||||
foreach(src default explicit lastKnown)
|
||||
file(STRINGS ${RunCMake_TEST_BINARY_DIR}/XcodeFileType.xcodeproj/project.pbxproj actual-${src}
|
||||
REGEX "PBXFileReference.*src-${src}")
|
||||
|
|
Loading…
Reference in New Issue