Another bump for packaging changes
[mono-project.git] / msvc / compare-config-files.ps1
blob9122f1e8fc8dc7b3f892c9c95137cd1e33283453
1 ##############################################################################
2 ##
3 ## compare-config-files
4 ##
5 ##############################################################################
7 <#
9 .SYNOPSIS
11 Compares mono build configuration files detecting incompatible changes.
15 param(
16 ## winconfig header file.
17 $mono_winconfig,
19 ## config header file.
20 $mono_config,
22 ## The master configuration file, optional.
23 $mono_config_ac
26 ## Get the content from each config file
27 $mono_winconfig_content = Get-Content $mono_winconfig
28 $mono_config_content = Get-Content $mono_config
30 ## Compare config files.
31 $comparedLines = Compare-Object $mono_winconfig_content $mono_config_content -IncludeEqual | Sort-Object { $_.InputObject.ReadCount }
33 $comparedLines | foreach {
35 if($_.SideIndicator -ne "==")
37 ##Look for diffs.
38 $mono_version = (Select-String -InputObject $_.InputObject -pattern '#define VERSION \"(.*)\"')
39 if ($mono_version -eq $null) {
40 Write-Host "Changes detected, versions doesn't match. Configuration must to be replaced."
41 exit 1;
46 if ($mono_config_ac -ne $null -And $mono_config_ac -ne "") {
48 $mono_version_ac = (Select-String -path $mono_config_ac -pattern 'AC_INIT\(mono, \[(.*)\]').Matches[0].Groups[1].Value
49 $mono_version = (Select-String -path $mono_config -pattern '#define VERSION \"(.*)\"').Matches[0].Groups[1].Value
51 if($mono_version_ac -ne $mono_version)
53 Write-Host "Changes detected, versions doesn't match. Configuration must to be replaced."
54 exit 1;
58 exit 0;