diff options
author | Miguel Costa <miguel.costa@qt.io> | 2022-12-13 12:32:31 +0100 |
---|---|---|
committer | Miguel Costa <miguel.costa@qt.io> | 2022-12-19 12:05:51 +0000 |
commit | 2f26a9f942fa16b0d1b49b1e6cbff43a9d4ac049 (patch) | |
tree | fa861be859184a9f347cb670d03050b431535c22 | |
parent | e3468b8a6ebf199f5c6e6c761f8188751f36f476 (diff) |
Fix QML debug blocking app start
This issue was caused by GetEvaluatedPropertyValue() returning an empty
string as the value of PreprocessorDefinitions for non-active configs.
Fixes: QTVSADDINBUG-1031
Fixes: QTVSADDINBUG-1073
Change-Id: I04bcd8735f51ad78474b0f160b8983746fe410a4
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
-rw-r--r-- | QtMSBuild/QtMsBuild/qt_defaults.props | 3 | ||||
-rw-r--r-- | QtVsTools.Core/QtProject.cs | 35 |
2 files changed, 29 insertions, 9 deletions
diff --git a/QtMSBuild/QtMsBuild/qt_defaults.props b/QtMSBuild/QtMsBuild/qt_defaults.props index b7bc0035..e6f8bb99 100644 --- a/QtMSBuild/QtMsBuild/qt_defaults.props +++ b/QtMSBuild/QtMsBuild/qt_defaults.props @@ -110,6 +110,9 @@ <!--// Qt Plugin default--> <QtPlugin>false</QtPlugin> + + <!--// QML debug disabled by default --> + <QtQMLDebugEnable>false</QtQMLDebugEnable> </PropertyGroup> <!-- diff --git a/QtVsTools.Core/QtProject.cs b/QtVsTools.Core/QtProject.cs index a90d0ede..60ce18fc 100644 --- a/QtVsTools.Core/QtProject.cs +++ b/QtVsTools.Core/QtProject.cs @@ -1708,7 +1708,7 @@ namespace QtVsTools.Core throw new QtVSException($"Cannot add file {fileName} to filter."); } catch (QtVSException) { throw; - } catch (Exception e){ + } catch (Exception e) { throw new QtVSException($"Cannot add file {fileName} to filter.", e); } @@ -2380,7 +2380,7 @@ namespace QtVsTools.Core // We have to delete the old moc file in order to trigger custom build step. var configName = config.Name.Remove(config.Name.IndexOf('|')); var platformName = config.Name.Substring(config.Name.IndexOf('|') + 1); - var projectPath =envPro.FullName.Remove(envPro.FullName.LastIndexOf(Path + var projectPath = envPro.FullName.Remove(envPro.FullName.LastIndexOf(Path .DirectorySeparatorChar)); var mocRelPath = GetRelativeMocFilePath(srcMocFile.FullPath, configName, platformName); var mocPath = Path.Combine(projectPath, mocRelPath); @@ -3106,17 +3106,34 @@ namespace QtVsTools.Core public static IEnumerable<CppConfig> GetCppDebugConfigs(VCProject vcPro) { - return GetCppConfigs(vcPro).Where(x => x.Cpp - .GetEvaluatedPropertyValue("PreprocessorDefinitions").Split(new char[] { ';' }) - .Contains("QT_NO_DEBUG") == false); + var cppConfigs = GetCppConfigs(vcPro) + .Select(x => new { Self = x, x.Cpp }); + var cppConfigMacros = cppConfigs + .Select(x => new + { + x.Self, + Macros = x.Cpp.GetEvaluatedPropertyValue("PreprocessorDefinitions") + }) + .Where(x => !string.IsNullOrEmpty(x.Macros)); + var cppDebugConfigs = cppConfigMacros + .Where(x => !x.Macros.Split(';').Contains("QT_NO_DEBUG")) + .Select(x => x.Self); + return cppDebugConfigs; } public static bool IsQtQmlDebugDefined(VCProject vcPro) { - return (GetCppDebugConfigs(vcPro).Where(x => x.Cpp - .GetEvaluatedPropertyValue("PreprocessorDefinitions").Split(new char[] { ';' }) - .Contains("QT_QML_DEBUG") == false) - .Any() == false); + var cppConfigs = GetCppConfigs(vcPro) + .Select(x => new { Self = x, x.Cpp }); + var cppConfigMacros = cppConfigs + .Select(x => new + { + x.Self, + Macros = x.Cpp.GetEvaluatedPropertyValue("PreprocessorDefinitions") + }) + .Where(x => !string.IsNullOrEmpty(x.Macros)); + return cppConfigMacros + .Any(x => x.Macros.Split(';').Contains("QT_QML_DEBUG")); } public static void DefineQtQmlDebug(VCProject vcPro) |