From 59004832767115df136c553169e992577e5981d6 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Fri, 29 Dec 2017 15:12:24 -0500 Subject: Pass along include search paths to those that need it. --- src/WixToolset.Core/CommandLine/BuildCommand.cs | 3 +- .../CommandLine/CommandLineParser.cs | 6 +++- .../ProgramFixture.cs | 39 ++++++++++++++++++++++ .../TestData/IncludePath/Package.en-us.wxl | 11 ++++++ .../TestData/IncludePath/Package.wxs | 22 ++++++++++++ .../TestData/IncludePath/PackageComponents.wxs | 10 ++++++ .../TestData/IncludePath/data/Package.wxi | 4 +++ .../TestData/IncludePath/data/test.txt | 1 + .../WixToolsetTest.CoreIntegration.csproj | 5 +++ 9 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/Package.en-us.wxl create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/Package.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/PackageComponents.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/data/Package.wxi create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/data/test.txt (limited to 'src') diff --git a/src/WixToolset.Core/CommandLine/BuildCommand.cs b/src/WixToolset.Core/CommandLine/BuildCommand.cs index 1731caaf..fb258179 100644 --- a/src/WixToolset.Core/CommandLine/BuildCommand.cs +++ b/src/WixToolset.Core/CommandLine/BuildCommand.cs @@ -13,7 +13,7 @@ namespace WixToolset.Core.CommandLine internal class BuildCommand : ICommandLineCommand { - public BuildCommand(IServiceProvider serviceProvider, IEnumerable sources, IDictionary preprocessorVariables, IEnumerable locFiles, IEnumerable libraryFiles, string outputPath, OutputType outputType, string cabCachePath, IEnumerable cultures, bool bindFiles, IEnumerable bindPaths, string intermediateFolder, string contentsFile, string outputsFile, string builtOutputsFile) + public BuildCommand(IServiceProvider serviceProvider, IEnumerable sources, IDictionary preprocessorVariables, IEnumerable locFiles, IEnumerable libraryFiles, string outputPath, OutputType outputType, string cabCachePath, IEnumerable cultures, bool bindFiles, IEnumerable bindPaths, IEnumerable includeSearchPaths, string intermediateFolder, string contentsFile, string outputsFile, string builtOutputsFile) { this.ServiceProvider = serviceProvider; this.Messaging = serviceProvider.GetService(); @@ -29,6 +29,7 @@ namespace WixToolset.Core.CommandLine this.Cultures = cultures; this.BindFiles = bindFiles; this.BindPaths = bindPaths; + this.IncludeSearchPaths = includeSearchPaths; this.IntermediateFolder = intermediateFolder ?? Path.GetTempPath(); this.ContentsFile = contentsFile; diff --git a/src/WixToolset.Core/CommandLine/CommandLineParser.cs b/src/WixToolset.Core/CommandLine/CommandLineParser.cs index 3c7f3d1e..500bed08 100644 --- a/src/WixToolset.Core/CommandLine/CommandLineParser.cs +++ b/src/WixToolset.Core/CommandLine/CommandLineParser.cs @@ -171,6 +171,10 @@ namespace WixToolset.Core.CommandLine case "-version": showVersion = true; return true; + + case "sval": + // todo: implement + return true; } return false; @@ -207,7 +211,7 @@ namespace WixToolset.Core.CommandLine var variables = this.GatherPreprocessorVariables(defines); var bindPathList = this.GatherBindPaths(bindPaths); var type = CalculateOutputType(outputType, outputFile); - return new BuildCommand(this.ServiceProvider, sourceFiles, variables, locFiles, libraryFiles, outputFile, type, cabCachePath, cultures, bindFiles, bindPathList, intermediateFolder, contentsFile, outputsFile, builtOutputsFile); + return new BuildCommand(this.ServiceProvider, sourceFiles, variables, locFiles, libraryFiles, outputFile, type, cabCachePath, cultures, bindFiles, bindPathList, includePaths, intermediateFolder, contentsFile, outputsFile, builtOutputsFile); } case Commands.Compile: diff --git a/src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs index 7e54174d..a171981a 100644 --- a/src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs @@ -278,6 +278,45 @@ namespace WixToolsetTest.CoreIntegration } } + [Fact] + public void CanBuildWithIncludePath() + { + var folder = TestData.Get(@"TestData\IncludePath"); + var bindpath = Path.Combine(folder, "data"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + + var program = new Program(); + var result = program.Run(new WixToolsetServiceProvider(), null, new[] + { + "build", + Path.Combine(folder, "Package.wxs"), + Path.Combine(folder, "PackageComponents.wxs"), + "-loc", Path.Combine(folder, "Package.en-us.wxl"), + "-bindpath", bindpath, + "-intermediateFolder", intermediateFolder, + "-o", Path.Combine(baseFolder, @"bin\test.msi"), + "-i", bindpath, + }); + + Assert.Equal(0, result); + + Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi"))); + Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); + Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\MsiPackage\test.txt"))); + + var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wir")); + var section = intermediate.Sections.Single(); + + var wixFile = section.Tuples.OfType().Single(); + Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path); + Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); + } + } + [Fact(Skip = "Not implemented yet.")] public void CanBuildInstanceTransform() { diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/Package.en-us.wxl b/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/Package.en-us.wxl new file mode 100644 index 00000000..38c12ac1 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/Package.en-us.wxl @@ -0,0 +1,11 @@ + + + + + + A newer version of [ProductName] is already installed. + MsiPackage + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/Package.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/Package.wxs new file mode 100644 index 00000000..8deab961 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/Package.wxs @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/PackageComponents.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/PackageComponents.wxs new file mode 100644 index 00000000..e26c4509 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/PackageComponents.wxs @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/data/Package.wxi b/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/data/Package.wxi new file mode 100644 index 00000000..f2df3b86 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/data/Package.wxi @@ -0,0 +1,4 @@ + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/data/test.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/data/test.txt new file mode 100644 index 00000000..cd0db0e1 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/data/test.txt @@ -0,0 +1 @@ +This is test.txt. \ No newline at end of file diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index d406a0da..d1901b38 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj @@ -27,6 +27,11 @@ + + + + + -- cgit v1.2.3-55-g6feb