forked from qt-creator/qt-creator
Python: exclude the project file from the list of files to save
Amends 8d733f95e6
Change-Id: Ia9d1f29dd85a9560f4fe4e808cba625f1b24ad2c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -120,9 +120,8 @@ static QJsonObject readObjJson(const FilePath &projectFile, QString *errorMessag
|
|||||||
|
|
||||||
static QStringList readLines(const FilePath &projectFile)
|
static QStringList readLines(const FilePath &projectFile)
|
||||||
{
|
{
|
||||||
const QString projectFileName = projectFile.fileName();
|
QSet<QString> visited;
|
||||||
QSet<QString> visited = { projectFileName };
|
QStringList lines;
|
||||||
QStringList lines = { projectFileName };
|
|
||||||
|
|
||||||
const expected_str<QByteArray> contents = projectFile.fileContents();
|
const expected_str<QByteArray> contents = projectFile.fileContents();
|
||||||
if (contents) {
|
if (contents) {
|
||||||
@@ -144,9 +143,8 @@ static QStringList readLines(const FilePath &projectFile)
|
|||||||
|
|
||||||
static QStringList readLinesJson(const FilePath &projectFile, QString *errorMessage)
|
static QStringList readLinesJson(const FilePath &projectFile, QString *errorMessage)
|
||||||
{
|
{
|
||||||
const QString projectFileName = projectFile.fileName();
|
QSet<QString> visited;
|
||||||
QSet<QString> visited = { projectFileName };
|
QStringList lines;
|
||||||
QStringList lines = { projectFileName };
|
|
||||||
|
|
||||||
const QJsonObject obj = readObjJson(projectFile, errorMessage);
|
const QJsonObject obj = readObjJson(projectFile, errorMessage);
|
||||||
for (const QJsonValue &file : obj.value("files").toArray()) {
|
for (const QJsonValue &file : obj.value("files").toArray()) {
|
||||||
@@ -205,8 +203,6 @@ static FileType getFileType(const FilePath &f)
|
|||||||
{
|
{
|
||||||
if (f.endsWith(".py"))
|
if (f.endsWith(".py"))
|
||||||
return FileType::Source;
|
return FileType::Source;
|
||||||
if (f.endsWith(".pyproject") || f.endsWith(".pyqtc"))
|
|
||||||
return FileType::Project;
|
|
||||||
if (f.endsWith(".qrc"))
|
if (f.endsWith(".qrc"))
|
||||||
return FileType::Resource;
|
return FileType::Resource;
|
||||||
if (f.endsWith(".ui"))
|
if (f.endsWith(".ui"))
|
||||||
@@ -221,11 +217,16 @@ void PythonBuildSystem::triggerParsing()
|
|||||||
ParseGuard guard = guardParsingRun();
|
ParseGuard guard = guardParsingRun();
|
||||||
parse();
|
parse();
|
||||||
|
|
||||||
const QDir baseDir(projectDirectory().toString());
|
|
||||||
QList<BuildTargetInfo> appTargets;
|
QList<BuildTargetInfo> appTargets;
|
||||||
|
|
||||||
auto newRoot = std::make_unique<PythonProjectNode>(projectDirectory());
|
auto newRoot = std::make_unique<PythonProjectNode>(projectDirectory());
|
||||||
for (const FileEntry &entry: std::as_const(m_files)) {
|
|
||||||
|
const FilePath projectFile = projectFilePath();
|
||||||
|
const QString displayName = projectFile.relativePathFrom(projectDirectory()).toUserOutput();
|
||||||
|
newRoot->addNestedNode(
|
||||||
|
std::make_unique<PythonFileNode>(projectFile, displayName, FileType::Project));
|
||||||
|
|
||||||
|
for (const FileEntry &entry : std::as_const(m_files)) {
|
||||||
const QString displayName = entry.filePath.relativePathFrom(projectDirectory()).toUserOutput();
|
const QString displayName = entry.filePath.relativePathFrom(projectDirectory()).toUserOutput();
|
||||||
const FileType fileType = getFileType(entry.filePath);
|
const FileType fileType = getFileType(entry.filePath);
|
||||||
|
|
||||||
@@ -236,7 +237,7 @@ void PythonBuildSystem::triggerParsing()
|
|||||||
bti.displayName = displayName;
|
bti.displayName = displayName;
|
||||||
bti.buildKey = entry.filePath.toString();
|
bti.buildKey = entry.filePath.toString();
|
||||||
bti.targetFilePath = entry.filePath;
|
bti.targetFilePath = entry.filePath;
|
||||||
bti.projectFilePath = projectFilePath();
|
bti.projectFilePath = projectFile;
|
||||||
bti.isQtcRunnable = entry.filePath.fileName() == "main.py";
|
bti.isQtcRunnable = entry.filePath.fileName() == "main.py";
|
||||||
appTargets.append(bti);
|
appTargets.append(bti);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user