CPackWIX: Allow multiple patch files and diagnose if any are missing
CPACK_WIX_PATCH_FILE now accepts a list of patch files. An error will now be produced if any of the patch files is missing. Previously this would be silently ignored.
This commit is contained in:
parent
38d723b37e
commit
de77d4a741
|
@ -119,7 +119,8 @@
|
||||||
#
|
#
|
||||||
# .. variable:: CPACK_WIX_PATCH_FILE
|
# .. variable:: CPACK_WIX_PATCH_FILE
|
||||||
#
|
#
|
||||||
# Optional XML file with fragments to be inserted into generated WiX sources
|
# Optional list of XML files with fragments to be inserted into
|
||||||
|
# generated WiX sources
|
||||||
#
|
#
|
||||||
# This optional variable can be used to specify an XML file that the
|
# This optional variable can be used to specify an XML file that the
|
||||||
# WiX generator will use to inject fragments into its generated
|
# WiX generator will use to inject fragments into its generated
|
||||||
|
|
|
@ -242,7 +242,16 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
|
||||||
const char* patchFilePath = GetOption("CPACK_WIX_PATCH_FILE");
|
const char* patchFilePath = GetOption("CPACK_WIX_PATCH_FILE");
|
||||||
if(patchFilePath)
|
if(patchFilePath)
|
||||||
{
|
{
|
||||||
this->Patch->LoadFragments(patchFilePath);
|
std::vector<std::string> patchFilePaths;
|
||||||
|
cmSystemTools::ExpandListArgument(patchFilePath, patchFilePaths);
|
||||||
|
|
||||||
|
for(size_t i = 0; i < patchFilePaths.size(); ++i)
|
||||||
|
{
|
||||||
|
if(!this->Patch->LoadFragments(patchFilePaths[i]))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -20,10 +20,18 @@ cmWIXPatch::cmWIXPatch(cmCPackLog* logger):
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmWIXPatch::LoadFragments(std::string const& patchFilePath)
|
bool cmWIXPatch::LoadFragments(std::string const& patchFilePath)
|
||||||
{
|
{
|
||||||
cmWIXPatchParser parser(Fragments, Logger);
|
cmWIXPatchParser parser(Fragments, Logger);
|
||||||
parser.ParseFile(patchFilePath.c_str());
|
if(!parser.ParseFile(patchFilePath.c_str()))
|
||||||
|
{
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_ERROR,
|
||||||
|
"Failed parsing XML patch file: '" <<
|
||||||
|
patchFilePath << "'" << std::endl);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmWIXPatch::ApplyFragment(
|
void cmWIXPatch::ApplyFragment(
|
||||||
|
|
|
@ -26,7 +26,7 @@ class cmWIXPatch
|
||||||
public:
|
public:
|
||||||
cmWIXPatch(cmCPackLog* logger);
|
cmWIXPatch(cmCPackLog* logger);
|
||||||
|
|
||||||
void LoadFragments(std::string const& patchFilePath);
|
bool LoadFragments(std::string const& patchFilePath);
|
||||||
|
|
||||||
void ApplyFragment(std::string const& id, cmWIXSourceWriter& writer);
|
void ApplyFragment(std::string const& id, cmWIXSourceWriter& writer);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue