diff options
Diffstat (limited to 'src')
17 files changed, 40 insertions, 52 deletions
diff --git a/src/WixToolset.Core/Bind/ExtractEmbeddedFiles.cs b/src/WixToolset.Core/Bind/ExtractEmbeddedFiles.cs index 28fc4817..c6e21973 100644 --- a/src/WixToolset.Core/Bind/ExtractEmbeddedFiles.cs +++ b/src/WixToolset.Core/Bind/ExtractEmbeddedFiles.cs | |||
| @@ -28,19 +28,16 @@ namespace WixToolset.Core.Bind | |||
| 28 | /// <returns>The extract path for the embedded file.</returns> | 28 | /// <returns>The extract path for the embedded file.</returns> |
| 29 | public string AddEmbeddedFileIndex(Uri uri, int embeddedFileIndex, string tempPath) | 29 | public string AddEmbeddedFileIndex(Uri uri, int embeddedFileIndex, string tempPath) |
| 30 | { | 30 | { |
| 31 | string extractPath; | ||
| 32 | SortedList<int, string> extracts; | ||
| 33 | |||
| 34 | // If the uri to the file that contains the embedded file does not already have embedded files | 31 | // If the uri to the file that contains the embedded file does not already have embedded files |
| 35 | // being extracted, create the dictionary to track that. | 32 | // being extracted, create the dictionary to track that. |
| 36 | if (!filesWithEmbeddedFiles.TryGetValue(uri, out extracts)) | 33 | if (!filesWithEmbeddedFiles.TryGetValue(uri, out var extracts)) |
| 37 | { | 34 | { |
| 38 | extracts = new SortedList<int, string>(); | 35 | extracts = new SortedList<int, string>(); |
| 39 | filesWithEmbeddedFiles.Add(uri, extracts); | 36 | filesWithEmbeddedFiles.Add(uri, extracts); |
| 40 | } | 37 | } |
| 41 | 38 | ||
| 42 | // If the embedded file is not already tracked in the dictionary of extracts, add it. | 39 | // If the embedded file is not already tracked in the dictionary of extracts, add it. |
| 43 | if (!extracts.TryGetValue(embeddedFileIndex, out extractPath)) | 40 | if (!extracts.TryGetValue(embeddedFileIndex, out var extractPath)) |
| 44 | { | 41 | { |
| 45 | string localFileNameWithoutExtension = Path.GetFileNameWithoutExtension(uri.LocalPath); | 42 | string localFileNameWithoutExtension = Path.GetFileNameWithoutExtension(uri.LocalPath); |
| 46 | string unique = this.HashUri(uri.AbsoluteUri); | 43 | string unique = this.HashUri(uri.AbsoluteUri); |
diff --git a/src/WixToolset.Core/CommandLine/BuildCommand.cs b/src/WixToolset.Core/CommandLine/BuildCommand.cs index 79bacd22..7a63b869 100644 --- a/src/WixToolset.Core/CommandLine/BuildCommand.cs +++ b/src/WixToolset.Core/CommandLine/BuildCommand.cs | |||
| @@ -168,8 +168,10 @@ namespace WixToolset.Core | |||
| 168 | var context = this.ServiceProvider.GetService<ILinkContext>(); | 168 | var context = this.ServiceProvider.GetService<ILinkContext>(); |
| 169 | context.Messaging = Messaging.Instance; | 169 | context.Messaging = Messaging.Instance; |
| 170 | context.Extensions = this.ExtensionManager.Create<ILinkerExtension>(); | 170 | context.Extensions = this.ExtensionManager.Create<ILinkerExtension>(); |
| 171 | context.Intermediates = intermediates.Union(libraries).ToList(); | 171 | context.ExtensionData = this.ExtensionManager.Create<IExtensionData>(); |
| 172 | context.ExpectedOutputType = this.OutputType; | 172 | context.ExpectedOutputType = this.OutputType; |
| 173 | context.Intermediates = intermediates.Union(libraries).ToList(); | ||
| 174 | context.TupleDefinitionCreator = creator; | ||
| 173 | 175 | ||
| 174 | var linker = new Linker(); | 176 | var linker = new Linker(); |
| 175 | var output = linker.Link(context); | 177 | var output = linker.Link(context); |
diff --git a/src/WixToolset.Core/LinkContext.cs b/src/WixToolset.Core/LinkContext.cs index c3631f72..1384cf98 100644 --- a/src/WixToolset.Core/LinkContext.cs +++ b/src/WixToolset.Core/LinkContext.cs | |||
| @@ -21,8 +21,12 @@ namespace WixToolset.Core | |||
| 21 | 21 | ||
| 22 | public IEnumerable<ILinkerExtension> Extensions { get; set; } | 22 | public IEnumerable<ILinkerExtension> Extensions { get; set; } |
| 23 | 23 | ||
| 24 | public IEnumerable<IExtensionData> ExtensionData { get; set; } | ||
| 25 | |||
| 24 | public OutputType ExpectedOutputType { get; set; } | 26 | public OutputType ExpectedOutputType { get; set; } |
| 25 | 27 | ||
| 26 | public IEnumerable<Intermediate> Intermediates { get; set; } | 28 | public IEnumerable<Intermediate> Intermediates { get; set; } |
| 29 | |||
| 30 | public ITupleDefinitionCreator TupleDefinitionCreator { get; set; } | ||
| 27 | } | 31 | } |
| 28 | } | 32 | } |
diff --git a/src/WixToolset.Core/Linker.cs b/src/WixToolset.Core/Linker.cs index 7faf69ba..c893a01d 100644 --- a/src/WixToolset.Core/Linker.cs +++ b/src/WixToolset.Core/Linker.cs | |||
| @@ -56,32 +56,6 @@ namespace WixToolset.Core | |||
| 56 | //internal IBindVariableResolver WixVariableResolver { get; set; } | 56 | //internal IBindVariableResolver WixVariableResolver { get; set; } |
| 57 | 57 | ||
| 58 | /// <summary> | 58 | /// <summary> |
| 59 | /// Adds an extension. | ||
| 60 | /// </summary> | ||
| 61 | /// <param name="extension">The extension to add.</param> | ||
| 62 | //public void AddExtensionData(IExtensionData extension) | ||
| 63 | //{ | ||
| 64 | // if (null != extension.TableDefinitions) | ||
| 65 | // { | ||
| 66 | // foreach (TableDefinition tableDefinition in extension.TableDefinitions) | ||
| 67 | // { | ||
| 68 | // if (!this.tableDefinitions.Contains(tableDefinition.Name)) | ||
| 69 | // { | ||
| 70 | // this.tableDefinitions.Add(tableDefinition); | ||
| 71 | // } | ||
| 72 | // else | ||
| 73 | // { | ||
| 74 | // throw new WixException(WixErrors.DuplicateExtensionTable(extension.GetType().ToString(), tableDefinition.Name)); | ||
| 75 | // } | ||
| 76 | // } | ||
| 77 | // } | ||
| 78 | |||
| 79 | // // keep track of extension data so the libraries can be loaded from these later once all the table definitions | ||
| 80 | // // are loaded; this will allow extensions to have cross table definition dependencies | ||
| 81 | // this.extensionData.Add(extension); | ||
| 82 | //} | ||
| 83 | |||
| 84 | /// <summary> | ||
| 85 | /// Links a collection of sections into an output. | 59 | /// Links a collection of sections into an output. |
| 86 | /// </summary> | 60 | /// </summary> |
| 87 | /// <param name="inputs">The collection of sections to link together.</param> | 61 | /// <param name="inputs">The collection of sections to link together.</param> |
| @@ -91,10 +65,19 @@ namespace WixToolset.Core | |||
| 91 | { | 65 | { |
| 92 | this.Context = context ?? throw new ArgumentNullException(nameof(context)); | 66 | this.Context = context ?? throw new ArgumentNullException(nameof(context)); |
| 93 | 67 | ||
| 94 | //IEnumerable<Section> inputs, OutputType expectedOutputType | ||
| 95 | |||
| 96 | var sections = this.Context.Intermediates.SelectMany(i => i.Sections).ToList(); | 68 | var sections = this.Context.Intermediates.SelectMany(i => i.Sections).ToList(); |
| 97 | 69 | ||
| 70 | // Add sections from the extensions with data. | ||
| 71 | foreach (var data in context.ExtensionData) | ||
| 72 | { | ||
| 73 | var library = data.GetLibrary(context.TupleDefinitionCreator); | ||
| 74 | |||
| 75 | if (library != null) | ||
| 76 | { | ||
| 77 | sections.AddRange(library.Sections); | ||
| 78 | } | ||
| 79 | } | ||
| 80 | |||
| 98 | #if MOVE_TO_BACKEND | 81 | #if MOVE_TO_BACKEND |
| 99 | bool containsModuleSubstitution = false; | 82 | bool containsModuleSubstitution = false; |
| 100 | bool containsModuleConfiguration = false; | 83 | bool containsModuleConfiguration = false; |
| @@ -144,19 +127,6 @@ namespace WixToolset.Core | |||
| 144 | } | 127 | } |
| 145 | #endif | 128 | #endif |
| 146 | 129 | ||
| 147 | #if TODO | ||
| 148 | // Add sections from the extensions with data. | ||
| 149 | foreach (IExtensionData data in this.extensionData) | ||
| 150 | { | ||
| 151 | Library library = data.GetLibrary(this.tableDefinitions); | ||
| 152 | |||
| 153 | if (null != library) | ||
| 154 | { | ||
| 155 | sections.AddRange(library.Sections); | ||
| 156 | } | ||
| 157 | } | ||
| 158 | #endif | ||
| 159 | |||
| 160 | // First find the entry section and while processing all sections load all the symbols from all of the sections. | 130 | // First find the entry section and while processing all sections load all the symbols from all of the sections. |
| 161 | // sections.FindEntrySectionAndLoadSymbols(false, this, expectedOutputType, out entrySection, out allSymbols); | 131 | // sections.FindEntrySectionAndLoadSymbols(false, this, expectedOutputType, out entrySection, out allSymbols); |
| 162 | var find = new FindEntrySectionAndLoadSymbolsCommand(sections); | 132 | var find = new FindEntrySectionAndLoadSymbolsCommand(sections); |
diff --git a/src/test/TestData/Example.Extension/Data/example.txt b/src/test/TestData/Example.Extension/Data/example.txt new file mode 100644 index 00000000..1b4ffe8a --- /dev/null +++ b/src/test/TestData/Example.Extension/Data/example.txt | |||
| @@ -0,0 +1 @@ | |||
| This is example.txt. \ No newline at end of file | |||
diff --git a/src/test/TestData/Example.Extension/Data/example.wir b/src/test/TestData/Example.Extension/Data/example.wir new file mode 100644 index 00000000..674f63fc --- /dev/null +++ b/src/test/TestData/Example.Extension/Data/example.wir | |||
| Binary files differ | |||
diff --git a/src/test/TestData/Example.Extension/Data/example.wxs b/src/test/TestData/Example.Extension/Data/example.wxs new file mode 100644 index 00000000..53531e99 --- /dev/null +++ b/src/test/TestData/Example.Extension/Data/example.wxs | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | <?xml version='1.0'?> | ||
| 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
| 3 | <Fragment> | ||
| 4 | <Property Id="PropertyFromExampleWir" Value="FromWir" /> | ||
| 5 | |||
| 6 | <Binary Id="BinFromWir" SourceFile="example.txt" /> | ||
| 7 | </Fragment> | ||
| 8 | </Wix> | ||
diff --git a/src/test/Example.Extension/Example.Extension.csproj b/src/test/TestData/Example.Extension/Example.Extension.csproj index 80c64b25..d04ce553 100644 --- a/src/test/Example.Extension/Example.Extension.csproj +++ b/src/test/TestData/Example.Extension/Example.Extension.csproj | |||
| @@ -8,6 +8,10 @@ | |||
| 8 | </PropertyGroup> | 8 | </PropertyGroup> |
| 9 | 9 | ||
| 10 | <ItemGroup> | 10 | <ItemGroup> |
| 11 | <EmbeddedResource Include="Data\Example.wir" /> | ||
| 12 | </ItemGroup> | ||
| 13 | |||
| 14 | <ItemGroup> | ||
| 11 | <ProjectReference Include="$(WixToolsetRootFolder)\Data\src\WixToolset.Data\WixToolset.Data.csproj" Condition=" '$(Configuration)' == 'Debug' And Exists('$(WixToolsetRootFolder)\Data\src\WixToolset.Data\WixToolset.Data.csproj') " /> | 15 | <ProjectReference Include="$(WixToolsetRootFolder)\Data\src\WixToolset.Data\WixToolset.Data.csproj" Condition=" '$(Configuration)' == 'Debug' And Exists('$(WixToolsetRootFolder)\Data\src\WixToolset.Data\WixToolset.Data.csproj') " /> |
| 12 | <PackageReference Include="WixToolset.Data" Version="4.0.*" Condition=" '$(Configuration)' == 'Release' Or !Exists('$(WixToolsetRootFolder)\Data\src\WixToolset.Data\WixToolset.Data.csproj') " /> | 16 | <PackageReference Include="WixToolset.Data" Version="4.0.*" Condition=" '$(Configuration)' == 'Release' Or !Exists('$(WixToolsetRootFolder)\Data\src\WixToolset.Data\WixToolset.Data.csproj') " /> |
| 13 | 17 | ||
diff --git a/src/test/Example.Extension/ExampleCompilerExtension.cs b/src/test/TestData/Example.Extension/ExampleCompilerExtension.cs index 5b20e48f..5b20e48f 100644 --- a/src/test/Example.Extension/ExampleCompilerExtension.cs +++ b/src/test/TestData/Example.Extension/ExampleCompilerExtension.cs | |||
diff --git a/src/test/Example.Extension/ExampleExtensionData.cs b/src/test/TestData/Example.Extension/ExampleExtensionData.cs index c3cb0473..6b179ea6 100644 --- a/src/test/Example.Extension/ExampleExtensionData.cs +++ b/src/test/TestData/Example.Extension/ExampleExtensionData.cs | |||
| @@ -11,7 +11,7 @@ namespace Example.Extension | |||
| 11 | 11 | ||
| 12 | public Intermediate GetLibrary(ITupleDefinitionCreator tupleDefinitions) | 12 | public Intermediate GetLibrary(ITupleDefinitionCreator tupleDefinitions) |
| 13 | { | 13 | { |
| 14 | return null; | 14 | return Intermediate.Load(typeof(ExampleExtensionData).Assembly, "Example.Extension.Data.Example.wir", tupleDefinitions); |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | public bool TryGetTupleDefinitionByName(string name, out IntermediateTupleDefinition tupleDefinition) | 17 | public bool TryGetTupleDefinitionByName(string name, out IntermediateTupleDefinition tupleDefinition) |
diff --git a/src/test/Example.Extension/ExampleExtensionFactory.cs b/src/test/TestData/Example.Extension/ExampleExtensionFactory.cs index b91d06e9..b91d06e9 100644 --- a/src/test/Example.Extension/ExampleExtensionFactory.cs +++ b/src/test/TestData/Example.Extension/ExampleExtensionFactory.cs | |||
diff --git a/src/test/Example.Extension/ExamplePreprocessorExtensionAndCommandLine.cs b/src/test/TestData/Example.Extension/ExamplePreprocessorExtensionAndCommandLine.cs index 53394ea3..53394ea3 100644 --- a/src/test/Example.Extension/ExamplePreprocessorExtensionAndCommandLine.cs +++ b/src/test/TestData/Example.Extension/ExamplePreprocessorExtensionAndCommandLine.cs | |||
diff --git a/src/test/Example.Extension/ExampleTuple.cs b/src/test/TestData/Example.Extension/ExampleTuple.cs index f280a5c8..f280a5c8 100644 --- a/src/test/Example.Extension/ExampleTuple.cs +++ b/src/test/TestData/Example.Extension/ExampleTuple.cs | |||
diff --git a/src/test/Example.Extension/TupleDefinitions.cs b/src/test/TestData/Example.Extension/TupleDefinitions.cs index 2c320fbc..2c320fbc 100644 --- a/src/test/Example.Extension/TupleDefinitions.cs +++ b/src/test/TestData/Example.Extension/TupleDefinitions.cs | |||
diff --git a/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs index 6acf3472..bd4b70da 100644 --- a/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs | |||
| @@ -44,13 +44,13 @@ namespace WixToolsetTest.CoreIntegration | |||
| 44 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\MsiPackage\example.txt"))); | 44 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\MsiPackage\example.txt"))); |
| 45 | 45 | ||
| 46 | var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"bin\extest.wir")); | 46 | var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"bin\extest.wir")); |
| 47 | Assert.Single(intermediate.Sections); | 47 | var section = intermediate.Sections.Single(); |
| 48 | 48 | ||
| 49 | var wixFile = intermediate.Sections.SelectMany(s => s.Tuples).OfType<WixFileTuple>().Single(); | 49 | var wixFile = section.Tuples.OfType<WixFileTuple>().Single(); |
| 50 | Assert.Equal(Path.Combine(folder, @"data\example.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path); | 50 | Assert.Equal(Path.Combine(folder, @"data\example.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path); |
| 51 | Assert.Equal(@"example.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); | 51 | Assert.Equal(@"example.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); |
| 52 | 52 | ||
| 53 | var example = intermediate.Sections.SelectMany(s => s.Tuples).Where(t => t.Definition.Type == TupleDefinitionType.MustBeFromAnExtension).Single(); | 53 | var example = section.Tuples.Where(t => t.Definition.Type == TupleDefinitionType.MustBeFromAnExtension).Single(); |
| 54 | Assert.Equal("Foo", example.Id.Id); | 54 | Assert.Equal("Foo", example.Id.Id); |
| 55 | Assert.Equal("Foo", example[0].AsString()); | 55 | Assert.Equal("Foo", example[0].AsString()); |
| 56 | Assert.Equal("Bar", example[1].AsString()); | 56 | Assert.Equal("Bar", example[1].AsString()); |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/ExampleExtension/Package.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/ExampleExtension/Package.wxs index 9fd42214..bff5f609 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/ExampleExtension/Package.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/ExampleExtension/Package.wxs | |||
| @@ -8,6 +8,8 @@ | |||
| 8 | 8 | ||
| 9 | <Property Id="ExampleProperty" Value="$(ex.Test)" /> | 9 | <Property Id="ExampleProperty" Value="$(ex.Test)" /> |
| 10 | 10 | ||
| 11 | <PropertyRef Id="PropertyFromExampleWir" /> | ||
| 12 | |||
| 11 | <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)"> | 13 | <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)"> |
| 12 | <ComponentGroupRef Id="ProductComponents" /> | 14 | <ComponentGroupRef Id="ProductComponents" /> |
| 13 | </Feature> | 15 | </Feature> |
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index ed0d5f5e..af520116 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | 31 | ||
| 32 | <ItemGroup> | 32 | <ItemGroup> |
| 33 | <ProjectReference Include="..\..\wix\wix.csproj" /> | 33 | <ProjectReference Include="..\..\wix\wix.csproj" /> |
| 34 | <ProjectReference Include="..\Example.Extension\Example.Extension.csproj" /> | 34 | <ProjectReference Include="..\TestData\Example.Extension\Example.Extension.csproj" /> |
| 35 | </ItemGroup> | 35 | </ItemGroup> |
| 36 | 36 | ||
| 37 | <ItemGroup> | 37 | <ItemGroup> |
