File indexing completed on 2024-05-19 04:41:35
0001 /* 0002 SPDX-FileCopyrightText: 2006 Andreas Pakulat <apaku@gmx.de> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "qmakedriver.h" 0008 0009 #include <KAboutData> 0010 0011 #include <QCoreApplication> 0012 #include <QCommandLineParser> 0013 #include <QCommandLineOption> 0014 0015 int main(int argc, char* argv[]) 0016 { 0017 QCoreApplication app(argc, argv); 0018 0019 KAboutData aboutData(QLatin1String("QMake Parser"), QLatin1String("qmake-parser"), QLatin1String("1.0")); 0020 aboutData.setShortDescription(QLatin1String("Parse QMake project files")); 0021 KAboutData::setApplicationData(aboutData); 0022 0023 QCommandLineParser parser; 0024 aboutData.setupCommandLine(&parser); 0025 parser.addOption(QCommandLineOption(QLatin1String("debug"), QLatin1String("Enable output of the debug AST"))); 0026 parser.addPositionalArgument(QLatin1String("files"), QLatin1String("QMake project files")); 0027 0028 parser.process(app); 0029 aboutData.processCommandLine(&parser); 0030 0031 if (parser.positionalArguments().isEmpty()) { 0032 parser.showHelp(); 0033 return EXIT_FAILURE; 0034 } 0035 0036 const bool debug = parser.isSet(QLatin1String("debug")); 0037 0038 foreach (const auto arg, parser.positionalArguments()) { 0039 QMake::Driver driver; 0040 if (!driver.readFile(arg)) { 0041 exit(EXIT_FAILURE); 0042 } 0043 driver.setDebug(debug); 0044 0045 QMake::ProjectAST* ast = nullptr; 0046 if (!driver.parse(&ast)) { 0047 exit(EXIT_FAILURE); 0048 } 0049 } 0050 return EXIT_SUCCESS; 0051 }