blob: 72667c0324bda7141d510022212c68686255e3e0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
##############################################################################
##
## compare-config-files
##
##############################################################################
<#
.SYNOPSIS
Compares mono build configuration files detecting incompatible changes.
#>
param(
## winconfig header file.
$mono_winconfig,
## config header file.
$mono_config,
## The master configuration file, optional.
$mono_config_ac
)
## Get the content from each config file
$mono_winconfig_content = Get-Content $mono_winconfig
$mono_config_content = Get-Content $mono_config
## Compare config files.
$comparedLines = Compare-Object $mono_winconfig_content $mono_config_content -IncludeEqual | Sort-Object { $_.InputObject.ReadCount }
$comparedLines | foreach {
if($_.SideIndicator -ne "==")
{
##Look for diffs.
$mono_version = (Select-String -InputObject $_.InputObject -pattern '#define VERSION \"(.*)\"')
$mono_corlib_version = (Select-String -InputObject $_.InputObject -pattern '#define MONO_CORLIB_VERSION')
if ($mono_version -eq $null -And $mono_corlib_version -eq $null) {
Write-Host "Changes detected, versions doesn't match. Configuration must to be replaced."
exit 1;
}
}
}
if ($mono_config_ac -ne $null -And $mono_config_ac -ne "") {
$mono_version_ac = (Select-String -path $mono_config_ac -pattern 'AC_INIT\(mono, \[(.*)\]').Matches[0].Groups[1].Value
$mono_version = (Select-String -path $mono_config -pattern '#define VERSION \"(.*)\"').Matches[0].Groups[1].Value
if($mono_version_ac -ne $mono_version)
{
Write-Host "Changes detected, versions doesn't match. Configuration must to be replaced."
exit 1;
}
}
exit 0;
|