Exemple #1
0
        public static void TargetPrepareBuildDir(ITaskContext context)
        {
            string buildDir = context.Properties.Get <string>(BuildProps.BuildDir);
            CreateDirectoryTask createDirectoryTask = new CreateDirectoryTask(buildDir, true);

            createDirectoryTask.Execute(context);
        }
Exemple #2
0
        private static void TargetIlMerge(ITaskContext context)
        {
            CreateDirectoryTask.Execute(context, "./output", false);

            string projectTargetDir = Path.Combine("Flubu.Console", "bin", context.Properties[BuildProps.BuildConfiguration]);

            IRunProgramTask progTask = new RunProgramTask(@"lib\IlMerge\IlMerge.exe")
                                       .SetWorkingDir(projectTargetDir);

            progTask
            .EncloseParametersInQuotes(false)
            .ExecutionTimeout(TimeSpan.FromSeconds(30))
            .AddArgument("/t:exe")
            .AddArgument("/xmldocs")
            .AddArgument("/v4")
            .AddArgument("/out:..\\..\\..\\output\\Build.exe")
            .AddArgument("flubu.console.exe")
            .AddArgument("CommandLine.dll")
            .AddArgument("CSScriptLibrary.dll")
            .AddArgument("Flubu.dll")
            .AddArgument("Flubu.Contrib.dll")
            .AddArgument("ICSharpCode.SharpZipLib.dll")
            .AddArgument("Microsoft.Web.Administration.dll")
            .AddArgument("Mono.CSharp.dll")
            .Execute(context);
        }
Exemple #3
0
        private static void TargetIlMerge(ITaskContext context)
        {
            CreateDirectoryTask.Execute(context, "./output", false);

            string projectTargetDir = Path.Combine(
                "Flubu.Console", "bin", context.Properties[BuildProps.BuildConfiguration]);

            IRunProgramTask progTask =
                new RunProgramTask(@"packages\ILRepack.2.0.16\tools\ILRepack.exe")
                .SetWorkingDir(projectTargetDir);

            progTask
            .EncloseParametersInQuotes(false)
            .ExecutionTimeout(TimeSpan.FromSeconds(30))
            .AddArgument("/target:exe")
            .AddArgument("/xmldocs")
            //.AddArgument("/v4.6")
            //.AddArgument(@"/targetplatform:v4.6,""C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6""")
            //.AddArgument(@"/targetplatform:v4,""C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0""")
            //.AddArgument(@"/lib:""C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0""")
            .AddArgument("/out:..\\..\\..\\output\\Build.exe")
            .AddArgument("flubu.console.exe")
            //.AddArgument("CommandLine.dll")
            .AddArgument("CSScriptLibrary.dll")
            .AddArgument("Flubu.dll")
            .AddArgument("Flubu.Contrib.dll")
            .AddArgument("ICSharpCode.SharpZipLib.dll")
            .AddArgument("Microsoft.Web.Administration.dll")
            .AddArgument("Mono.CSharp.dll")
            .Execute(context);
        }
Exemple #4
0
        public void ZipFiles(
            FileFullPath zipFileName,
            FullPath baseDir,
            int?compressionLevel,
            IEnumerable <FileFullPath> filesToZip)
        {
            taskContext.WriteInfo("Zipping {0}", zipFileName);

            CreateDirectoryTask createDirectoryTask = new CreateDirectoryTask(
                zipFileName.Directory.ToString(),
                false);

            createDirectoryTask.Execute(taskContext);

            using (FileStream zipFileStream = new FileStream(
                       zipFileName.ToString(),
                       FileMode.Create,
                       FileAccess.ReadWrite,
                       FileShare.None))
            {
                using (ZipOutputStream zipStream = new ZipOutputStream(zipFileStream))
                {
                    if (compressionLevel.HasValue)
                    {
                        zipStream.SetLevel(compressionLevel.Value);
                    }

                    buffer = new byte[1024 * 1024];

                    foreach (FileFullPath fileName in filesToZip)
                    {
                        LocalPath debasedFileName = fileName.ToFullPath().DebasePath(baseDir);
                        string    cleanName       = ZipEntry.CleanName(debasedFileName.ToString());

                        //environment.LogMessage("Zipping file '{0}'", basedFileName);
                        AddFileToZip(fileName, cleanName, zipStream);
                    }
                }
            }
        }