Created
March 11, 2024 14:51
-
-
Save ViktorHofer/e4ba1766b7ee751261515781e7bb5927 to your computer and use it in GitHub Desktop.
Create runtime package readme TODO table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach (string libDirectory in Directory.GetDirectories(@"C:\git\runtime2\src\libraries\")) | |
{ | |
string libName = Path.GetFileName(libDirectory); | |
string srcLibDirectory = Path.Combine(libDirectory, "src"); | |
if (Directory.Exists(srcLibDirectory)) | |
{ | |
string packageReadmeFile = Path.Combine(srcLibDirectory, "PACKAGE.md"); | |
if (File.Exists(packageReadmeFile)) | |
{ | |
const string emptyPackageReadmeContent = """ | |
<!-- The key features of this package --> | |
* | |
* | |
* | |
"""; | |
if (File.ReadAllText(packageReadmeFile).Contains(emptyPackageReadmeContent)) | |
{ | |
Console.WriteLine(libName); | |
} | |
} | |
else | |
{ | |
const string IsPackableMetadata = "true</IsPackable>"; | |
string[] projectFiles = Directory.GetFiles(srcLibDirectory, "*.csproj", SearchOption.TopDirectoryOnly); | |
if (projectFiles.Length == 1 && File.ReadAllText(projectFiles[0]).Contains(IsPackableMetadata)) | |
{ | |
Console.WriteLine(libName); | |
} | |
else if (projectFiles.Length != 1) | |
{ | |
Console.WriteLine("Weird lib folder: " + libName); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment