-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the WiX stdlib. See WIP at wixtoolset/issues#7581.
- Loading branch information
Showing
9 changed files
with
246 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
|
||
namespace WixToolset.Core | ||
{ | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using WixToolset.Data; | ||
using WixToolset.Data.Symbols; | ||
|
||
internal class AssignDefaultFeatureCommand | ||
{ | ||
public AssignDefaultFeatureCommand(IntermediateSection entrySection, IEnumerable<IntermediateSection> sections) | ||
{ | ||
this.EntrySection = entrySection; | ||
this.Sections = sections; | ||
} | ||
|
||
public IntermediateSection EntrySection { get; } | ||
|
||
public IEnumerable<IntermediateSection> Sections { get; } | ||
|
||
public void Execute() | ||
{ | ||
foreach (var section in this.Sections) | ||
{ | ||
var components = section.Symbols.OfType<ComponentSymbol>().ToList(); | ||
foreach (var component in components) | ||
{ | ||
this.EntrySection.AddSymbol(new WixComplexReferenceSymbol(component.SourceLineNumbers) | ||
{ | ||
Parent = WixStandardLibraryIdentifiers.DefaultFeatureName, | ||
ParentType = ComplexReferenceParentType.Feature, | ||
ParentLanguage = null, | ||
Child = component.Id.Id, | ||
ChildType = ComplexReferenceChildType.Component, | ||
IsPrimary = true, | ||
}); | ||
|
||
this.EntrySection.AddSymbol(new WixGroupSymbol(component.SourceLineNumbers) | ||
{ | ||
ParentId = WixStandardLibraryIdentifiers.DefaultFeatureName, | ||
ParentType = ComplexReferenceParentType.Feature, | ||
ChildId = component.Id.Id, | ||
ChildType = ComplexReferenceChildType.Component, | ||
}); | ||
} | ||
} | ||
|
||
this.EntrySection.AddSymbol(new WixSimpleReferenceSymbol() | ||
{ | ||
Table = "Feature", | ||
PrimaryKeys = WixStandardLibraryIdentifiers.DefaultFeatureName, | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/wix/test/WixToolsetTest.CoreIntegration/TestData/Feature/PackageBadDefaultFeature.wxs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
<Package Name="PackageMissingFeatureComponentMapping" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="12E4699F-E774-4D05-8A01-5BDD41BBA127"> | ||
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> | ||
|
||
<StandardDirectory Id="ProgramFiles6432Folder"> | ||
<Directory Id="INSTALLFOLDER" Name="PackageMissingFeatureComponentMapping"> | ||
<Directory Id="SubFolder" Name="NotMapped"> | ||
<Component> | ||
<File Source="test.txt" /> | ||
</Component> | ||
</Directory> | ||
</Directory> | ||
</StandardDirectory> | ||
|
||
<Feature Id="MissingComponentFeature" /> | ||
|
||
<Component Directory="INSTALLFOLDER"> | ||
<File Source="test.txt" /> | ||
</Component> | ||
|
||
<ComponentGroup Id="ImplicitFeatureComponentGroup" Directory="INSTALLFOLDER"> | ||
<Component> | ||
<File Name="test2.txt" Source="test.txt" /> | ||
</Component> | ||
</ComponentGroup> | ||
</Package> | ||
</Wix> |
46 changes: 46 additions & 0 deletions
46
src/wix/test/WixToolsetTest.CoreIntegration/TestData/Feature/PackageDefaultFeature.wxs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
<Package Name="PackageMissingFeatureComponentMapping" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="12E4699F-E774-4D05-8A01-5BDD41BBA127"> | ||
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> | ||
|
||
<StandardDirectory Id="ProgramFiles6432Folder"> | ||
<Directory Id="INSTALLFOLDER" Name="PackageMissingFeatureComponentMapping"> | ||
<Directory Id="SubFolder" Name="NotMapped"> | ||
<Component> | ||
<File Source="test.txt" /> | ||
</Component> | ||
</Directory> | ||
</Directory> | ||
</StandardDirectory> | ||
|
||
<Component Directory="INSTALLFOLDER"> | ||
<File Source="test.txt" /> | ||
</Component> | ||
|
||
<ComponentRef Id="ComponentInAFragment" /> | ||
<ComponentGroupRef Id="ComponentGroupInAFragment" /> | ||
<FeatureGroupRef Id="FeatureGroupInAFragment" /> | ||
</Package> | ||
|
||
<Fragment> | ||
<ComponentGroup Id="ComponentGroupInAFragment" Directory="INSTALLFOLDER"> | ||
<Component> | ||
<File Name="test2.txt" Source="test.txt" /> | ||
</Component> | ||
</ComponentGroup> | ||
</Fragment> | ||
|
||
<Fragment> | ||
<FeatureGroup Id="FeatureGroupInAFragment" /> | ||
|
||
<Component Id="AnotherComponentInAFragment" Directory="INSTALLFOLDER"> | ||
<File Name="test3.txt" Source="test.txt" /> | ||
<Shortcut Id="AdvertisedShortcut" Advertise="yes" Name="Shortcut" /> | ||
</Component> | ||
</Fragment> | ||
|
||
<Fragment> | ||
<Component Id="ComponentInAFragment" Directory="INSTALLFOLDER"> | ||
<File Name="test4.txt" Source="test.txt" /> | ||
</Component> | ||
</Fragment> | ||
</Wix> |