Skip to content

Commit 1539324

Browse files
committed
fixed #13623 - reworked handling of options in GUI projects [skip ci]
1 parent fd3e458 commit 1539324

File tree

3 files changed

+159
-148
lines changed

3 files changed

+159
-148
lines changed

cli/cmdlineparser.cpp

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,32 +1139,23 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
11391139

11401140
mSettings.checkAllConfigurations = false; // Can be overridden with --max-configs or --force
11411141
std::string projectFile = argv[i]+10;
1142-
ImportProject::Type projType = project.import(projectFile, &mSettings);
1142+
ImportProject::Type projType = project.import(projectFile, mSettings.fileFilters);
11431143
project.projectType = projType;
11441144
if (projType == ImportProject::Type::CPPCHECK_GUI) {
1145-
for (const std::string &lib : project.guiProject.libraries)
1146-
mSettings.libraries.emplace_back(lib);
1147-
1148-
const auto& excludedPaths = project.guiProject.excludedPaths;
1149-
std::copy(excludedPaths.cbegin(), excludedPaths.cend(), std::back_inserter(mIgnoredPaths));
1150-
1151-
std::string platform(project.guiProject.platform);
1152-
1153-
// keep existing platform from command-line intact
1154-
if (!platform.empty()) {
1155-
std::string errstr;
1156-
const std::vector<std::string> paths = {projectFile, argv[0]};
1157-
if (!mSettings.platform.set(platform, errstr, paths, mSettings.debuglookup || mSettings.debuglookupPlatform)) {
1158-
mLogger.printError(errstr);
1159-
return Result::Fail;
1160-
}
1161-
}
1162-
1145+
if (mSettings.debugnormal && !project.guiProject.args.empty()) // TODO: add separate debug option
1146+
std::cout << project.guiProject.args << std::endl;
1147+
// TODO: inject arguments
11631148
const auto& projectFileGui = project.guiProject.projectFile;
11641149
if (!projectFileGui.empty()) {
11651150
// read underlying project
11661151
projectFile = projectFileGui;
1167-
projType = project.import(projectFileGui, &mSettings);
1152+
projType = project.import(projectFileGui, mSettings.fileFilters);
1153+
if (projType == ImportProject::Type::CPPCHECK_GUI) {
1154+
if (mSettings.debugnormal && !project.guiProject.args.empty()) // TODO: add separate debug option
1155+
std::cout << project.guiProject.args << std::endl;
1156+
// TODO: inject arguments
1157+
// TODO: inception
1158+
}
11681159
}
11691160
}
11701161
if (projType == ImportProject::Type::VS_SLN || projType == ImportProject::Type::VS_VCXPROJ) {
@@ -1577,15 +1568,12 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
15771568
}
15781569

15791570
// Print error only if we have "real" command and expect files
1580-
if (mPathNames.empty() && project.guiProject.pathNames.empty() && project.fileSettings.empty()) {
1571+
if (mPathNames.empty() && project.fileSettings.empty()) {
15811572
// TODO: this message differs from the one reported in fillSettingsFromArgs()
15821573
mLogger.printError("no C or C++ source files found.");
15831574
return Result::Fail;
15841575
}
15851576

1586-
if (!project.guiProject.pathNames.empty())
1587-
mPathNames = project.guiProject.pathNames;
1588-
15891577
if (!project.fileSettings.empty()) {
15901578
project.ignorePaths(mIgnoredPaths);
15911579
if (project.fileSettings.empty()) {

0 commit comments

Comments
 (0)