diff options
author | Miguel Costa <miguel.costa@qt.io> | 2019-09-18 18:47:30 +0200 |
---|---|---|
committer | Miguel Costa <miguel.costa@qt.io> | 2019-09-30 10:26:30 +0000 |
commit | fdbec35c590f524f6f9ce8f2e6a7328f2f3df508 (patch) | |
tree | d224bd740fca5be98f76288e0b21b2346d7ee4a5 | |
parent | a825ccad3e5f87de11d9bb64886b5c8eb66d0178 (diff) |
Implement project format v3.1
This change introduces a revision of the v3 project format, which will
now allow Qt settings to reference user macros defined in imported
property sheets. This includes the following changes to the order of
property evaluation:
- "QtSettings" property group moved to after the import of user
property sheets;
- QtInstall property moved from the "Configuration" property group
to the "QtSettings" property group;
- Import of qt.props moved to after the "QtSettings" property group.
Task-number: QTVSADDINBUG-651
Change-Id: I55a022647327c89157175e1b25e55cf680a65924
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r-- | src/qtmsbuild/qt_settings.xml | 7 | ||||
-rw-r--r-- | src/qtmsbuild/qt_settings_vs2015.xml | 7 | ||||
-rw-r--r-- | src/qtprojectlib/MsBuildProject.cs | 2 | ||||
-rw-r--r-- | src/qtprojectlib/QtVersionManager.cs | 2 | ||||
-rw-r--r-- | src/qtprojectlib/Resources.cs | 3 | ||||
-rw-r--r-- | src/qttemplates/console/console.vcxproj | 22 | ||||
-rw-r--r-- | src/qttemplates/designer/designer.vcxproj | 22 | ||||
-rw-r--r-- | src/qttemplates/gui/gui.vcxproj | 22 | ||||
-rw-r--r-- | src/qttemplates/lib/lib.vcxproj | 22 | ||||
-rw-r--r-- | src/qttemplates/server/server.vcxproj | 22 | ||||
-rw-r--r-- | src/qtvstools/QtProjectContextMenu.cs | 5 |
11 files changed, 62 insertions, 74 deletions
diff --git a/src/qtmsbuild/qt_settings.xml b/src/qtmsbuild/qt_settings.xml index ba27fa64..6311b505 100644 --- a/src/qtmsbuild/qt_settings.xml +++ b/src/qtmsbuild/qt_settings.xml @@ -55,6 +55,7 @@ </EnumProperty.DataSource> <EnumValue Name="Qt4VSv1.0" DisplayName="Version 2.0"/> <EnumValue Name="QtVS_v300" DisplayName="Version 3.0"/> + <EnumValue Name="QtVS_v301" DisplayName="Version 3.1"/> </EnumProperty> <DynamicEnumProperty Name="QtInstall" @@ -63,9 +64,6 @@ EnumProvider="QtVersionProvider" Description= "Select Qt installation; can be either a path to an installation directory or a version name registered through the Qt Visual Studio Tools (v2.4 or above)."> - <DynamicEnumProperty.DataSource> - <DataSource Persistence="ProjectFile" Label="Configuration" HasConfigurationCondition="true"/> - </DynamicEnumProperty.DataSource> </DynamicEnumProperty> <StringListProperty Name="QtModules" @@ -103,8 +101,5 @@ Category="QtSettings_QML" DisplayName="Enable QML Debugging" Description="Select whether to launch a QML session when debugging."> - <BoolProperty.DataSource> - <DataSource Persistence="ProjectFile" Label="Configuration" HasConfigurationCondition="true"/> - </BoolProperty.DataSource> </BoolProperty> </Rule> diff --git a/src/qtmsbuild/qt_settings_vs2015.xml b/src/qtmsbuild/qt_settings_vs2015.xml index 74ba47d3..63aaa2a9 100644 --- a/src/qtmsbuild/qt_settings_vs2015.xml +++ b/src/qtmsbuild/qt_settings_vs2015.xml @@ -55,6 +55,7 @@ </EnumProperty.DataSource> <EnumValue Name="Qt4VSv1.0" DisplayName="Version 2.0"/> <EnumValue Name="QtVS_v300" DisplayName="Version 3.0"/> + <EnumValue Name="QtVS_v301" DisplayName="Version 3.1"/> </EnumProperty> <DynamicEnumProperty Name="QtInstall" @@ -66,9 +67,6 @@ <DynamicEnumProperty.ProviderSettings> <NameValuePair Name="Include" Value="$(QtVersionNames)" /> </DynamicEnumProperty.ProviderSettings> - <DynamicEnumProperty.DataSource> - <DataSource Persistence="ProjectFile" Label="Configuration" HasConfigurationCondition="true"/> - </DynamicEnumProperty.DataSource> </DynamicEnumProperty> <StringListProperty Name="QtModules" @@ -106,8 +104,5 @@ Category="QtSettings_QML" DisplayName="Enable QML Debugging" Description="Select whether to launch a QML session when debugging."> - <BoolProperty.DataSource> - <DataSource Persistence="ProjectFile" Label="Configuration" HasConfigurationCondition="true"/> - </BoolProperty.DataSource> </BoolProperty> </Rule> diff --git a/src/qtprojectlib/MsBuildProject.cs b/src/qtprojectlib/MsBuildProject.cs index 09758e49..77ad72a9 100644 --- a/src/qtprojectlib/MsBuildProject.cs +++ b/src/qtprojectlib/MsBuildProject.cs @@ -306,7 +306,7 @@ namespace QtProjectLib this[Files.Project].xml .Elements(ns + "Project") .Elements(ns + "PropertyGroup") - .Where(x => ((string)x.Attribute("Label")) == Resources.projLabelConfiguration) + .Where(x => ((string)x.Attribute("Label")) == Resources.projLabelQtSettings) .ToList() .ForEach(config => { diff --git a/src/qtprojectlib/QtVersionManager.cs b/src/qtprojectlib/QtVersionManager.cs index 7e700f1e..0e0a21a8 100644 --- a/src/qtprojectlib/QtVersionManager.cs +++ b/src/qtprojectlib/QtVersionManager.cs @@ -323,7 +323,7 @@ namespace QtProjectLib return false; #if VS2017 || VS2019 foreach (VCConfiguration3 config in (IVCCollection)vcPro.Configurations) { - config.SetPropertyValue(Resources.projLabelConfiguration, true, + config.SetPropertyValue(Resources.projLabelQtSettings, true, "QtInstall", version); } #endif diff --git a/src/qtprojectlib/Resources.cs b/src/qtprojectlib/Resources.cs index 68b36028..662dec15 100644 --- a/src/qtprojectlib/Resources.cs +++ b/src/qtprojectlib/Resources.cs @@ -83,7 +83,7 @@ namespace QtProjectLib // Qt VS project tag and format version public const string qtProjectKeyword = "QtVS"; - public const int qtProjectFormatVersion = 300; + public const int qtProjectFormatVersion = 301; // Min. format version for Qt settings as project properties public const int qtMinFormatVersion_Settings = 300; @@ -93,7 +93,6 @@ namespace QtProjectLib // Project properties labels public const string projLabelGlobals = "Globals"; - public const string projLabelConfiguration = "Configuration"; public const string projLabelQtSettings = "QtSettings"; public const string uic4Command = "$(QTDIR)\\bin\\uic.exe"; diff --git a/src/qttemplates/console/console.vcxproj b/src/qttemplates/console/console.vcxproj index d52b34dc..850e5f59 100644 --- a/src/qttemplates/console/console.vcxproj +++ b/src/qttemplates/console/console.vcxproj @@ -21,12 +21,10 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <PlatformToolset>v$PlatformToolset$</PlatformToolset> - <QtInstall>$DefaultQtVersion$</QtInstall> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|$Platform$'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <PlatformToolset>v$PlatformToolset$</PlatformToolset> - <QtInstall>$DefaultQtVersion$</QtInstall> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <PropertyGroup Condition="'$(QtMsBuild)'=='' or !Exists('$(QtMsBuild)\qt.targets')"> @@ -38,15 +36,6 @@ <Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." /> </Target> - <ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')"> - <Import Project="$(QtMsBuild)\qt.props" /> - </ImportGroup> - <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> - <QtModules>$QtModules$</QtModules> - </PropertyGroup> - <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|$Platform$'"> - <QtModules>$QtModules$</QtModules> - </PropertyGroup> <ImportGroup Label="ExtensionSettings" /> <ImportGroup Label="Shared" /> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> @@ -56,6 +45,17 @@ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> + <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> + <QtInstall>$DefaultQtVersion$</QtInstall> + <QtModules>$QtModules$</QtModules> + </PropertyGroup> + <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|$Platform$'"> + <QtInstall>$DefaultQtVersion$</QtInstall> + <QtModules>$QtModules$</QtModules> + </PropertyGroup> + <ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')"> + <Import Project="$(QtMsBuild)\qt.props" /> + </ImportGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> <ClCompile> <MultiProcessorCompilation>true</MultiProcessorCompilation> diff --git a/src/qttemplates/designer/designer.vcxproj b/src/qttemplates/designer/designer.vcxproj index ac87965c..9da6642a 100644 --- a/src/qttemplates/designer/designer.vcxproj +++ b/src/qttemplates/designer/designer.vcxproj @@ -21,12 +21,10 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <PlatformToolset>v$PlatformToolset$</PlatformToolset> - <QtInstall>$DefaultQtVersion$</QtInstall> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|$Platform$'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <PlatformToolset>v$PlatformToolset$</PlatformToolset> - <QtInstall>$DefaultQtVersion$</QtInstall> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <PropertyGroup Condition="'$(QtMsBuild)'=='' or !Exists('$(QtMsBuild)\qt.targets')"> @@ -38,15 +36,6 @@ <Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." /> </Target> - <ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')"> - <Import Project="$(QtMsBuild)\qt.props" /> - </ImportGroup> - <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> - <QtModules>$QtModules$</QtModules> - </PropertyGroup> - <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|$Platform$'"> - <QtModules>$QtModules$</QtModules> - </PropertyGroup> <ImportGroup Label="ExtensionSettings" /> <ImportGroup Label="Shared" /> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> @@ -56,6 +45,17 @@ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> + <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> + <QtInstall>$DefaultQtVersion$</QtInstall> + <QtModules>$QtModules$</QtModules> + </PropertyGroup> + <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|$Platform$'"> + <QtInstall>$DefaultQtVersion$</QtInstall> + <QtModules>$QtModules$</QtModules> + </PropertyGroup> + <ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')"> + <Import Project="$(QtMsBuild)\qt.props" /> + </ImportGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> $QtMoc$ <ClCompile> diff --git a/src/qttemplates/gui/gui.vcxproj b/src/qttemplates/gui/gui.vcxproj index 27f5383f..0c280525 100644 --- a/src/qttemplates/gui/gui.vcxproj +++ b/src/qttemplates/gui/gui.vcxproj @@ -33,7 +33,6 @@ <GenerateManifest>false</GenerateManifest> <EmbedManifest>false</EmbedManifest> $endif$ - <QtInstall>$DefaultQtVersion$</QtInstall> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|$Platform$'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> @@ -42,7 +41,6 @@ <GenerateManifest>false</GenerateManifest> <EmbedManifest>false</EmbedManifest> $endif$ - <QtInstall>$DefaultQtVersion$</QtInstall> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <PropertyGroup Condition="'$(QtMsBuild)'=='' or !Exists('$(QtMsBuild)\qt.targets')"> @@ -54,15 +52,6 @@ <Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." /> </Target> - <ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')"> - <Import Project="$(QtMsBuild)\qt.props" /> - </ImportGroup> - <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> - <QtModules>$QtModules$</QtModules> - </PropertyGroup> - <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|$Platform$'"> - <QtModules>$QtModules$</QtModules> - </PropertyGroup> <ImportGroup Label="ExtensionSettings" /> <ImportGroup Label="Shared" /> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> @@ -72,6 +61,17 @@ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> + <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> + <QtInstall>$DefaultQtVersion$</QtInstall> + <QtModules>$QtModules$</QtModules> + </PropertyGroup> + <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|$Platform$'"> + <QtInstall>$DefaultQtVersion$</QtInstall> + <QtModules>$QtModules$</QtModules> + </PropertyGroup> + <ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')"> + <Import Project="$(QtMsBuild)\qt.props" /> + </ImportGroup> $if$ ($QtWinRT$ == true) <Target Name="WinDeployQt" Inputs="$(OutDir)\$(TargetName).exe" Outputs="$(TargetName).windeployqt.$(Platform).$(Configuration)"> diff --git a/src/qttemplates/lib/lib.vcxproj b/src/qttemplates/lib/lib.vcxproj index 695af2ff..aaab7cfe 100644 --- a/src/qttemplates/lib/lib.vcxproj +++ b/src/qttemplates/lib/lib.vcxproj @@ -21,12 +21,10 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <PlatformToolset>v$PlatformToolset$</PlatformToolset> - <QtInstall>$DefaultQtVersion$</QtInstall> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|$Platform$'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <PlatformToolset>v$PlatformToolset$</PlatformToolset> - <QtInstall>$DefaultQtVersion$</QtInstall> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <PropertyGroup Condition="'$(QtMsBuild)'=='' or !Exists('$(QtMsBuild)\qt.targets')"> @@ -38,15 +36,6 @@ <Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." /> </Target> - <ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')"> - <Import Project="$(QtMsBuild)\qt.props" /> - </ImportGroup> - <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> - <QtModules>$QtModules$</QtModules> - </PropertyGroup> - <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|$Platform$'"> - <QtModules>$QtModules$</QtModules> - </PropertyGroup> <ImportGroup Label="ExtensionSettings" /> <ImportGroup Label="Shared" /> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> @@ -56,6 +45,17 @@ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> + <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> + <QtInstall>$DefaultQtVersion$</QtInstall> + <QtModules>$QtModules$</QtModules> + </PropertyGroup> + <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|$Platform$'"> + <QtInstall>$DefaultQtVersion$</QtInstall> + <QtModules>$QtModules$</QtModules> + </PropertyGroup> + <ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')"> + <Import Project="$(QtMsBuild)\qt.props" /> + </ImportGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> $QtMoc$ <ClCompile> diff --git a/src/qttemplates/server/server.vcxproj b/src/qttemplates/server/server.vcxproj index f1fec22c..b39ffc29 100644 --- a/src/qttemplates/server/server.vcxproj +++ b/src/qttemplates/server/server.vcxproj @@ -21,12 +21,10 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <PlatformToolset>v$PlatformToolset$</PlatformToolset> - <QtInstall>$DefaultQtVersion$</QtInstall> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|$Platform$'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <PlatformToolset>v$PlatformToolset$</PlatformToolset> - <QtInstall>$DefaultQtVersion$</QtInstall> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <PropertyGroup Condition="'$(QtMsBuild)'=='' or !Exists('$(QtMsBuild)\qt.targets')"> @@ -38,15 +36,6 @@ <Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." /> </Target> - <ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')"> - <Import Project="$(QtMsBuild)\qt.props" /> - </ImportGroup> - <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> - <QtModules>$QtModules$</QtModules> - </PropertyGroup> - <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|$Platform$'"> - <QtModules>$QtModules$</QtModules> - </PropertyGroup> <ImportGroup Label="ExtensionSettings" /> <ImportGroup Label="Shared" /> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> @@ -56,6 +45,17 @@ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> + <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> + <QtInstall>$DefaultQtVersion$</QtInstall> + <QtModules>$QtModules$</QtModules> + </PropertyGroup> + <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|$Platform$'"> + <QtInstall>$DefaultQtVersion$</QtInstall> + <QtModules>$QtModules$</QtModules> + </PropertyGroup> + <ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')"> + <Import Project="$(QtMsBuild)\qt.props" /> + </ImportGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|$Platform$'"> $QtMoc$ <ClCompile> diff --git a/src/qtvstools/QtProjectContextMenu.cs b/src/qtvstools/QtProjectContextMenu.cs index cd287a4a..908267c1 100644 --- a/src/qtvstools/QtProjectContextMenu.cs +++ b/src/qtvstools/QtProjectContextMenu.cs @@ -293,15 +293,14 @@ namespace QtVsTools if (project != null && isQtProject) { int projectVersion = QtProject.GetFormatVersion(project); - int minProjectVersion = Resources.qtMinFormatVersion_Settings; switch ((CommandId)command.CommandID.ID) { case CommandId.QtProjectSettingsProjectId: case CommandId.ChangeProjectQtVersionProjectId: - if (projectVersion >= minProjectVersion) + if (projectVersion >= Resources.qtMinFormatVersion_Settings) command.Visible = command.Enabled = false; break; case CommandId.ProjectConvertToQtMsBuild: - if (projectVersion >= minProjectVersion) { + if (projectVersion >= Resources.qtProjectFormatVersion) { command.Visible = command.Enabled = false; } else { command.Visible = command.Enabled = true; |