Skip to content

Commit

Permalink
Remove the logic to update psd1 in artifacts. (Azure#15057)
Browse files Browse the repository at this point in the history
Co-authored-by: wyunchi-ms <[email protected]>
  • Loading branch information
wyunchi-ms and wyunchi-ms authored May 20, 2021
1 parent b3c51e3 commit 5f200b2
Showing 1 changed file with 0 additions and 47 deletions.
47 changes: 0 additions & 47 deletions tools/VersionController/Models/VersionBumper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public void BumpAllVersions()
UpdateOutputModuleManifest(releaseNotes);
UpdateRollupModuleManifest();
UpdateAssemblyInfo();
UpdateDependentModules();
Console.WriteLine("Finished bumping version " + moduleName + "\n");
}

Expand Down Expand Up @@ -405,52 +404,6 @@ private void UpdateChangeLog()
File.WriteAllLines(changeLogPath, newFile);
}

/// <summary>
/// Update the ModuleVersion of the bumped module in any dependent module's RequiredModule field.
/// </summary>
private void UpdateDependentModules()
{
var moduleName = _fileHelper.ModuleName;
var projectDirectories = _fileHelper.ProjectDirectories;
var outputDirectories = _fileHelper.OutputDirectories;
foreach (var projectDirectory in projectDirectories)
{
var moduleManifestPaths = Directory.GetFiles(projectDirectory, "*.psd1", SearchOption.AllDirectories)
.Where(f => !f.Contains("Netcore") &&
!f.Contains("bin") &&
!f.Contains("dll-Help") &&
!ModuleFilter.IsAzureStackModule(f))
.ToList();
foreach (var moduleManifestPath in moduleManifestPaths)
{
var file = File.ReadAllLines(moduleManifestPath);
var pattern = @"ModuleName(\s*)=(\s*)(['\""])" + moduleName + @"(['\""])(\s*);(\s*)ModuleVersion(\s*)=(\s*)(['\""])" + _oldVersion + @"(['\""])";
if (file.Where(l => Regex.IsMatch(l, pattern)).Any())
{
var updatedFile = file.Select(l => Regex.Replace(l, pattern, "ModuleName = '" + moduleName + "'; ModuleVersion = '" + _newVersion + "'"));
File.WriteAllLines(moduleManifestPath, updatedFile);
var updatedModuleName = Path.GetFileNameWithoutExtension(moduleManifestPath);
foreach (var outputDirectory in outputDirectories)
{
var outputModuleDirectory = Directory.GetDirectories(outputDirectory, updatedModuleName).FirstOrDefault();
if (outputModuleDirectory == null)
{
continue;
}

var outputModuleManifestPath = Directory.GetFiles(outputModuleDirectory, updatedModuleName + ".psd1").FirstOrDefault();
if (outputModuleManifestPath == null)
{
continue;
}

File.WriteAllLines(outputModuleManifestPath, updatedFile);
}
}
}
}
}

/// <summary>
/// Check whether or not the given module is new by searching for past entries in the change log.
/// </summary>
Expand Down

0 comments on commit 5f200b2

Please sign in to comment.