Skip to content

Commit

Permalink
Couple of minor fixes (#9134)
Browse files Browse the repository at this point in the history
* Couple of minor fixes

* add fail case
  • Loading branch information
JimSuplizio committed Mar 17, 2020
1 parent 06da9fe commit 36231cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 5 additions & 4 deletions eng/versioning/pom_file_version_scanner.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ function Build-Dependency-Hash-From-File {
[Dependency]$dep = [Dependency]::new($line)
if ($depHash.ContainsKey($dep.id))
{
Write-Error "Error: Duplicate dependency encountered. '$($dep.id)' defined in '$($depFile)' already exists in the dependency list which means it is defined in multiple version_*.txt files."
Write-Error-With-Color "Error: Duplicate dependency encountered. '$($dep.id)' defined in '$($depFile)' already exists in the dependency list which means it is defined in multiple version_*.txt files."
$script:FoundError = $true
continue
}
$depHash.Add($dep.id, $dep)
}
catch {
Write-Error "Invalid dependency line='$($line) in file=$($depFile)"
Write-Error-With-Color "Invalid dependency line='$($line) in file=$($depFile)"
}
}
else
Expand All @@ -127,14 +127,14 @@ function Build-Dependency-Hash-From-File {
[ExternalDependency]$dep = [ExternalDependency]::new($line)
if ($depHash.ContainsKey($dep.id))
{
Write-Error "Error: Duplicate external_dependency encountered. '$($dep.id)' has a duplicate entry defined in '$($depFile)'. Please ensure that all entries are unique."
Write-Error-With-Color "Error: Duplicate external_dependency encountered. '$($dep.id)' has a duplicate entry defined in '$($depFile)'. Please ensure that all entries are unique."
$script:FoundError = $true
continue
}
$depHash.Add($dep.id, $dep)
}
catch {
Write-Error "Invalid external dependency line='$($line) in file=$($depFile)"
Write-Error-With-Color "Invalid external dependency line='$($line) in file=$($depFile)"
}
}
}
Expand Down Expand Up @@ -261,6 +261,7 @@ Get-ChildItem -Path $Path -Filter pom*.xml -Recurse -File | ForEach-Object {
Write-Host "processing pomFile=$($pomFile)"
if ($xmlPomFile.project.dependencyManagement)
{
$script:FoundError = $true
Write-Error-With-Color "Error: <dependencyManagement> is not allowed. Every dependency must have its own version and version update tag"
}

Expand Down
2 changes: 2 additions & 0 deletions eng/versioning/update_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ def load_version_map_from_file(the_file, version_map):
if not stripped_line or stripped_line.startswith('#'):
continue
module = CodeModule(stripped_line)
if (module.name in version_map):
raise ValueError('Version file: {0} contains a duplicate entry: {1}'.format(the_file, module.name))
version_map[module.name] = module

def display_version_info(version_map):
Expand Down

0 comments on commit 36231cf

Please sign in to comment.