Exemple #1
0
 /// <summary>
 /// Builds a transform from two setup packages
 /// </summary>
 /// <param name="workingDirectory">WiX working directory</param>
 /// <param name="target">The target file</param>
 /// <param name="update">The updated file</param>
 /// <param name="inputXML">If true, the inputs to Torch are XML</param>
 /// <param name="transform">The name of the transform</param>
 /// <param name="outputXML">If true, create an MST in wixout format</param>
 /// <param name="otherTorchArguments">Additional arguments to pass to Torch</param>
 public static void BuildTransform(string workingDirectory, string target, string update, bool inputXML, string transform, bool outputXML, string otherTorchArguments)
 {
     // Build Transform
     Torch torch = new Torch();
     torch.WorkingDirectory = workingDirectory;
     torch.TargetInput = target;
     torch.UpdatedInput = update;
     torch.XmlInput = inputXML;
     torch.OutputFile = transform;
     torch.XmlOutput = outputXML;
     torch.PreserveUnmodified = true;
     torch.OtherArguments = otherTorchArguments;
     torch.Run();
 }
Exemple #2
0
 /// <summary>
 /// Builds a transform from two setup packages
 /// </summary>
 /// <param name="workingDirectory">WiX working directory</param>
 /// <param name="target">The target file</param>
 /// <param name="update">The updated file</param>
 /// <param name="inputXML">If true, the inputs to Torch are XML</param>
 /// <param name="transform">The name of the transform</param>
 /// <param name="outputXML">If true, create an MST in wixout format</param>
 /// <param name="otherTorchArguments">Additional arguments to pass to Torch</param>
 public static void BuildTransform(string workingDirectory, string target, string update, bool inputXML, string transform, bool outputXML, string otherTorchArguments)
 {
     // Build Transform
     Torch torch = new Torch();
     torch.WorkingDirectory = workingDirectory;
     torch.TargetInput = target;
     torch.UpdatedInput = update;
     torch.XmlInput = inputXML;
     torch.OutputFile = transform;
     torch.XmlOutput = outputXML;
     torch.PreserveUnmodified = true;
     torch.OtherArguments = otherTorchArguments;
     torch.Run();
 }
        /// <summary>
        /// Builds a patch using given paths for the target and upgrade packages.
        /// </summary>
        /// <param name="targetPath">The path to the target MSI.</param>
        /// <param name="upgradePath">The path to the upgrade MSI.</param>
        /// <param name="name">The name of the patch to build.</param>
        /// <param name="version">Optional version for the bundle.</param>
        /// <returns>The path to the patch.</returns>
        private string BuildPatch(string targetPath, string upgradePath, string name, string version)
        {
            // Get the name of the calling method.
            StackTrace stack = new StackTrace();
            string caller = stack.GetFrame(1).GetMethod().Name;

            // Create paths.
            string source = Path.Combine(TestDataDirectory, String.Concat(name, ".wxs"));
            string rootDirectory = FileUtilities.GetUniqueFileName();
            string objDirectory = Path.Combine(rootDirectory, Settings.WixobjFolder);
            string msiDirectory = Path.Combine(rootDirectory, Settings.MSIFolder);
            string wixmst = Path.Combine(objDirectory, String.Concat(name, ".wixmst"));
            string wixmsp = Path.Combine(objDirectory, String.Concat(name, ".wixmsp"));
            string package = Path.Combine(msiDirectory, String.Concat(name, ".msp"));

            // Add the root directory to be cleaned up.
            this.TestArtifacts.Add(new DirectoryInfo(rootDirectory));

            // Compile.
            Candle candle = new Candle();
            candle.Extensions.AddRange(DependencyExtensionTests.Extensions);
            candle.OtherArguments = String.Concat("-dTestName=", caller);
            if (!String.IsNullOrEmpty(version))
            {
                candle.OtherArguments = String.Concat(candle.OtherArguments, " -dVersion=", version);
            }
            candle.OutputFile = String.Concat(objDirectory, @"\");
            candle.SourceFiles.Add(source);
            candle.WorkingDirectory = TestDataDirectory;
            candle.Run();

            // Make sure the output directory is cleaned up.
            this.TestArtifacts.Add(new DirectoryInfo(objDirectory));

            // Link.
            Light light = new Light();
            light.Extensions.AddRange(DependencyExtensionTests.Extensions);
            light.ObjectFiles = candle.ExpectedOutputFiles;
            light.OutputFile = wixmsp;
            light.SuppressMSIAndMSMValidation = true;
            light.WorkingDirectory = TestDataDirectory;
            light.Run();

            // Make sure the output directory is cleaned up.
            this.TestArtifacts.Add(new DirectoryInfo(msiDirectory));

            // Torch.
            Torch torch = new Torch();
            torch.TargetInput = Path.ChangeExtension(targetPath, "wixpdb");
            torch.UpdatedInput = Path.ChangeExtension(upgradePath, "wixpdb");
            torch.PreserveUnmodified = true;
            torch.XmlInput = true;
            torch.OutputFile = wixmst;
            torch.WorkingDirectory = TestDataDirectory;
            torch.Run();

            // Pyro.
            Pyro pyro = new Pyro();
            pyro.Baselines.Add(torch.OutputFile, name);
            pyro.InputFile = light.OutputFile;
            pyro.OutputFile = package;
            pyro.WorkingDirectory = TestDataDirectory;
            pyro.SuppressWarnings.Add("1079");
            pyro.Run();

            return pyro.OutputFile;
        }
Exemple #4
0
        /// <summary>
        /// Builds a patch using given paths for the target and upgrade packages.
        /// </summary>
        /// <returns>The path to the patch.</returns>
        protected override PatchBuilder BuildItem()
        {
            // Create paths.
            string source        = String.IsNullOrEmpty(this.SourceFile) ? Path.Combine(this.TestDataDirectory, String.Concat(this.Name, ".wxs")) : this.SourceFile;
            string rootDirectory = FileUtilities.GetUniqueFileName();
            string objDirectory  = Path.Combine(rootDirectory, Settings.WixobjFolder);
            string msiDirectory  = Path.Combine(rootDirectory, Settings.MspFolder);
            string wixmsp        = Path.Combine(objDirectory, String.Concat(this.Name, ".wixmsp"));
            string package       = Path.Combine(msiDirectory, String.Concat(this.Name, ".msp"));

            // Add the root directory to be cleaned up.
            this.TestArtifacts.Add(new DirectoryInfo(rootDirectory));

            // Compile.
            Candle candle = new Candle();

            candle.Extensions.AddRange(this.Extensions);
            candle.OtherArguments = String.Concat("-dTestName=", this.TestName);
            this.PreprocessorVariables.ToList().ForEach(kv => candle.OtherArguments = String.Concat(candle.OtherArguments, " -d", kv.Key, "=", kv.Value));
            candle.OutputFile = String.Concat(objDirectory, @"\");
            candle.SourceFiles.Add(source);
            candle.WorkingDirectory = this.TestDataDirectory;
            candle.Run();

            // Make sure the output directory is cleaned up.
            this.TestArtifacts.Add(new DirectoryInfo(objDirectory));

            // Link.
            Light light = new Light();

            light.Extensions.AddRange(this.Extensions);
            light.OtherArguments = String.Concat("-b data=", Environment.ExpandEnvironmentVariables(@"%WIX_ROOT%\test\data\"));
            this.BindPaths.ToList().ForEach(kv => light.OtherArguments = String.Concat(light.OtherArguments, " -b ", kv.Key, "=", kv.Value));
            light.ObjectFiles = candle.ExpectedOutputFiles;
            light.OutputFile  = wixmsp;
            light.SuppressMSIAndMSMValidation = true;
            light.WorkingDirectory            = this.TestDataDirectory;
            light.Run();

            // Make sure the output directory is cleaned up.
            this.TestArtifacts.Add(new DirectoryInfo(msiDirectory));

            // Pyro.
            Pyro pyro = new Pyro();

            Assert.NotNull(this.TargetPaths);
            Assert.NotNull(this.UpgradePaths);
            Assert.Equal <int>(this.TargetPaths.Length, this.UpgradePaths.Length);

            for (int i = 0; i < this.TargetPaths.Length; ++i)
            {
                // Torch.
                Torch torch = new Torch();
                torch.TargetInput        = Path.ChangeExtension(this.TargetPaths[i], "wixpdb");
                torch.UpdatedInput       = Path.ChangeExtension(this.UpgradePaths[i], "wixpdb");
                torch.PreserveUnmodified = true;
                torch.XmlInput           = true;
                torch.OutputFile         = Path.Combine(objDirectory, String.Concat(Path.GetRandomFileName(), ".wixmst"));
                torch.WorkingDirectory   = this.TestDataDirectory;
                torch.Run();

                pyro.Baselines.Add(torch.OutputFile, this.Name);
            }

            pyro.InputFile        = light.OutputFile;
            pyro.OutputFile       = package;
            pyro.WorkingDirectory = this.TestDataDirectory;
            pyro.SuppressWarnings.Add("1079");
            pyro.Run();

            this.Output = pyro.OutputFile;
            return(this);
        }