Pass along include search paths to those that need it.
Bob Arnson committed
Dec 29, 2017 at 15:12 UTC
59004832767115df136c553169e992577e5981d6
9 files changed
+99
-2
src/WixToolset.Core/CommandLine/BuildCommand.cs
+2
-1
@@ -13,7 +13,7 @@ namespace WixToolset.Core.CommandLine
13
14
internal class BuildCommand : ICommandLineCommand
15
{
16
- public BuildCommand(IServiceProvider serviceProvider, IEnumerable<SourceFile> sources, IDictionary<string, string> preprocessorVariables, IEnumerable<string> locFiles, IEnumerable<string> libraryFiles, string outputPath, OutputType outputType, string cabCachePath, IEnumerable<string> cultures, bool bindFiles, IEnumerable<BindPath> bindPaths, string intermediateFolder, string contentsFile, string outputsFile, string builtOutputsFile)
16
+ public BuildCommand(IServiceProvider serviceProvider, IEnumerable<SourceFile> sources, IDictionary<string, string> preprocessorVariables, IEnumerable<string> locFiles, IEnumerable<string> libraryFiles, string outputPath, OutputType outputType, string cabCachePath, IEnumerable<string> cultures, bool bindFiles, IEnumerable<BindPath> bindPaths, IEnumerable<string> includeSearchPaths, string intermediateFolder, string contentsFile, string outputsFile, string builtOutputsFile)
17
{
18
this.ServiceProvider = serviceProvider;
19
this.Messaging = serviceProvider.GetService<IMessaging>();
@@ -29,6 +29,7 @@ namespace WixToolset.Core.CommandLine
29
this.Cultures = cultures;
30
this.BindFiles = bindFiles;
31
this.BindPaths = bindPaths;
32
+ this.IncludeSearchPaths = includeSearchPaths;
33
34
this.IntermediateFolder = intermediateFolder ?? Path.GetTempPath();
35
this.ContentsFile = contentsFile;
src/WixToolset.Core/CommandLine/CommandLineParser.cs
+5
-1
@@ -171,6 +171,10 @@ namespace WixToolset.Core.CommandLine
171
case "-version":
172
showVersion = true;
173
return true;
174
+
175
+ case "sval":
176
+ // todo: implement
177
+ return true;
178
}
179
180
return false;
@@ -207,7 +211,7 @@ namespace WixToolset.Core.CommandLine
211
var variables = this.GatherPreprocessorVariables(defines);
212
var bindPathList = this.GatherBindPaths(bindPaths);
213
var type = CalculateOutputType(outputType, outputFile);
210
- return new BuildCommand(this.ServiceProvider, sourceFiles, variables, locFiles, libraryFiles, outputFile, type, cabCachePath, cultures, bindFiles, bindPathList, intermediateFolder, contentsFile, outputsFile, builtOutputsFile);
214
+ return new BuildCommand(this.ServiceProvider, sourceFiles, variables, locFiles, libraryFiles, outputFile, type, cabCachePath, cultures, bindFiles, bindPathList, includePaths, intermediateFolder, contentsFile, outputsFile, builtOutputsFile);
215
}
216
217
case Commands.Compile:
src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs
+39
@@ -278,6 +278,45 @@ namespace WixToolsetTest.CoreIntegration
278
}
279
}
280
281
+ [Fact]
282
+ public void CanBuildWithIncludePath()
283
+ {
284
+ var folder = TestData.Get(@"TestData\IncludePath");
285
+ var bindpath = Path.Combine(folder, "data");
286
+
287
+ using (var fs = new DisposableFileSystem())
288
+ {
289
+ var baseFolder = fs.GetFolder();
290
+ var intermediateFolder = Path.Combine(baseFolder, "obj");
291
+
292
+ var program = new Program();
293
+ var result = program.Run(new WixToolsetServiceProvider(), null, new[]
294
+ {
295
+ "build",
296
+ Path.Combine(folder, "Package.wxs"),
297
+ Path.Combine(folder, "PackageComponents.wxs"),
298
+ "-loc", Path.Combine(folder, "Package.en-us.wxl"),
299
+ "-bindpath", bindpath,
300
+ "-intermediateFolder", intermediateFolder,
301
+ "-o", Path.Combine(baseFolder, @"bin\test.msi"),
302
+ "-i", bindpath,
303
+ });
304
+
305
+ Assert.Equal(0, result);
306
+
307
+ Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi")));
308
+ Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb")));
309
+ Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\MsiPackage\test.txt")));
310
+
311
+ var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wir"));
312
+ var section = intermediate.Sections.Single();
313
+
314
+ var wixFile = section.Tuples.OfType<WixFileTuple>().Single();
315
+ Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path);
316
+ Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path);
317
+ }
318
+ }
319
+
320
[Fact(Skip = "Not implemented yet.")]
321
public void CanBuildInstanceTransform()
322
{
src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/Package.en-us.wxl
new
+11
@@ -0,0 +1,11 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+
3
+<!--
4
+This file contains the declaration of all the localizable strings.
5
+-->
6
+<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
7
+
8
+ <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String>
9
+ <String Id="FeatureTitle">MsiPackage</String>
10
+
11
+</WixLocalization>
src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/Package.wxs
new
+22
@@ -0,0 +1,22 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<?include Package.wxi ?>
3
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
4
+ <Product Id="*" Name="MsiPackage" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
5
+ <Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" />
6
+
7
+ <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
8
+ <MediaTemplate />
9
+
10
+ <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)">
11
+ <ComponentGroupRef Id="ProductComponents" />
12
+ </Feature>
13
+ </Product>
14
+
15
+ <Fragment>
16
+ <Directory Id="TARGETDIR" Name="SourceDir">
17
+ <Directory Id="ProgramFilesFolder">
18
+ <Directory Id="INSTALLFOLDER" Name="MsiPackage" />
19
+ </Directory>
20
+ </Directory>
21
+ </Fragment>
22
+</Wix>
src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/PackageComponents.wxs
new
+10
@@ -0,0 +1,10 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3
+ <Fragment>
4
+ <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
5
+ <Component>
6
+ <File Source="test.txt" />
7
+ </Component>
8
+ </ComponentGroup>
9
+ </Fragment>
10
+</Wix>
src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/data/Package.wxi
new
+4
@@ -0,0 +1,4 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Include xmlns="http://wixtoolset.org/schemas/v4/wxs">
3
+ <?define ProductVersion = "1.2.3" ?>
4
+</Include>
src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/data/test.txt
new
+1
@@ -0,0 +1 @@
1
+This is test.txt.
\ No newline at end of file
src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+5
@@ -27,6 +27,11 @@
27
<Content Include="TestData\SingleFile\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
28
<Content Include="TestData\SingleFile\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
29
<Content Include="TestData\SingleFile\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
30
+ <Content Include="TestData\IncludePath\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
31
+ <Content Include="TestData\IncludePath\data\Package.wxi" CopyToOutputDirectory="PreserveNewest" />
32
+ <Content Include="TestData\IncludePath\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
33
+ <Content Include="TestData\IncludePath\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
34
+ <Content Include="TestData\IncludePath\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
35
<Content Include="TestData\SingleFileCompressed\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
36
<Content Include="TestData\SingleFileCompressed\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
37
<Content Include="TestData\SingleFileCompressed\Package.wxs" CopyToOutputDirectory="PreserveNewest" />