forked from qt-creator/qt-creator
RemoteLinux: Use more FilePaths in install step
Patch is self-contained, no functional change intended. The transition is, however, not complete yet as the would break the consumer side currently. Change-Id: I04b7d919dffbfb9237863e6166247305c20f1091 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -143,22 +143,22 @@ bool MakeInstallStep::init()
|
|||||||
{
|
{
|
||||||
if (!MakeStep::init())
|
if (!MakeStep::init())
|
||||||
return false;
|
return false;
|
||||||
const QString rootDirPath = installRoot().toString();
|
|
||||||
if (rootDirPath.isEmpty()) {
|
const FilePath rootDir = installRoot().onDevice(makeCommand());
|
||||||
|
if (rootDir.isEmpty()) {
|
||||||
emit addTask(BuildSystemTask(Task::Error, tr("You must provide an install root.")));
|
emit addTask(BuildSystemTask(Task::Error, tr("You must provide an install root.")));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QDir rootDir(rootDirPath);
|
|
||||||
if (cleanInstallRoot() && !rootDir.removeRecursively()) {
|
if (cleanInstallRoot() && !rootDir.removeRecursively()) {
|
||||||
emit addTask(BuildSystemTask(Task::Error,
|
emit addTask(BuildSystemTask(Task::Error,
|
||||||
tr("The install root \"%1\" could not be cleaned.")
|
tr("The install root \"%1\" could not be cleaned.")
|
||||||
.arg(installRoot().toUserOutput())));
|
.arg(rootDir.toUserOutput())));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!rootDir.exists() && !QDir::root().mkpath(rootDirPath)) {
|
if (!rootDir.exists() && !rootDir.createDir()) {
|
||||||
emit addTask(BuildSystemTask(Task::Error,
|
emit addTask(BuildSystemTask(Task::Error,
|
||||||
tr("The install root \"%1\" could not be created.")
|
tr("The install root \"%1\" could not be created.")
|
||||||
.arg(installRoot().toUserOutput())));
|
.arg(rootDir.toUserOutput())));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this == deployConfiguration()->stepList()->steps().last()) {
|
if (this == deployConfiguration()->stepList()->steps().last()) {
|
||||||
@@ -167,7 +167,7 @@ bool MakeInstallStep::init()
|
|||||||
"last in the list of deploy steps. "
|
"last in the list of deploy steps. "
|
||||||
"Consider moving it up.")));
|
"Consider moving it up.")));
|
||||||
}
|
}
|
||||||
const MakeInstallCommand cmd = target()->makeInstallCommand(installRoot().toString());
|
const MakeInstallCommand cmd = target()->makeInstallCommand(rootDir.path());
|
||||||
if (cmd.environment.isValid()) {
|
if (cmd.environment.isValid()) {
|
||||||
Environment env = processParameters()->environment();
|
Environment env = processParameters()->environment();
|
||||||
for (auto it = cmd.environment.constBegin(); it != cmd.environment.constEnd(); ++it) {
|
for (auto it = cmd.environment.constBegin(); it != cmd.environment.constEnd(); ++it) {
|
||||||
@@ -191,21 +191,30 @@ bool MakeInstallStep::init()
|
|||||||
void MakeInstallStep::finish(bool success)
|
void MakeInstallStep::finish(bool success)
|
||||||
{
|
{
|
||||||
if (success) {
|
if (success) {
|
||||||
|
const FilePath rootDir = installRoot().onDevice(makeCommand());
|
||||||
|
|
||||||
m_deploymentData = DeploymentData();
|
m_deploymentData = DeploymentData();
|
||||||
m_deploymentData.setLocalInstallRoot(installRoot());
|
m_deploymentData.setLocalInstallRoot(rootDir);
|
||||||
QDirIterator dit(installRoot().toString(), QDir::Files | QDir::Hidden,
|
|
||||||
QDirIterator::Subdirectories);
|
const int startPos = rootDir.toString().length();
|
||||||
|
|
||||||
const auto appFileNames = transform<QSet<QString>>(buildSystem()->applicationTargets(),
|
const auto appFileNames = transform<QSet<QString>>(buildSystem()->applicationTargets(),
|
||||||
[](const BuildTargetInfo &appTarget) { return appTarget.targetFilePath.fileName(); });
|
[](const BuildTargetInfo &appTarget) { return appTarget.targetFilePath.fileName(); });
|
||||||
while (dit.hasNext()) {
|
|
||||||
dit.next();
|
auto handleFile = [this, &appFileNames, startPos](const FilePath &filePath) {
|
||||||
const QFileInfo fi = dit.fileInfo();
|
const DeployableFile::Type type = appFileNames.contains(filePath.fileName())
|
||||||
const DeployableFile::Type type = appFileNames.contains(fi.fileName())
|
|
||||||
? DeployableFile::TypeExecutable
|
? DeployableFile::TypeExecutable
|
||||||
: DeployableFile::TypeNormal;
|
: DeployableFile::TypeNormal;
|
||||||
m_deploymentData.addFile(FilePath::fromString(fi.filePath()),
|
QString targetDir = filePath.parentDir().toString().mid(startPos);
|
||||||
fi.dir().path().mid(installRoot().toString().length()), type);
|
// FIXME: This is conceptually the wrong place, but currently "downstream" like
|
||||||
}
|
// the rsync step doesn't handle full remote paths here.
|
||||||
|
targetDir = FilePath::fromString(targetDir).path();
|
||||||
|
m_deploymentData.addFile(filePath, targetDir, type);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
rootDir.iterateDirectory(handleFile,
|
||||||
|
{{}, QDir::Files | QDir::Hidden, QDirIterator::Subdirectories});
|
||||||
|
|
||||||
buildSystem()->setDeploymentData(m_deploymentData);
|
buildSystem()->setDeploymentData(m_deploymentData);
|
||||||
} else if (m_noInstallTarget && m_isCmakeProject) {
|
} else if (m_noInstallTarget && m_isCmakeProject) {
|
||||||
emit addTask(DeploymentTask(Task::Warning, tr("You need to add an install statement "
|
emit addTask(DeploymentTask(Task::Warning, tr("You need to add an install statement "
|
||||||
|
Reference in New Issue
Block a user