Example #1
0
        public CreateBundlesWithRawFilesTests()
        {
            root = new TempDirectory();

            CreateDirectory("source");
            CreateDirectory("source\\bin");
            CreateDirectory("output");

            WriteFile("source\\test.css", @"p { background: url(test.png); } .other { background: url(notfound.png); }");
            WriteFile("source\\test.png", "image");

            var configurationDll = CompileConfigurationDll();

            File.Move(configurationDll, Path.Combine(root, "source", "bin", "test.dll"));
            File.Copy("Cassette.dll", Path.Combine(root, "source", "bin", "Cassette.dll"));
            File.Copy("Cassette.pdb", Path.Combine(root, "source", "bin", "Cassette.pdb"));
            File.Copy("AjaxMin.dll", Path.Combine(root, "source", "bin", "AjaxMin.dll"));

            var command = new CreateBundlesCommand(
                Path.Combine(root, "source"),
                Path.Combine(root, "source", "bin"),
                Path.Combine(root, "output"),
                true
                );

            CreateBundlesCommand.ExecuteInSeparateAppDomain(command);
        }
Example #2
0
        public override bool Execute()
        {
            AssignPropertyDefaultsIfMissing();
            MakePathsAbsolute();

            Log.LogMessage("Source directory = {0}", Source);
            Log.LogMessage("Bin directory = {0}", Bin);
            Log.LogMessage("Output directory = {0}", Output);
            Log.LogMessage("Include other files = {0}", IncludeOtherFiles);

            // Execution will load assemblies. When running this task from a Visual Studio build, the DLLs would then be locked.
            // So we must run the command in a separate AppDomain.
            // This means the assemblies can be unlocked by unloading the new AppDomain when finished.
            CreateBundlesCommand.ExecuteInSeparateAppDomain(new CreateBundlesCommand(Source, Bin, Output, IncludeOtherFiles, Log));

            return(true);
        }
        public CreateBundlesWithRawFilesTests()
        {
            root = new TempDirectory();

            CreateDirectory("source");
            CreateDirectory("source\\bin");
            CreateDirectory("output");

            WriteFile("source\\test.css", @"p { background: url(test.png); } .other { background: url(notfound.png); }");
            WriteFile("source\\test.png", "image");

            var configurationDll = CompileConfigurationDll();

            File.Move(configurationDll, PathUtilities.Combine(root, "source", "bin", "test.dll"));
            File.Copy("Cassette.dll", PathUtilities.Combine(root, "source", "bin", "Cassette.dll"));
            File.Copy("Cassette.pdb", PathUtilities.Combine(root, "source", "bin", "Cassette.pdb"));
            File.Copy("AjaxMin.dll", PathUtilities.Combine(root, "source", "bin", "AjaxMin.dll"));
#if NET35
            File.Copy("Iesi.Collections.dll", PathUtilities.Combine(root, "source", "bin", "Iesi.Collections.dll"));
#endif
            buildEngine = new BuildEngineStub();
            var task = new CreateBundles
            {
                BuildEngine = buildEngine
            };

            var taskLoggingHelper = new TaskLoggingHelper(task);

            var command = new CreateBundlesCommand(
                PathUtilities.Combine(root, "source"),
                PathUtilities.Combine(root, "source", "bin"),
                PathUtilities.Combine(root, "output"),
                "/",
                true,
                taskLoggingHelper
                );

            CreateBundlesCommand.ExecuteInSeparateAppDomain(command);
        }