forked from hazelcast/hazelcast-csharp-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
118 lines (102 loc) · 5.3 KB
/
build.ps1
File metadata and controls
118 lines (102 loc) · 5.3 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
param(
[switch]$enterprise = $false,
[switch]$netcore = $false,
[string]$serverVersion = $(throw "-serverVersion is required."),
[switch]$coverage = $false
)
$hazelcastTestVersion=$serverVersion
$hazelcastVersion=$serverVersion
$hazelcastEnterpriseVersion=$serverVersion
$hazelcastEnterpriseTestVersion=$serverVersion
$hazelcastRCVersion="0.5-SNAPSHOT"
$snapshotRepo="https://oss.sonatype.org/content/repositories/snapshots"
$releaseRepo="http://repo1.maven.apache.org/maven2"
$enterpriseReleaseRepo="https://repository.hazelcast.com/release/"
$enterpriseSnapshotRepo="https://repository.hazelcast.com/snapshot/"
if ($serverVersion.Contains("SNAPSHOT")) {
$repo=$snapshotRepo
$enterpriseRepo=$enterpriseSnapshotRepo
} else {
$repo=$releaseRepo
$enterpriseRepo=$enterpriseReleaseRepo
}
if(!($enterprise)) {
$testCategory +="cat != enterprise"
}
Write-Host "PARAMETERS:"
Write-Host "Server version : $serverVersion"
Write-Host "Code coverage enabled : $coverage"
Write-Host "Enterprise server :$enterprise"
Write-Host "Exclude param: $testCategory"
Write-Host "Net core: $netcore"
Write-Host "Starting build..."
# remove all the bins and objs recursively
Get-ChildItem .\ -include bin,obj -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }
nuget restore
if ($netcore) {
$targetFramework="netcoreapp2.0"
}
else
{
$targetFramework="net45"
}
msbuild Hazelcast.Test\Hazelcast.Test.csproj /p:Configuration=Release /p:TargetFramework=$targetFramework /target:"Restore;Build"
if(Test-Path "hazelcast-remote-controller-${hazelcastRCVersion}.jar") {
Write-Host "remote controller already exist, not downloading from maven."
} else {
Write-Host "Downloading hazelcast-remote-controller-${hazelcastRCVersion}.jar ..."
& "mvn" -q "dependency:get" "-DrepoUrl=${snapshotRepo}" "-Dartifact=com.hazelcast:hazelcast-remote-controller:${hazelcastRCVersion}" "-Ddest=hazelcast-remote-controller-${hazelcastRCVersion}.jar"
}
if(Test-Path "hazelcast-${hazelcastTestVersion}-tests.jar") {
Write-Host "hazelcast-${hazelcastTestVersion}-tests.jar already exist, not downloading from maven."
} else {
Write-Host "Downloading hazelcast-${hazelcastTestVersion}-tests.jar ..."
& "mvn" -q "dependency:get" "-DrepoUrl=${repo}" "-Dartifact=com.hazelcast:hazelcast:${hazelcastTestVersion}:jar:tests" "-Ddest=hazelcast-${hazelcastTestVersion}-tests.jar"
}
[string]$classpath="hazelcast-remote-controller-${hazelcastRCVersion}.jar;hazelcast-${hazelcastTestVersion}-tests.jar;"
if($enterprise){
if(Test-Path "hazelcast-enterprise-${hazelcastEnterpriseVersion}.jar") {
Write-Host "hazelcast-enterprise-${hazelcastEnterpriseVersion}.jar already exist, not downloading from maven."
} else {
Write-Host "Downloading hazelcast-enterprise-${hazelcastEnterpriseVersion}.jar ..."
& "mvn" -q "dependency:get" "-DrepoUrl=${enterpriseRepo}" "-Dartifact=com.hazelcast:hazelcast-enterprise:${hazelcastEnterpriseVersion}" "-Ddest=hazelcast-enterprise-${hazelcastEnterpriseVersion}.jar"
}
if(Test-Path "hazelcast-enterprise-${hazelcastEnterpriseTestVersion}-tests.jar") {
Write-Host "hazelcast-enterprise-${hazelcastEnterpriseTestVersion}-tests.jar already exist, not downloading from maven."
} else {
Write-Host "Downloading hazelcast-enterprise-${hazelcastEnterpriseTestVersion}-tests.jar ..."
& "mvn" -q "dependency:get" "-DrepoUrl=${enterpriseRepo}" "-Dartifact=com.hazelcast:hazelcast-enterprise:${hazelcastEnterpriseTestVersion}:jar:tests" "-Ddest=hazelcast-enterprise-${hazelcastEnterpriseTestVersion}-tests.jar"
}
$classpath += "hazelcast-enterprise-${hazelcastEnterpriseVersion}.jar;hazelcast-enterprise-${hazelcastEnterpriseTestVersion}-tests.jar"
} else{
if(Test-Path "hazelcast-${hazelcastVersion}.jar") {
Write-Host "hazelcast-${hazelcastVersion}.jar already exist, not downloading from maven."
} else {
Write-Host "Downloading hazelcast-${hazelcastVersion}.jar ..."
& "mvn" -q "dependency:get" "-DrepoUrl=${repo}" "-Dartifact=com.hazelcast:hazelcast:${hazelcastVersion}" "-Ddest=hazelcast-${hazelcastVersion}.jar"
}
$classpath += "hazelcast-${hazelcastVersion}.jar"
}
$remoteControllerApp = Start-Process -FilePath java -ArgumentList ( "-Dhazelcast.enterprise.license.key=$env:HAZELCAST_ENTERPRISE_KEY","-cp", "$classpath", "com.hazelcast.remotecontroller.Main" ) -RedirectStandardOutput "rc_stdout.log" -RedirectStandardError "rc_stderr.log" -PassThru
$testDLL=".\Hazelcast.Test\bin\Release\${targetFramework}\Hazelcast.Test.dll"
$nunitConsolePath=".\packages\NUnit.ConsoleRunner.3.10.0\tools\nunit3-console.exe"
$nunitArgs=@("`"${testDLL}`"", "--labels=All", "--result=console-text.xml;format=nunit2")
if($testCategory.Length -gt 0) {
$nunitArgs += @("--where", "\`"${testCategory}\`"")
}
if (!$netcore) {
$nunitArgs += "--framework=v4.0"
if($coverage) {
$dotCoverCmd=".\packages\JetBrains.dotCover.CommandLineTools.2019.1.2\tools\dotCover.exe"
$dotCoverArgs=@("cover", "/Filters=-:Hazelcast.Test", "/TargetWorkingDir=.", "/Output=Coverage\index.html", "/ReportType=HTML", "/TargetExecutable=${nunitConsolePath}", "/TargetArguments=${nunitArgs}")
Write-Host "$dotCoverCmd" $dotCoverArgs
& "$dotCoverCmd" $dotCoverArgs
} else {
& $nunitConsolePath $nunitArgs
}
}
else
{
dotnet test Hazelcast.Test\Hazelcast.Test.csproj -c Release --no-build --no-restore -f netcoreapp2.0 -v n
}
Stop-Process -Force -Id $remoteControllerApp.Id