Ejemplo n.º 1
0
        public virtual void RunBuild(FilePath solution)
        {
            if (CakeContext.IsRunningOnWindows() || AlwaysUseMSBuild)
            {
                CakeContext.MSBuild(solution, c =>
                {
                    if (CakeContext.GetOperatingSystem() == PlatformFamily.OSX)
                    {
                        c.ToolPath = "/Library/Frameworks/Mono.framework/Versions/Current/Commands/msbuild";
                    }

                    // Override tool path completely if it's specified explicitly
                    if (MSBuildToolPath != null)
                    {
                        c.ToolPath = MSBuildToolPath;
                    }

                    if (Verbosity.HasValue)
                    {
                        c.Verbosity = Verbosity.Value;
                    }

                    if (MaxCpuCount.HasValue)
                    {
                        c.MaxCpuCount = MaxCpuCount.Value;
                    }
                    c.Configuration = Configuration;
                    if (!string.IsNullOrEmpty(Platform))
                    {
                        c.Properties["Platform"] = new[] { Platform }
                    }
                    ;
                    if (Targets != null && Targets.Any())
                    {
                        foreach (var t in Targets)
                        {
                            c.Targets.Add(t);
                        }
                    }
                    if (Properties != null && Properties.Any())
                    {
                        foreach (var kvp in Properties)
                        {
                            c.Properties.Add(kvp.Key, kvp.Value);
                        }
                    }
                });
            }
            else
            {
                CakeContext.DotNetBuild(solution, c =>
                {
                    if (Verbosity.HasValue)
                    {
                        c.Verbosity = Verbosity.Value;
                    }

                    c.Configuration = Configuration;
                    if (!string.IsNullOrEmpty(Platform))
                    {
                        c.Properties["Platform"] = new[] { Platform }
                    }
                    ;
                    if (Targets != null && Targets.Any())
                    {
                        foreach (var t in Targets)
                        {
                            c.Targets.Add(t);
                        }
                    }
                    if (Properties != null && Properties.Any())
                    {
                        foreach (var kvp in Properties)
                        {
                            c.Properties.Add(kvp.Key, kvp.Value);
                        }
                    }
                });
            }
        }