Example #1
0
        private void ChangeGeneratedFiles()
        {
            var msbuildData = _repoData.RepoConfig.MSBuildGenerateData;

            if (msbuildData.HasValue)
            {
                var fileName = new FileName(_generateDirectory, msbuildData.Value.RelativeFilePath);
                var packages = GenerateUtil.GetFilteredPackages(msbuildData.Value, _repoData);
                GenerateUtil.WriteMSBuildContent(fileName, packages);
            }
        }
Example #2
0
        private void ChangeGeneratedFiles(IEnumerable <NuGetPackage> floatingPackages)
        {
            var msbuildData = _repoData.RepoConfig.MSBuildGenerateData;

            if (msbuildData.HasValue)
            {
                var fileName = new FileName(_repoData.SourcesPath, msbuildData.Value.RelativeFileName);
                var packages = GenerateUtil.GetFilteredPackages(msbuildData.Value, _repoData);
                GenerateUtil.WriteMSBuildContent(fileName, packages);
            }
        }
Example #3
0
        private bool VerifyGeneratedFiles(TextWriter writer, RepoData repoData)
        {
            var allGood = true;

            writer.WriteLine($"Verifying generated files");
            if (_repoConfig.MSBuildGenerateData.HasValue)
            {
                var data     = _repoConfig.MSBuildGenerateData.Value;
                var packages = GenerateUtil.GetFilteredPackages(data, repoData);

                // Need to verify the contents of the generated file are correct.
                var fileName        = new FileName(_sourcesPath, data.RelativeFileName);
                var actualContent   = File.ReadAllText(fileName.FullPath, GenerateUtil.Encoding);
                var expectedContent = GenerateUtil.GenerateMSBuildContent(packages);
                if (actualContent != expectedContent)
                {
                    writer.WriteLine($"{fileName.RelativePath} does not have the expected contents");
                    allGood = false;
                }

                if (!allGood)
                {
                    writer.WriteLine($@"Generated contents out of date. Run ""RepoUtil.change"" to correct");
                    return(false);
                }

                // Verify none of the regex entries are stale.
                var staleRegexList = GenerateUtil.GetStaleRegex(data, repoData);
                foreach (var regex in staleRegexList)
                {
                    writer.WriteLine($"Regex {regex} matches no packages");
                    allGood = false;
                }
            }

            return(allGood);
        }