diff options
author | Rob Mensching <rob@firegiant.com> | 2018-12-22 08:16:06 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2018-12-22 08:16:06 -0800 |
commit | 7dc73cf5d633e0c817c211022e28d31d25a187d9 (patch) | |
tree | cda82bcb93745dc8d13c5edd0b27db8e4f057150 /src | |
parent | 9291e20f6c0af3adea95b264416bacb8a6160c6a (diff) | |
download | wix-7dc73cf5d633e0c817c211022e28d31d25a187d9.tar.gz wix-7dc73cf5d633e0c817c211022e28d31d25a187d9.tar.bz2 wix-7dc73cf5d633e0c817c211022e28d31d25a187d9.zip |
Integrate SmartPackageReference
Diffstat (limited to 'src')
-rw-r--r-- | src/Directory.Build.props | 6 | ||||
-rw-r--r-- | src/Directory.Build.targets | 43 | ||||
-rw-r--r-- | src/WixToolset.Extensibility/WixToolset.Extensibility.csproj | 3 |
3 files changed, 45 insertions, 7 deletions
diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 9eacf3f5..35ef739b 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props | |||
@@ -10,7 +10,7 @@ | |||
10 | <EnableSourceLink Condition=" '$(NCrunch)' == '1' ">false</EnableSourceLink> | 10 | <EnableSourceLink Condition=" '$(NCrunch)' == '1' ">false</EnableSourceLink> |
11 | 11 | ||
12 | <ProjectName Condition=" '$(ProjectName)' == '' ">$(MSBuildProjectName)</ProjectName> | 12 | <ProjectName Condition=" '$(ProjectName)' == '' ">$(MSBuildProjectName)</ProjectName> |
13 | <BaseOutputPath>$(MSBuildThisFileDirectory)..\build\</BaseOutputPath> | 13 | <BaseOutputPath>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\build\))</BaseOutputPath> |
14 | <BaseIntermediateOutputPath>$(BaseOutputPath)obj\$(ProjectName)\</BaseIntermediateOutputPath> | 14 | <BaseIntermediateOutputPath>$(BaseOutputPath)obj\$(ProjectName)\</BaseIntermediateOutputPath> |
15 | <OutputPath>$(BaseOutputPath)$(Configuration)\</OutputPath> | 15 | <OutputPath>$(BaseOutputPath)$(Configuration)\</OutputPath> |
16 | 16 | ||
@@ -20,10 +20,6 @@ | |||
20 | <Product>WiX Toolset</Product> | 20 | <Product>WiX Toolset</Product> |
21 | </PropertyGroup> | 21 | </PropertyGroup> |
22 | 22 | ||
23 | <PropertyGroup> | ||
24 | <WixToolsetRootFolder>$(MSBuildThisFileDirectory)..\..\</WixToolsetRootFolder> | ||
25 | </PropertyGroup> | ||
26 | |||
27 | <Import Project="Cpp.Build.props" Condition=" '$(MSBuildProjectExtension)'=='.vcxproj' " /> | 23 | <Import Project="Cpp.Build.props" Condition=" '$(MSBuildProjectExtension)'=='.vcxproj' " /> |
28 | <Import Project="Custom.Build.props" Condition=" Exists('Custom.Build.props') " /> | 24 | <Import Project="Custom.Build.props" Condition=" Exists('Custom.Build.props') " /> |
29 | </Project> | 25 | </Project> |
diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets new file mode 100644 index 00000000..48629385 --- /dev/null +++ b/src/Directory.Build.targets | |||
@@ -0,0 +1,43 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- | ||
3 | Replace PackageReferences with ProjectReferences when the projects can be found in .sln. | ||
4 | See the original here: https://github.com/dotnet/sdk/issues/1151#issuecomment-385133284 | ||
5 | --> | ||
6 | <Project> | ||
7 | <PropertyGroup> | ||
8 | <ReplacePackageReferences>true</ReplacePackageReferences> | ||
9 | <TheSolutionPath Condition=" '$(NCrunch)'=='' ">$(SolutionPath)</TheSolutionPath> | ||
10 | <TheSolutionPath Condition=" '$(NCrunch)'=='1' ">$(NCrunchOriginalSolutionPath)</TheSolutionPath> | ||
11 | </PropertyGroup> | ||
12 | |||
13 | <Choose> | ||
14 | <When Condition="$(ReplacePackageReferences) AND '$(TheSolutionPath)' != '' AND '$(TheSolutionPath)' != '*undefined*' AND Exists('$(TheSolutionPath)')"> | ||
15 | |||
16 | <PropertyGroup> | ||
17 | <SolutionFileContent>$([System.IO.File]::ReadAllText($(TheSolutionPath)))</SolutionFileContent> | ||
18 | <SmartSolutionDir>$([System.IO.Path]::GetDirectoryName( $(TheSolutionPath) ))</SmartSolutionDir> | ||
19 | <RegexPattern>(?<="[PackageName]", ")(.*)(?=", ")</RegexPattern> | ||
20 | </PropertyGroup> | ||
21 | |||
22 | <ItemGroup> | ||
23 | <!-- Keep the identity of the PackageReference --> | ||
24 | <SmartPackageReference Include="@(PackageReference)"> | ||
25 | <PackageName>%(Identity)</PackageName> | ||
26 | <InSolution>$(SolutionFileContent.Contains('\%(Identity).csproj'))</InSolution> | ||
27 | </SmartPackageReference> | ||
28 | |||
29 | <!-- Filter them by mapping them to another ItemGroup using the WithMetadataValue item function --> | ||
30 | <PackageInSolution Include="@(SmartPackageReference->WithMetadataValue('InSolution', True))"> | ||
31 | <Pattern>$(RegexPattern.Replace('[PackageName]','%(PackageName)') )</Pattern> | ||
32 | <SmartPath>$([System.Text.RegularExpressions.Regex]::Match('$(SolutionFileContent)', '%(Pattern)'))</SmartPath> | ||
33 | </PackageInSolution> | ||
34 | |||
35 | <ProjectReference Include="@(PackageInSolution->'$(SmartSolutionDir)\%(SmartPath)' )"/> | ||
36 | |||
37 | <!-- Remove the package references that are now referenced as projects --> | ||
38 | <PackageReference Remove="@(PackageInSolution->'%(PackageName)' )"/> | ||
39 | </ItemGroup> | ||
40 | |||
41 | </When> | ||
42 | </Choose> | ||
43 | </Project> | ||
diff --git a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj index 31de1095..31d5ca87 100644 --- a/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj +++ b/src/WixToolset.Extensibility/WixToolset.Extensibility.csproj | |||
@@ -11,8 +11,7 @@ | |||
11 | </PropertyGroup> | 11 | </PropertyGroup> |
12 | 12 | ||
13 | <ItemGroup> | 13 | <ItemGroup> |
14 | <ProjectReference Include="$(WixToolsetRootFolder)\Data\src\WixToolset.Data\WixToolset.Data.csproj" Condition=" '$(Configuration)' == 'Debug' And Exists('$(WixToolsetRootFolder)\Data\src\WixToolset.Data\WixToolset.Data.csproj') " /> | 14 | <PackageReference Include="WixToolset.Data" Version="4.0.*" /> |
15 | <PackageReference Include="WixToolset.Data" Version="4.0.*" Condition=" '$(Configuration)' == 'Release' Or !Exists('$(WixToolsetRootFolder)\Data\src\WixToolset.Data\WixToolset.Data.csproj') " /> | ||
16 | </ItemGroup> | 15 | </ItemGroup> |
17 | 16 | ||
18 | <ItemGroup> | 17 | <ItemGroup> |