Exemplo n.º 1
0
        public ProjectOutput([NotNull] Project project, [NotNull] string relativeFileName, BuildFileGroups buildFileGroup, [NotNull] string binaryTargetDirectory)
        {
            Project = project;

            var prefix = binaryTargetDirectory + @"\";

            if ((buildFileGroup != BuildFileGroups.ContentFiles) && relativeFileName.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
            {
                SourceName = relativeFileName.Substring(prefix.Length);
            }
            else
            {
                SourceName = relativeFileName;
            }

            BuildFileGroup = buildFileGroup;

            TargetName = (BuildFileGroup == BuildFileGroups.ContentFiles) ? SourceName : Path.Combine(binaryTargetDirectory, SourceName);
        }
Exemplo n.º 2
0
        private IReadOnlyCollection <ProjectOutput> GetBuildFiles(Project rootProject, BuildFileGroups groups, string binaryTargetDirectory)
        {
            var groupNames = Enum.GetValues(typeof(BuildFileGroups)).OfType <BuildFileGroups>().Where(item => (groups & item) != 0);

            var outputGroups = _project.ConfigurationManager?.ActiveConfiguration?.OutputGroups;

            var selectedOutputGroups = groupNames
                                       .Select(groupName => outputGroups?.Item(groupName.ToString()))
                                       .ExceptNullItems();

            var buildFiles = selectedOutputGroups.SelectMany(item => GetProjectOutputForGroup(rootProject, item, binaryTargetDirectory));

            return(buildFiles.ToList().AsReadOnly());
        }
Exemplo n.º 3
0
        private IReadOnlyCollection <ProjectOutput> GetBuildFiles([NotNull] Project rootProject, BuildFileGroups groups, [NotNull] string binaryTargetDirectory)
        {
            Contract.Requires(rootProject != null);
            Contract.Requires(binaryTargetDirectory != null);
            Contract.Ensures(Contract.Result <IEnumerable <ProjectOutput> >() != null);

            var groupNames = Enum.GetValues(typeof(BuildFileGroups)).OfType <BuildFileGroups>().Where(item => (groups & item) != 0);

            var outputGroups = _project.ConfigurationManager?.ActiveConfiguration?.OutputGroups;

            var selectedOutputGroups = groupNames
                                       .Select(groupName => outputGroups?.Item(groupName.ToString()))
                                       .Where(item => item != null);

            var buildFiles = selectedOutputGroups.SelectMany(item => GetProjectOutputForGroup(rootProject, item, binaryTargetDirectory));

            return(buildFiles.ToArray());
        }