diff options
| author | Rob Mensching <rob@firegiant.com> | 2017-12-08 10:10:26 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2017-12-08 10:10:26 -0800 |
| commit | c99ba1a05efffd7c43edd87380bc1442942de7a9 (patch) | |
| tree | 257baf2ee69ea20a3675e0fa3eb8bef9aae725f2 /src | |
| parent | 760e7ebaa490ea6e1a20c9e127de5024d44a3fea (diff) | |
| download | wix-c99ba1a05efffd7c43edd87380bc1442942de7a9.tar.gz wix-c99ba1a05efffd7c43edd87380bc1442942de7a9.tar.bz2 wix-c99ba1a05efffd7c43edd87380bc1442942de7a9.zip | |
Support and test preprocessor variables without "var." prefix
Diffstat (limited to 'src')
4 files changed, 71 insertions, 33 deletions
diff --git a/src/WixToolset.Core/CommandLine/CommandLineOption.cs b/src/WixToolset.Core/CommandLine/CommandLineOption.cs deleted file mode 100644 index 85a654bf..00000000 --- a/src/WixToolset.Core/CommandLine/CommandLineOption.cs +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | // 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. | ||
| 2 | |||
| 3 | namespace WixToolset | ||
| 4 | { | ||
| 5 | /// <summary> | ||
| 6 | /// A command line option. | ||
| 7 | /// </summary> | ||
| 8 | public struct CommandLineOption | ||
| 9 | { | ||
| 10 | public string Option; | ||
| 11 | public string Description; | ||
| 12 | public int AdditionalArguments; | ||
| 13 | |||
| 14 | /// <summary> | ||
| 15 | /// Instantiates a new BuilderCommandLineOption. | ||
| 16 | /// </summary> | ||
| 17 | /// <param name="option">The option name.</param> | ||
| 18 | /// <param name="description">The description of the option.</param> | ||
| 19 | /// <param name="additionalArguments">Count of additional arguments to require after this switch.</param> | ||
| 20 | public CommandLineOption(string option, string description, int additionalArguments) | ||
| 21 | { | ||
| 22 | this.Option = option; | ||
| 23 | this.Description = description; | ||
| 24 | this.AdditionalArguments = additionalArguments; | ||
| 25 | } | ||
| 26 | } | ||
| 27 | } | ||
diff --git a/src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs b/src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs index 3b8011c4..bcbd6a67 100644 --- a/src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs +++ b/src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs | |||
| @@ -86,7 +86,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 86 | // the use of open and closed parens inside variable names. Example: $(env.ProgramFiles(x86)) should resolve. | 86 | // the use of open and closed parens inside variable names. Example: $(env.ProgramFiles(x86)) should resolve. |
| 87 | if (result == null) | 87 | if (result == null) |
| 88 | { | 88 | { |
| 89 | result = this.GetVariableValue(context, function, false); | 89 | result = this.GetVariableValue(context, function, true); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | return result; | 92 | return result; |
| @@ -403,7 +403,7 @@ namespace WixToolset.Core.ExtensibilityServices | |||
| 403 | } | 403 | } |
| 404 | else | 404 | else |
| 405 | { | 405 | { |
| 406 | result = this.GetVariableValue(context, subString, false); | 406 | result = this.GetVariableValue(context, subString, true); |
| 407 | } | 407 | } |
| 408 | 408 | ||
| 409 | if (null == result) | 409 | if (null == result) |
diff --git a/src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs index 62920142..614107b0 100644 --- a/src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/ProgramFixture.cs | |||
| @@ -73,7 +73,7 @@ namespace WixToolsetTest.CoreIntegration | |||
| 73 | Assert.Equal(0, result); | 73 | Assert.Equal(0, result); |
| 74 | 74 | ||
| 75 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.msi"))); | 75 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.msi"))); |
| 76 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\cab1.cab"))); | 76 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\example.cab"))); |
| 77 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.wixpdb"))); | 77 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.wixpdb"))); |
| 78 | 78 | ||
| 79 | var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"bin\test.wir")); | 79 | var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"bin\test.wir")); |
| @@ -86,6 +86,66 @@ namespace WixToolsetTest.CoreIntegration | |||
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | [Fact] | 88 | [Fact] |
| 89 | public void CanBuildSingleFileCompressedWithMediaTemplate() | ||
| 90 | { | ||
| 91 | var folder = TestData.Get(@"TestData\SingleFileCompressed"); | ||
| 92 | |||
| 93 | using (var fs = new DisposableFileSystem()) | ||
| 94 | { | ||
| 95 | var intermediateFolder = fs.GetFolder(); | ||
| 96 | |||
| 97 | var program = new Program(); | ||
| 98 | var result = program.Run(new WixToolsetServiceProvider(), new[] | ||
| 99 | { | ||
| 100 | "build", | ||
| 101 | Path.Combine(folder, "Package.wxs"), | ||
| 102 | Path.Combine(folder, "PackageComponents.wxs"), | ||
| 103 | "-d", "MediaTemplateCompressionLevel", | ||
| 104 | "-loc", Path.Combine(folder, "Package.en-us.wxl"), | ||
| 105 | "-bindpath", Path.Combine(folder, "data"), | ||
| 106 | "-intermediateFolder", intermediateFolder, | ||
| 107 | "-o", Path.Combine(intermediateFolder, @"bin\test.msi") | ||
| 108 | }); | ||
| 109 | |||
| 110 | Assert.Equal(0, result); | ||
| 111 | |||
| 112 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.msi"))); | ||
| 113 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\cab1.cab"))); | ||
| 114 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.wixpdb"))); | ||
| 115 | } | ||
| 116 | } | ||
| 117 | |||
| 118 | [Fact] | ||
| 119 | public void CanBuildSingleFileCompressedWithMediaTemplateWithLowCompression() | ||
| 120 | { | ||
| 121 | var folder = TestData.Get(@"TestData\SingleFileCompressed"); | ||
| 122 | |||
| 123 | using (var fs = new DisposableFileSystem()) | ||
| 124 | { | ||
| 125 | var intermediateFolder = fs.GetFolder(); | ||
| 126 | |||
| 127 | var program = new Program(); | ||
| 128 | var result = program.Run(new WixToolsetServiceProvider(), new[] | ||
| 129 | { | ||
| 130 | "build", | ||
| 131 | Path.Combine(folder, "Package.wxs"), | ||
| 132 | Path.Combine(folder, "PackageComponents.wxs"), | ||
| 133 | "-d", "MediaTemplateCompressionLevel=low", | ||
| 134 | "-loc", Path.Combine(folder, "Package.en-us.wxl"), | ||
| 135 | "-bindpath", Path.Combine(folder, "data"), | ||
| 136 | "-intermediateFolder", intermediateFolder, | ||
| 137 | "-o", Path.Combine(intermediateFolder, @"bin\test.msi") | ||
| 138 | }); | ||
| 139 | |||
| 140 | Assert.Equal(0, result); | ||
| 141 | |||
| 142 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.msi"))); | ||
| 143 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\lowcab1.cab"))); | ||
| 144 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.wixpdb"))); | ||
| 145 | } | ||
| 146 | } | ||
| 147 | |||
| 148 | [Fact] | ||
| 89 | public void CanBuildSimpleModule() | 149 | public void CanBuildSimpleModule() |
| 90 | { | 150 | { |
| 91 | var folder = TestData.Get(@"TestData\SimpleModule"); | 151 | var folder = TestData.Get(@"TestData\SimpleModule"); |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SingleFileCompressed/Package.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/SingleFileCompressed/Package.wxs index 2f37a237..0b743c81 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/SingleFileCompressed/Package.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SingleFileCompressed/Package.wxs | |||
| @@ -4,10 +4,15 @@ | |||
| 4 | <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> | 4 | <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> |
| 5 | 5 | ||
| 6 | <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" /> | 6 | <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" /> |
| 7 | <!--<MediaTemplate />--> | ||
| 8 | <MediaTemplate CompressionLevel="low" /> | ||
| 9 | <!--<Media Id="1" Cabinet="example.cab" />--> | ||
| 10 | 7 | ||
| 8 | <?ifndef MediaTemplateCompressionLevel?> | ||
| 9 | <Media Id="1" Cabinet="example.cab" /> | ||
| 10 | <?elseif $(MediaTemplateCompressionLevel) = ""?> | ||
| 11 | <MediaTemplate /> | ||
| 12 | <?else?> | ||
| 13 | <MediaTemplate CabinetTemplate="lowcab{0}.cab" CompressionLevel="$(MediaTemplateCompressionLevel)" /> | ||
| 14 | <?endif?> | ||
| 15 | |||
| 11 | <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)"> | 16 | <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)"> |
| 12 | <ComponentGroupRef Id="ProductComponents" /> | 17 | <ComponentGroupRef Id="ProductComponents" /> |
| 13 | </Feature> | 18 | </Feature> |
