fix parallelized "jom install"
unlike unix' mkdir -p, windows' md complains if the directory already exists. the workaround is a quite complex command, so the so far used concept for assembling the command line from pieces was replaced with a single template. for symmetry, adapt the makefile existence check to the new concept as well. QMAKE_CHK_EXISTS and QMAKE_MKDIR_CMD were added, with hard-coded fallbacks (ugly). QMAKE_CHK_FILE_EXISTS and QMAKE_CHK_EXISTS_GLUE (introduced in 5.0.0) are simply deleted again. QMAKE_CHK_DIR_EXISTS and QMAKE_MKDIR remain for legacy reasons, as qmake emits them into the Makefiles, and custom commands may rely on their presence. Task-number: QTBUG-28132 Change-Id: I3d049cb5d26947e5c3d102d0c2da33afb2a95140 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Janne Anttila <janne.anttila@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
parent
40236c35a6
commit
457afb3749
@ -7,8 +7,8 @@ QMAKE_COPY_DIR = $$QMAKE_COPY -R
|
|||||||
QMAKE_MOVE = mv -f
|
QMAKE_MOVE = mv -f
|
||||||
QMAKE_DEL_FILE = rm -f
|
QMAKE_DEL_FILE = rm -f
|
||||||
QMAKE_DEL_DIR = rmdir
|
QMAKE_DEL_DIR = rmdir
|
||||||
QMAKE_CHK_DIR_EXISTS = test -d
|
QMAKE_CHK_EXISTS = test -e %1 ||
|
||||||
QMAKE_CHK_FILE_EXISTS = test -f
|
QMAKE_CHK_DIR_EXISTS = test -d # legacy
|
||||||
QMAKE_CHK_EXISTS_GLUE = "|| "
|
QMAKE_MKDIR = mkdir -p # legacy
|
||||||
QMAKE_MKDIR = mkdir -p
|
QMAKE_MKDIR_CMD = test -d %1 || mkdir -p %1
|
||||||
QMAKE_STREAM_EDITOR = sed
|
QMAKE_STREAM_EDITOR = sed
|
||||||
|
@ -5,10 +5,10 @@ QMAKE_COPY_DIR = xcopy /s /q /y /i
|
|||||||
QMAKE_MOVE = move
|
QMAKE_MOVE = move
|
||||||
QMAKE_DEL_FILE = del
|
QMAKE_DEL_FILE = del
|
||||||
QMAKE_DEL_DIR = rmdir
|
QMAKE_DEL_DIR = rmdir
|
||||||
QMAKE_CHK_DIR_EXISTS = if not exist
|
QMAKE_CHK_EXISTS = if not exist %1
|
||||||
QMAKE_CHK_FILE_EXISTS = if not exist
|
QMAKE_CHK_DIR_EXISTS = if not exist # legacy
|
||||||
QMAKE_CHK_EXISTS_GLUE =
|
QMAKE_MKDIR = mkdir # legacy
|
||||||
QMAKE_MKDIR = mkdir
|
QMAKE_MKDIR_CMD = if not exist %1 mkdir %1 & if not exist %1 exit 1
|
||||||
|
|
||||||
# xcopy copies the contained files if source is a directory. Deal with it.
|
# xcopy copies the contained files if source is a directory. Deal with it.
|
||||||
CONFIG += copy_dir_files
|
CONFIG += copy_dir_files
|
||||||
|
@ -92,18 +92,8 @@ bool MakefileGenerator::canExecute(const QStringList &cmdline, int *a) const
|
|||||||
|
|
||||||
QString MakefileGenerator::mkdir_p_asstring(const QString &dir, bool escape) const
|
QString MakefileGenerator::mkdir_p_asstring(const QString &dir, bool escape) const
|
||||||
{
|
{
|
||||||
QString ret = "@" + chkdir + " ";
|
QString edir = escape ? escapeFilePath(dir) : dir;
|
||||||
if(escape)
|
return "@" + makedir.arg(edir);
|
||||||
ret += escapeFilePath(dir);
|
|
||||||
else
|
|
||||||
ret += dir;
|
|
||||||
ret += " " + chkglue + "$(MKDIR) ";
|
|
||||||
if(escape)
|
|
||||||
ret += escapeFilePath(dir);
|
|
||||||
else
|
|
||||||
ret += dir;
|
|
||||||
ret += " ";
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MakefileGenerator::mkdir(const QString &in_path) const
|
bool MakefileGenerator::mkdir(const QString &in_path) const
|
||||||
@ -440,13 +430,17 @@ MakefileGenerator::init()
|
|||||||
if (v["TARGET"].isEmpty())
|
if (v["TARGET"].isEmpty())
|
||||||
warn_msg(WarnLogic, "TARGET is empty");
|
warn_msg(WarnLogic, "TARGET is empty");
|
||||||
|
|
||||||
chkdir = v["QMAKE_CHK_DIR_EXISTS"].join(' ');
|
makedir = v["QMAKE_MKDIR_CMD"].join(' ');
|
||||||
chkfile = v["QMAKE_CHK_FILE_EXISTS"].join(' ');
|
chkexists = v["QMAKE_CHK_EXISTS"].join(' ');
|
||||||
if (chkfile.isEmpty()) // Backwards compat with Qt4 specs
|
if (makedir.isEmpty()) { // Backwards compat with Qt < 5.0.2 specs
|
||||||
chkfile = isWindowsShell() ? "if not exist" : "test -f";
|
if (isWindowsShell()) {
|
||||||
chkglue = v["QMAKE_CHK_EXISTS_GLUE"].join(' ');
|
makedir = "if not exist %1 mkdir %1 & if not exist %1 exit 1";
|
||||||
if (chkglue.isEmpty()) // Backwards compat with Qt4 specs
|
chkexists = "if not exist %1";
|
||||||
chkglue = isWindowsShell() ? "" : "|| ";
|
} else {
|
||||||
|
makedir = "test -d %1 || mkdir -p %1";
|
||||||
|
chkexists = "test -e %1 ||";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ProStringList &quc = v["QMAKE_EXTRA_COMPILERS"];
|
ProStringList &quc = v["QMAKE_EXTRA_COMPILERS"];
|
||||||
|
|
||||||
@ -2398,8 +2392,8 @@ MakefileGenerator::writeSubTargetCall(QTextStream &t,
|
|||||||
if (!in.isEmpty()) {
|
if (!in.isEmpty()) {
|
||||||
if (!in_directory.isEmpty())
|
if (!in_directory.isEmpty())
|
||||||
t << "\n\t" << mkdir_p_asstring(out_directory);
|
t << "\n\t" << mkdir_p_asstring(out_directory);
|
||||||
pfx = "( " + chkfile + " " + out + " " + chkglue
|
pfx = "( " + chkexists.arg(out) +
|
||||||
+ "$(QMAKE) " + in + buildArgs() + " -o " + out
|
+ " $(QMAKE) " + in + buildArgs() + " -o " + out
|
||||||
+ " ) && ";
|
+ " ) && ";
|
||||||
}
|
}
|
||||||
writeSubMakeCall(t, out_directory_cdin + pfx, makefilein);
|
writeSubMakeCall(t, out_directory_cdin + pfx, makefilein);
|
||||||
|
@ -81,7 +81,7 @@ class MakefileGenerator : protected QMakeSourceFileInfo
|
|||||||
QString spec;
|
QString spec;
|
||||||
bool init_opath_already, init_already, no_io;
|
bool init_opath_already, init_already, no_io;
|
||||||
QHash<QString, bool> init_compiler_already;
|
QHash<QString, bool> init_compiler_already;
|
||||||
QString chkdir, chkfile, chkglue;
|
QString makedir, chkexists;
|
||||||
QString build_args(const QString &outdir=QString());
|
QString build_args(const QString &outdir=QString());
|
||||||
|
|
||||||
//internal caches
|
//internal caches
|
||||||
|
Loading…
x
Reference in New Issue
Block a user