OS X: Add handling for XCTest bundles
An XCTest bundle is a CFBundle with a special product-type and bundle extension. For more information about XCTest visit the Mac Developer library at: http://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/testing_with_xcode/ Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
This commit is contained in:
parent
54a5cdbb4c
commit
3714955b9c
|
@ -243,6 +243,7 @@ Properties on Targets
|
||||||
/prop_tgt/VS_WINRT_REFERENCES
|
/prop_tgt/VS_WINRT_REFERENCES
|
||||||
/prop_tgt/WIN32_EXECUTABLE
|
/prop_tgt/WIN32_EXECUTABLE
|
||||||
/prop_tgt/XCODE_ATTRIBUTE_an-attribute
|
/prop_tgt/XCODE_ATTRIBUTE_an-attribute
|
||||||
|
/prop_tgt/XCTEST
|
||||||
|
|
||||||
Properties on Tests
|
Properties on Tests
|
||||||
===================
|
===================
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
XCTEST
|
||||||
|
------
|
||||||
|
|
||||||
|
This target is a XCTest CFBundle on the Mac.
|
||||||
|
|
||||||
|
This property will usually get set via the :command:`xctest_add_bundle`
|
||||||
|
macro in :module:`FindXCTest` module.
|
||||||
|
|
||||||
|
If a module library target has this property set to true it will be
|
||||||
|
built as a CFBundle when built on the Mac. It will have the directory
|
||||||
|
structure required for a CFBundle.
|
||||||
|
|
||||||
|
This property depends on :prop_tgt:`BUNDLE` to be effective.
|
|
@ -804,6 +804,10 @@ GetSourcecodeValueFromFileExtension(const std::string& _ext,
|
||||||
{
|
{
|
||||||
sourcecode = "compiled.mach-o.objfile";
|
sourcecode = "compiled.mach-o.objfile";
|
||||||
}
|
}
|
||||||
|
else if(ext == "xctest")
|
||||||
|
{
|
||||||
|
sourcecode = "wrapper.cfbundle";
|
||||||
|
}
|
||||||
else if(ext == "xib")
|
else if(ext == "xib")
|
||||||
{
|
{
|
||||||
keepLastKnownFileType = true;
|
keepLastKnownFileType = true;
|
||||||
|
@ -2598,7 +2602,9 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType(cmTarget& cmtarget)
|
||||||
case cmTarget::STATIC_LIBRARY:
|
case cmTarget::STATIC_LIBRARY:
|
||||||
return "archive.ar";
|
return "archive.ar";
|
||||||
case cmTarget::MODULE_LIBRARY:
|
case cmTarget::MODULE_LIBRARY:
|
||||||
if (cmtarget.IsCFBundleOnApple())
|
if (cmtarget.IsXCTestOnApple())
|
||||||
|
return "wrapper.cfbundle";
|
||||||
|
else if (cmtarget.IsCFBundleOnApple())
|
||||||
return "wrapper.plug-in";
|
return "wrapper.plug-in";
|
||||||
else
|
else
|
||||||
return ((this->XcodeVersion >= 22)?
|
return ((this->XcodeVersion >= 22)?
|
||||||
|
@ -2622,7 +2628,9 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType(cmTarget& cmtarget)
|
||||||
case cmTarget::STATIC_LIBRARY:
|
case cmTarget::STATIC_LIBRARY:
|
||||||
return "com.apple.product-type.library.static";
|
return "com.apple.product-type.library.static";
|
||||||
case cmTarget::MODULE_LIBRARY:
|
case cmTarget::MODULE_LIBRARY:
|
||||||
if (cmtarget.IsCFBundleOnApple())
|
if (cmtarget.IsXCTestOnApple())
|
||||||
|
return "com.apple.product-type.bundle.unit-test";
|
||||||
|
else if (cmtarget.IsCFBundleOnApple())
|
||||||
return "com.apple.product-type.bundle";
|
return "com.apple.product-type.bundle";
|
||||||
else
|
else
|
||||||
return ((this->XcodeVersion >= 22)?
|
return ((this->XcodeVersion >= 22)?
|
||||||
|
|
|
@ -615,6 +615,13 @@ bool cmTarget::IsCFBundleOnApple() const
|
||||||
this->GetPropertyAsBool("BUNDLE"));
|
this->GetPropertyAsBool("BUNDLE"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool cmTarget::IsXCTestOnApple() const
|
||||||
|
{
|
||||||
|
return (this->IsCFBundleOnApple() &&
|
||||||
|
this->GetPropertyAsBool("XCTEST"));
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmTarget::IsBundleOnApple() const
|
bool cmTarget::IsBundleOnApple() const
|
||||||
{
|
{
|
||||||
|
@ -6791,7 +6798,14 @@ std::string cmTarget::GetCFBundleDirectory(const std::string& config,
|
||||||
const char *ext = this->GetProperty("BUNDLE_EXTENSION");
|
const char *ext = this->GetProperty("BUNDLE_EXTENSION");
|
||||||
if (!ext)
|
if (!ext)
|
||||||
{
|
{
|
||||||
ext = "bundle";
|
if (this->IsXCTestOnApple())
|
||||||
|
{
|
||||||
|
ext = "xctest";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ext = "bundle";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fpath += ext;
|
fpath += ext;
|
||||||
fpath += "/Contents";
|
fpath += "/Contents";
|
||||||
|
|
|
@ -527,6 +527,9 @@ public:
|
||||||
/** Return whether this target is a CFBundle (plugin) on Apple. */
|
/** Return whether this target is a CFBundle (plugin) on Apple. */
|
||||||
bool IsCFBundleOnApple() const;
|
bool IsCFBundleOnApple() const;
|
||||||
|
|
||||||
|
/** Return whether this target is a XCTest on Apple. */
|
||||||
|
bool IsXCTestOnApple() const;
|
||||||
|
|
||||||
/** Return whether this target is an executable Bundle on Apple. */
|
/** Return whether this target is an executable Bundle on Apple. */
|
||||||
bool IsAppBundleOnApple() const;
|
bool IsAppBundleOnApple() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue