forked from qt-creator/qt-creator
When parsing remote .pro files the parsers needs to pretend it runs on the remote device. All internal data are now "local on the remote", so that string manipulation in .pro files "just works", and a 'device root' string is passed around to relevant functions which then use it to construct FilePath::toFSPathString()-style paths that our custom FSEngineImpl can then map to the real device. Remote $$system() calls are intercepted by the local parser and redirected using the usual QtcProcess mechanims. Quite a bit of the ProParser needed adjustments, so there's some potential for regression. Task-number: QTCREATORBUG-28242 Task-number: QTCREATORBUG-28161 Task-number: QTCREATORBUG-28355 Change-Id: I6100e7aca4e1db35f5e9689004110aab57e2c595 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
64 lines
2.1 KiB
C++
64 lines
2.1 KiB
C++
// Copyright (C) 2016 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
#pragma once
|
|
|
|
#include "qmake_global.h"
|
|
#include <QStringList>
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
class QDir;
|
|
class ProFile;
|
|
QT_END_NAMESPACE
|
|
|
|
namespace QmakeProjectManager {
|
|
namespace Internal {
|
|
|
|
class QMAKE_EXPORT ProWriter
|
|
{
|
|
public:
|
|
enum PutFlag {
|
|
AppendValues = 0,
|
|
ReplaceValues = 1,
|
|
OneLine = 0, // this works only when replacing (or adding a new assignment)
|
|
MultiLine = 2,
|
|
AssignOperator = 0, // ignored when changing an existing assignment
|
|
AppendOperator = 4
|
|
};
|
|
Q_DECLARE_FLAGS(PutFlags, PutFlag)
|
|
|
|
static void putVarValues(ProFile *profile, QStringList *lines,
|
|
const QStringList &values, const QString &var, PutFlags flags,
|
|
const QString &scope, const QString &continuationIndent);
|
|
|
|
using VarLocation = QPair<QString, int>;
|
|
using VarLocations = QList<VarLocation>;
|
|
static QList<int> removeVarValues(
|
|
ProFile *profile,
|
|
QStringList *lines,
|
|
const QStringList &values,
|
|
const QStringList &vars,
|
|
VarLocations *removedLocations = nullptr
|
|
);
|
|
|
|
static void addFiles(ProFile *profile, QStringList *lines, const QStringList &filePaths,
|
|
const QString &var, const QString &continuationIndent);
|
|
static QStringList removeFiles(
|
|
ProFile *profile,
|
|
QStringList *lines,
|
|
const QDir &proFileDir,
|
|
const QStringList &filePaths,
|
|
const QStringList &vars,
|
|
VarLocations *removedLocations = nullptr);
|
|
|
|
private:
|
|
static bool locateVarValues(const QString &device, const ushort *tokPtr, const ushort *tokPtrEnd,
|
|
const QString &scope, const QString &var, int *scopeStart, int *bestLine);
|
|
static QString compileScope(const QString &device, const QString &scope);
|
|
};
|
|
|
|
} // namespace Internal
|
|
} // namespace QmakeProjectManager
|
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(QmakeProjectManager::Internal::ProWriter::PutFlags)
|