forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.15'
Change-Id: I4460bd05582ea3cfb561374ed8e6a9fcb983caf4
This commit is contained in:
@@ -52,7 +52,7 @@ def get_arguments():
|
|||||||
parser = argparse.ArgumentParser(description='Build Qt Creator for packaging')
|
parser = argparse.ArgumentParser(description='Build Qt Creator for packaging')
|
||||||
parser.add_argument('--src', help='path to sources', required=True)
|
parser.add_argument('--src', help='path to sources', required=True)
|
||||||
parser.add_argument('--build', help='path that should be used for building', required=True)
|
parser.add_argument('--build', help='path that should be used for building', required=True)
|
||||||
parser.add_argument('--qt-path', help='Path to Qt', required=True)
|
parser.add_argument('--qt-path', help='Path to Qt')
|
||||||
|
|
||||||
parser.add_argument('--build-type', help='Build type to pass to CMake (defaults to RelWithDebInfo)',
|
parser.add_argument('--build-type', help='Build type to pass to CMake (defaults to RelWithDebInfo)',
|
||||||
default='RelWithDebInfo')
|
default='RelWithDebInfo')
|
||||||
@@ -79,6 +79,9 @@ def get_arguments():
|
|||||||
parser.add_argument('--python3', help='File path to python3 executable for generating translations',
|
parser.add_argument('--python3', help='File path to python3 executable for generating translations',
|
||||||
default=default_python3())
|
default=default_python3())
|
||||||
|
|
||||||
|
parser.add_argument('--no-qtcreator',
|
||||||
|
help='Skip Qt Creator build (only build separate tools)',
|
||||||
|
action='store_true', default=False)
|
||||||
parser.add_argument('--no-cdb',
|
parser.add_argument('--no-cdb',
|
||||||
help='Skip cdbextension and the python dependency packaging step (Windows)',
|
help='Skip cdbextension and the python dependency packaging step (Windows)',
|
||||||
action='store_true', default=(not common.is_windows_platform()))
|
action='store_true', default=(not common.is_windows_platform()))
|
||||||
@@ -105,6 +108,9 @@ def get_arguments():
|
|||||||
default='')
|
default='')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
args.with_debug_info = args.build_type == 'RelWithDebInfo'
|
args.with_debug_info = args.build_type == 'RelWithDebInfo'
|
||||||
|
|
||||||
|
if not args.qt_path and not args.no_qtcreator:
|
||||||
|
parser.error("argument --qt-path is required if --no-qtcreator is not given")
|
||||||
return args
|
return args
|
||||||
|
|
||||||
def common_cmake_arguments(args):
|
def common_cmake_arguments(args):
|
||||||
@@ -136,6 +142,8 @@ def common_cmake_arguments(args):
|
|||||||
return cmake_args
|
return cmake_args
|
||||||
|
|
||||||
def build_qtcreator(args, paths):
|
def build_qtcreator(args, paths):
|
||||||
|
if args.no_qtcreator:
|
||||||
|
return
|
||||||
if not os.path.exists(paths.build):
|
if not os.path.exists(paths.build):
|
||||||
os.makedirs(paths.build)
|
os.makedirs(paths.build)
|
||||||
prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt]
|
prefix_paths = [os.path.abspath(fp) for fp in args.prefix_paths] + [paths.qt]
|
||||||
@@ -235,19 +243,20 @@ def build_qtcreatorcdbext(args, paths):
|
|||||||
|
|
||||||
def package_qtcreator(args, paths):
|
def package_qtcreator(args, paths):
|
||||||
if not args.no_zip:
|
if not args.no_zip:
|
||||||
common.check_print_call(['7z', 'a', '-mmt2',
|
if not args.no_qtcreator:
|
||||||
os.path.join(paths.result, 'qtcreator' + args.zip_infix + '.7z'),
|
|
||||||
'*'],
|
|
||||||
paths.install)
|
|
||||||
common.check_print_call(['7z', 'a', '-mmt2',
|
|
||||||
os.path.join(paths.result, 'qtcreator' + args.zip_infix + '_dev.7z'),
|
|
||||||
'*'],
|
|
||||||
paths.dev_install)
|
|
||||||
if args.with_debug_info:
|
|
||||||
common.check_print_call(['7z', 'a', '-mmt2',
|
common.check_print_call(['7z', 'a', '-mmt2',
|
||||||
os.path.join(paths.result, 'qtcreator' + args.zip_infix + '-debug.7z'),
|
os.path.join(paths.result, 'qtcreator' + args.zip_infix + '.7z'),
|
||||||
'*'],
|
'*'],
|
||||||
paths.debug_install)
|
paths.install)
|
||||||
|
common.check_print_call(['7z', 'a', '-mmt2',
|
||||||
|
os.path.join(paths.result, 'qtcreator' + args.zip_infix + '_dev.7z'),
|
||||||
|
'*'],
|
||||||
|
paths.dev_install)
|
||||||
|
if args.with_debug_info:
|
||||||
|
common.check_print_call(['7z', 'a', '-mmt2',
|
||||||
|
os.path.join(paths.result, 'qtcreator' + args.zip_infix + '-debug.7z'),
|
||||||
|
'*'],
|
||||||
|
paths.debug_install)
|
||||||
if common.is_windows_platform():
|
if common.is_windows_platform():
|
||||||
common.check_print_call(['7z', 'a', '-mmt2',
|
common.check_print_call(['7z', 'a', '-mmt2',
|
||||||
os.path.join(paths.result, 'wininterrupt' + args.zip_infix + '.7z'),
|
os.path.join(paths.result, 'wininterrupt' + args.zip_infix + '.7z'),
|
||||||
@@ -259,17 +268,16 @@ def package_qtcreator(args, paths):
|
|||||||
'*'],
|
'*'],
|
||||||
paths.qtcreatorcdbext_install)
|
paths.qtcreatorcdbext_install)
|
||||||
|
|
||||||
if common.is_mac_platform():
|
if common.is_mac_platform() and not args.no_dmg and not args.no_qtcreator:
|
||||||
if args.keychain_unlock_script:
|
if args.keychain_unlock_script:
|
||||||
common.check_print_call([args.keychain_unlock_script], paths.install)
|
common.check_print_call([args.keychain_unlock_script], paths.install)
|
||||||
if not args.no_dmg:
|
common.check_print_call(['python', '-u',
|
||||||
common.check_print_call(['python', '-u',
|
os.path.join(paths.src, 'scripts', 'makedmg.py'),
|
||||||
os.path.join(paths.src, 'scripts', 'makedmg.py'),
|
'qt-creator' + args.zip_infix + '.dmg',
|
||||||
'qt-creator' + args.zip_infix + '.dmg',
|
'Qt Creator',
|
||||||
'Qt Creator',
|
paths.src,
|
||||||
paths.src,
|
paths.install],
|
||||||
paths.install],
|
paths.result)
|
||||||
paths.result)
|
|
||||||
|
|
||||||
def get_paths(args):
|
def get_paths(args):
|
||||||
Paths = collections.namedtuple('Paths',
|
Paths = collections.namedtuple('Paths',
|
||||||
@@ -279,7 +287,8 @@ def get_paths(args):
|
|||||||
'elfutils', 'llvm'])
|
'elfutils', 'llvm'])
|
||||||
build_path = os.path.abspath(args.build)
|
build_path = os.path.abspath(args.build)
|
||||||
install_path = os.path.join(build_path, 'install')
|
install_path = os.path.join(build_path, 'install')
|
||||||
return Paths(qt=os.path.abspath(args.qt_path),
|
qt_path = os.path.abspath(args.qt_path) if args.qt_path else None
|
||||||
|
return Paths(qt=qt_path,
|
||||||
src=os.path.abspath(args.src),
|
src=os.path.abspath(args.src),
|
||||||
build=os.path.join(build_path, 'build'),
|
build=os.path.join(build_path, 'build'),
|
||||||
wininterrupt_build=os.path.join(build_path, 'build-wininterrupt'),
|
wininterrupt_build=os.path.join(build_path, 'build-wininterrupt'),
|
||||||
|
@@ -66,14 +66,18 @@
|
|||||||
#include <utils/progressindicator.h>
|
#include <utils/progressindicator.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
|
#include <utils/variablechooser.h>
|
||||||
|
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QPlainTextEdit>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
@@ -112,6 +116,8 @@ private:
|
|||||||
|
|
||||||
bool eventFilter(QObject *target, QEvent *event) override;
|
bool eventFilter(QObject *target, QEvent *event) override;
|
||||||
|
|
||||||
|
void batchEditConfiguration();
|
||||||
|
|
||||||
CMakeBuildConfiguration *m_buildConfiguration;
|
CMakeBuildConfiguration *m_buildConfiguration;
|
||||||
QTreeView *m_configView;
|
QTreeView *m_configView;
|
||||||
ConfigModel *m_configModel;
|
ConfigModel *m_configModel;
|
||||||
@@ -130,6 +136,8 @@ private:
|
|||||||
QTimer m_showProgressTimer;
|
QTimer m_showProgressTimer;
|
||||||
FancyLineEdit *m_filterEdit;
|
FancyLineEdit *m_filterEdit;
|
||||||
InfoLabel *m_warningMessageLabel;
|
InfoLabel *m_warningMessageLabel;
|
||||||
|
|
||||||
|
QPushButton *m_batchEditButton = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
static QModelIndex mapToSource(const QAbstractItemView *view, const QModelIndex &idx)
|
static QModelIndex mapToSource(const QAbstractItemView *view, const QModelIndex &idx)
|
||||||
@@ -288,6 +296,9 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
|
|||||||
m_clearSelectionButton->setEnabled(false);
|
m_clearSelectionButton->setEnabled(false);
|
||||||
buttonLayout->addWidget(m_clearSelectionButton);
|
buttonLayout->addWidget(m_clearSelectionButton);
|
||||||
buttonLayout->addWidget(m_resetButton);
|
buttonLayout->addWidget(m_resetButton);
|
||||||
|
m_batchEditButton = new QPushButton(tr("Batch Edit..."));
|
||||||
|
m_batchEditButton->setToolTip(tr("Set or reset multiple values in the CMake Configuration."));
|
||||||
|
buttonLayout->addWidget(m_batchEditButton);
|
||||||
buttonLayout->addItem(new QSpacerItem(10, 10, QSizePolicy::Fixed, QSizePolicy::Fixed));
|
buttonLayout->addItem(new QSpacerItem(10, 10, QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||||
m_showAdvancedCheckBox = new QCheckBox(tr("Advanced"));
|
m_showAdvancedCheckBox = new QCheckBox(tr("Advanced"));
|
||||||
buttonLayout->addWidget(m_showAdvancedCheckBox);
|
buttonLayout->addWidget(m_showAdvancedCheckBox);
|
||||||
@@ -403,6 +414,8 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
|
|||||||
m_configView->setCurrentIndex(idx);
|
m_configView->setCurrentIndex(idx);
|
||||||
m_configView->edit(idx);
|
m_configView->edit(idx);
|
||||||
});
|
});
|
||||||
|
connect(m_batchEditButton, &QAbstractButton::clicked,
|
||||||
|
this, &CMakeBuildSettingsWidget::batchEditConfiguration);
|
||||||
|
|
||||||
connect(bc, &CMakeBuildConfiguration::errorOccurred, this, &CMakeBuildSettingsWidget::setError);
|
connect(bc, &CMakeBuildConfiguration::errorOccurred, this, &CMakeBuildSettingsWidget::setError);
|
||||||
connect(bc, &CMakeBuildConfiguration::warningOccurred, this, &CMakeBuildSettingsWidget::setWarning);
|
connect(bc, &CMakeBuildConfiguration::warningOccurred, this, &CMakeBuildSettingsWidget::setWarning);
|
||||||
@@ -418,6 +431,47 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
|
|||||||
updateSelection();
|
updateSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CMakeBuildSettingsWidget::batchEditConfiguration()
|
||||||
|
{
|
||||||
|
auto dialog = new QDialog(this);
|
||||||
|
dialog->setWindowTitle(tr("Edit CMake Configuration"));
|
||||||
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
dialog->setModal(true);
|
||||||
|
auto layout = new QVBoxLayout(dialog);
|
||||||
|
auto editor = new QPlainTextEdit(dialog);
|
||||||
|
|
||||||
|
auto label = new QLabel(dialog);
|
||||||
|
label->setText(tr("Enter one CMake variable per line.\n"
|
||||||
|
"To set or change a variable, use -D<variable>:<type>=<value>.\n"
|
||||||
|
"<type> can have one of the following values: FILEPATH, PATH, BOOL, INTERNAL, or STRING.\n"
|
||||||
|
"To unset a variable, use -U<variable>.\n"));
|
||||||
|
editor->setMinimumSize(800, 200);
|
||||||
|
|
||||||
|
auto chooser = new Utils::VariableChooser(dialog);
|
||||||
|
chooser->addSupportedWidget(editor);
|
||||||
|
chooser->addMacroExpanderProvider([this]() { return m_buildConfiguration->macroExpander(); });
|
||||||
|
|
||||||
|
auto buttons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
|
||||||
|
|
||||||
|
layout->addWidget(editor);
|
||||||
|
layout->addWidget(label);
|
||||||
|
layout->addWidget(buttons);
|
||||||
|
|
||||||
|
connect(buttons, &QDialogButtonBox::accepted, dialog, &QDialog::accept);
|
||||||
|
connect(buttons, &QDialogButtonBox::rejected, dialog, &QDialog::reject);
|
||||||
|
connect(dialog, &QDialog::accepted, this, [=]{
|
||||||
|
const CMakeConfig config = CMakeConfigItem::itemsFromArguments(
|
||||||
|
editor->toPlainText().split('\n', Qt::SkipEmptyParts));
|
||||||
|
|
||||||
|
m_configModel->setBatchEditConfiguration(config);
|
||||||
|
});
|
||||||
|
|
||||||
|
editor->setPlainText(m_buildConfiguration->configurationChangesArguments().join('\n'));
|
||||||
|
|
||||||
|
dialog->show();
|
||||||
|
}
|
||||||
|
|
||||||
void CMakeBuildSettingsWidget::setError(const QString &message)
|
void CMakeBuildSettingsWidget::setError(const QString &message)
|
||||||
{
|
{
|
||||||
m_buildConfiguration->buildDirectoryAspect()->setProblem(message);
|
m_buildConfiguration->buildDirectoryAspect()->setProblem(message);
|
||||||
|
@@ -209,38 +209,33 @@ QList<ConfigModel::DataItem> ConfigModel::configurationForCMake() const
|
|||||||
void ConfigModel::setConfiguration(const CMakeConfig &config)
|
void ConfigModel::setConfiguration(const CMakeConfig &config)
|
||||||
{
|
{
|
||||||
setConfiguration(Utils::transform(config, [](const CMakeConfigItem &i) {
|
setConfiguration(Utils::transform(config, [](const CMakeConfigItem &i) {
|
||||||
ConfigModel::DataItem j;
|
return DataItem(i);
|
||||||
j.key = QString::fromUtf8(i.key);
|
|
||||||
j.value = QString::fromUtf8(i.value);
|
|
||||||
j.description = QString::fromUtf8(i.documentation);
|
|
||||||
j.values = i.values;
|
|
||||||
j.inCMakeCache = i.inCMakeCache;
|
|
||||||
|
|
||||||
j.isAdvanced = i.isAdvanced;
|
|
||||||
j.isHidden = i.type == CMakeConfigItem::INTERNAL || i.type == CMakeConfigItem::STATIC;
|
|
||||||
|
|
||||||
switch (i.type) {
|
|
||||||
case CMakeConfigItem::FILEPATH:
|
|
||||||
j.type = ConfigModel::DataItem::FILE;
|
|
||||||
break;
|
|
||||||
case CMakeConfigItem::PATH:
|
|
||||||
j.type = ConfigModel::DataItem::DIRECTORY;
|
|
||||||
break;
|
|
||||||
case CMakeConfigItem::BOOL:
|
|
||||||
j.type = ConfigModel::DataItem::BOOLEAN;
|
|
||||||
break;
|
|
||||||
case CMakeConfigItem::STRING:
|
|
||||||
j.type = ConfigModel::DataItem::STRING;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
j.type = ConfigModel::DataItem::UNKNOWN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return j;
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfigModel::setBatchEditConfiguration(const CMakeConfig &config)
|
||||||
|
{
|
||||||
|
for (const auto &c: config) {
|
||||||
|
DataItem di(c);
|
||||||
|
auto existing = std::find(m_configuration.begin(), m_configuration.end(), di);
|
||||||
|
if (existing != m_configuration.end()) {
|
||||||
|
existing->isUnset = c.isUnset;
|
||||||
|
if (!c.isUnset) {
|
||||||
|
existing->isUserChanged = true;
|
||||||
|
existing->setType(c.type);
|
||||||
|
existing->value = QString::fromUtf8(c.value);
|
||||||
|
existing->newValue = existing->value;
|
||||||
|
}
|
||||||
|
} else if (!c.isUnset) {
|
||||||
|
InternalDataItem i(di);
|
||||||
|
i.isUserNew = true;
|
||||||
|
i.newValue = di.value;
|
||||||
|
m_configuration.append(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
generateTree();
|
||||||
|
}
|
||||||
|
|
||||||
void ConfigModel::setConfiguration(const QList<ConfigModel::InternalDataItem> &config)
|
void ConfigModel::setConfiguration(const QList<ConfigModel::InternalDataItem> &config)
|
||||||
{
|
{
|
||||||
|
@@ -44,8 +44,45 @@ public:
|
|||||||
ItemIsAdvancedRole = Qt::UserRole,
|
ItemIsAdvancedRole = Qt::UserRole,
|
||||||
};
|
};
|
||||||
|
|
||||||
class DataItem {
|
struct DataItem {
|
||||||
public:
|
bool operator == (const DataItem& other) const {
|
||||||
|
return key == other.key;
|
||||||
|
}
|
||||||
|
|
||||||
|
DataItem() {}
|
||||||
|
DataItem(const CMakeConfigItem &cmi) {
|
||||||
|
key = QString::fromUtf8(cmi.key);
|
||||||
|
value = QString::fromUtf8(cmi.value);
|
||||||
|
description = QString::fromUtf8(cmi.documentation);
|
||||||
|
values = cmi.values;
|
||||||
|
inCMakeCache = cmi.inCMakeCache;
|
||||||
|
|
||||||
|
isAdvanced = cmi.isAdvanced;
|
||||||
|
isHidden = cmi.type == CMakeConfigItem::INTERNAL || cmi.type == CMakeConfigItem::STATIC;
|
||||||
|
|
||||||
|
setType(cmi.type);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setType(CMakeConfigItem::Type cmt) {
|
||||||
|
switch (cmt) {
|
||||||
|
case CMakeConfigItem::FILEPATH:
|
||||||
|
type = FILE;
|
||||||
|
break;
|
||||||
|
case CMakeConfigItem::PATH:
|
||||||
|
type = DIRECTORY;
|
||||||
|
break;
|
||||||
|
case CMakeConfigItem::BOOL:
|
||||||
|
type = BOOLEAN;
|
||||||
|
break;
|
||||||
|
case CMakeConfigItem::STRING:
|
||||||
|
type = STRING;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
type = UNKNOWN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
enum Type { BOOLEAN, FILE, DIRECTORY, STRING, UNKNOWN};
|
enum Type { BOOLEAN, FILE, DIRECTORY, STRING, UNKNOWN};
|
||||||
|
|
||||||
QString key;
|
QString key;
|
||||||
@@ -70,6 +107,7 @@ public:
|
|||||||
const QString &description = QString(),
|
const QString &description = QString(),
|
||||||
const QStringList &values = QStringList());
|
const QStringList &values = QStringList());
|
||||||
void setConfiguration(const CMakeConfig &config);
|
void setConfiguration(const CMakeConfig &config);
|
||||||
|
void setBatchEditConfiguration(const CMakeConfig &config);
|
||||||
void setConfiguration(const QList<DataItem> &config);
|
void setConfiguration(const QList<DataItem> &config);
|
||||||
void setConfigurationFromKit(const QHash<QString, QString> &kitConfig);
|
void setConfigurationFromKit(const QHash<QString, QString> &kitConfig);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user