Beispiel #1
0
        public static bool IsNugetArtifact(this Project project)
        {
            // only true if explicitly defined inside project file
            var prop = project.GetMSBuildProject().GetProperty("PackageId");

            return(prop.UnevaluatedValue != "$(AssemblyName)" || prop.Xml.ContainingProject.FullPath == project.Path);
        }
Beispiel #2
0
 public static bool IsBuildProject(this Project project) => project.Name is "_build" or "_buildGenerator";
Beispiel #3
0
 public static bool IsPublishArtifact(this Project project) =>
 project.GetProperty <bool?>(nameof(IsPublishArtifact)) ??
 project.GetOutputType().Equals("exe", StringComparison.InvariantCultureIgnoreCase);
Beispiel #4
0
    /// <summary>
    /// Publishes projects that are deployed to a provided folder location.
    /// </summary>
    /// <returns></returns>
    public bool PublishCopiedFolders()
    {
        foreach (NukeConf.Project project in CustomNukeSolutionConfig.Projects)
        {
            // Calculate the name of the Version folder
            string versionFolder = "";
            if (project.Deploy != CustomNukeDeployMethod.Copy)
            {
                continue;
            }

            if (CustomNukeSolutionConfig.DeployToVersionedFolder)
            {
                if (CustomNukeSolutionConfig.DeployFolderUsesSemVer)
                {
                    versionFolder = "Ver" + _gitProcessor.SemVersionNugetCompatible;
                }
                else
                {
                    versionFolder = "Ver" + _gitProcessor.Version;
                }
            }

            // Calculate App Name Path
            string appPath = project.Name;
            if (CustomNukeSolutionConfig.DeployToAssemblyFolders)
            {
                Project nukeProject = GetSolutionProject(project);
                ControlFlow.Assert(nukeProject != null, "Unable to find the Nuke Project for: " + project.Name);

                // Load the project file to get the Assembly name.  If not found, then its the projectName
                XDocument doc     = XDocument.Load(nukeProject.Path);
                XElement  element = doc.XPathSelectElement("//PropertyGroup/AssemblyName");
                if (element != null)
                {
                    if (!String.IsNullOrEmpty(element.Value))
                    {
                        if (!element.Value.Contains('.'))
                        {
                            appPath = element.Value;
                        }
                        else
                        {
                            string [] appParts = element.Value.Split('.', StringSplitOptions.RemoveEmptyEntries);
                            appPath = string.Join(Path.DirectorySeparatorChar, appParts);
                            appPath = appPath + Path.DirectorySeparatorChar + element.Value;
                        }
                    }
                }
            }

            // Destination
            AbsolutePath root;
            if (Configuration == "Release")
            {
                root = (AbsolutePath)CustomNukeSolutionConfig.DeployProdRoot;
            }
            else
            {
                root = (AbsolutePath)CustomNukeSolutionConfig.DeployTestRoot;
            }

            // Build Full Path
            AbsolutePath deploy = (AbsolutePath)root / appPath / versionFolder;

            // Source
            AbsolutePath src = (AbsolutePath)SourceDirectory / project.Name / "bin" / Configuration / project.Framework;

            Utility.CopyEntireDirectory(src, deploy);

            PublishResults.Add(new PublishResult(project.Name, project.Deploy.ToString(), deploy));
            Logger.Success("Project:  {0}  Deployed to Copy Folder:  {1}", project.Name, deploy);
        }
        return(true);
    }