Beispiel #1
0
 /// <summary>
 /// Adds multiple input or output handlers to the build pipeline
 /// </summary>
 /// <param name="manager">The manager</param>
 /// <param name="handlers">A collection of <see cref="IHandler"/>-based handlers to use</param>
 /// <returns>The updated manager</returns>
 /// <remarks>If a given object implements both <see cref="IInputHandler"/> and <see cref="IOutputHandler"/> it will be added to both stages of the build pipeline</remarks>
 public static ClickTwiceManager WithHandlers(this ClickTwiceManager manager, IEnumerable <IHandler> handlers)
 {
     foreach (var handler in handlers)
     {
         manager.WithHandler(handler);
     }
     return(manager);
 }
Beispiel #2
0
        /// <summary>
        /// Adds an input or output handler to the build pipeline
        /// </summary>
        /// <param name="manager">The manager</param>
        /// <param name="handler">The handler (<see cref="IInputHandler"/> or <see cref="IOutputHandler"/>) to use</param>
        /// <returns>The updated manager</returns>
        /// <remarks>If a given object implements both <see cref="IInputHandler"/> and <see cref="IOutputHandler"/> it will be added to both stages of the build pipeline</remarks>
        public static ClickTwiceManager WithHandler(this ClickTwiceManager manager, IHandler handler)
        {
            var output = handler as IOutputHandler;
            var input  = handler as IInputHandler;

            if (output != null)
            {
                manager.OutputHandlers.Add(output);
            }
            if (input != null)
            {
                manager.InputHandlers.Add(input);
            }
            return(manager);
        }
Beispiel #3
0
 public CakePublishManager(ClickTwiceManager mgr) : base(mgr.ProjectFilePath)
 {
     Environment             = mgr.Environment;
     FileSystem              = mgr.FileSystem;
     Runner                  = mgr.ProcessRunner;
     ToolLocator             = mgr.ToolLocator;
     BuildAction             = mgr.BuildAction ?? DefaultBuildAction;
     CleanOutputOnCompletion = mgr.CleanOutput;
     Configuration           = mgr.Configuration;
     Platform                = mgr.Platform;
     InputHandlers           = mgr.InputHandlers;
     OutputHandlers          = mgr.OutputHandlers;
     Loggers.AddRange(mgr.Loggers);
     ErrorAction = mgr.ErrorAction;
     if (!string.IsNullOrWhiteSpace(mgr.PublishVersion))
     {
         AdditionalProperties.Add("ApplicationVersion", mgr.PublishVersion);
     }
 }
Beispiel #4
0
 /// <summary>
 /// Enables cleaning the output directory after a complete build
 /// </summary>
 /// <param name="manager">The manager</param>
 /// <returns>The updated manager</returns>
 public static ClickTwiceManager CleanAfterBuild(this ClickTwiceManager manager)
 {
     manager.CleanOutput = true;
     return(manager);
 }
Beispiel #5
0
 /// <summary>
 /// Adds a new <see cref="IPublishLogger"/> to the Loggers collection
 /// </summary>
 /// <param name="manager">The manager</param>
 /// <param name="logger">A <see cref="IPublishLogger"/> to log messages to</param>
 /// <returns>The updated manager</returns>
 public static ClickTwiceManager LogTo(this ClickTwiceManager manager, IPublishLogger logger)
 {
     manager.Loggers.Add(logger);
     return(manager);
 }
Beispiel #6
0
 /// <summary>
 /// Sets the build configuration to use when invoking MSBuild
 /// </summary>
 /// <param name="manager">The manager</param>
 /// <param name="configuration">The configuration to build for</param>
 /// <returns>The updated manager</returns>
 public static ClickTwiceManager SetConfiguration(this ClickTwiceManager manager, string configuration)
 {
     manager.Configuration = configuration;
     return(manager);
 }
Beispiel #7
0
 /// <summary>
 /// Sets the build platform to use when invoking MSBuild
 /// </summary>
 /// <param name="manager">The manager</param>
 /// <param name="platform">The <see cref="MSBuildPlatform"/> platform to build for</param>
 /// <returns>The updated manager</returns>
 public static ClickTwiceManager SetBuildPlatform(this ClickTwiceManager manager, MSBuildPlatform platform)
 {
     manager.Platform = platform == MSBuildPlatform.Automatic ? "AnyCPU" : platform.ToString();
     return(manager);
 }
Beispiel #8
0
 /// <summary>
 /// Manually sets the publish version to the provided value
 /// </summary>
 /// <param name="manager">The manager</param>
 /// <param name="s">The version string to use</param>
 /// <returns></returns>
 public static ClickTwiceManager WithVersion(this ClickTwiceManager manager, string s)
 {
     manager.PublishVersion = s;
     return(manager);
 }
Beispiel #9
0
 /// <summary>
 /// Enables forcing a rebuild of the application, even if a build is up-to-date
 /// </summary>
 /// <param name="manager">The manager</param>
 /// <returns>The updated manager</returns>
 public static ClickTwiceManager ForceRebuild(this ClickTwiceManager manager)
 {
     manager.ForceBuild = true;
     return(manager);
 }
Beispiel #10
0
 /// <summary>
 /// Enables aborting the build if an input handlers fails with an error
 /// </summary>
 /// <param name="manager">The manager</param>
 /// <returns>The updated manager</returns>
 /// <remarks>Handlers returning <see cref="HandlerResult.NotRun"/> will be ignored.</remarks>
 public static ClickTwiceManager ThrowOnHandlerFailure(this ClickTwiceManager manager)
 {
     manager.ErrorAction =
         resp => { throw new PublishException(resp.Where(r => r.Result == HandlerResult.Error)); };
     return(manager);
 }