You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/09/20 12:48:27 UTC
[29/33] ignite git commit: IGNITE-6209 .NET: Improve build script for
release builds on TC
IGNITE-6209 .NET: Improve build script for release builds on TC
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/06d29782
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/06d29782
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/06d29782
Branch: refs/heads/ignite-3478
Commit: 06d297823a3c229f570a3132f1bb222c0349db90
Parents: d1f178f
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Sep 20 13:37:29 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Sep 20 13:37:29 2017 +0300
----------------------------------------------------------------------
modules/platforms/dotnet/build.ps1 | 122 ++++++++++++++++++++++----------
1 file changed, 83 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/06d29782/modules/platforms/dotnet/build.ps1
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/build.ps1 b/modules/platforms/dotnet/build.ps1
index d9757ed..c037574 100644
--- a/modules/platforms/dotnet/build.ps1
+++ b/modules/platforms/dotnet/build.ps1
@@ -33,6 +33,9 @@ Requirements:
.PARAMETER skipJava
Skip Java build.
+.PARAMETER skipDotNet
+Skip .NET build.
+
.PARAMETER skipNuGet
Skip NuGet packaging.
@@ -51,6 +54,15 @@ Build configuration ("Release", "Debug").
.PARAMETER mavenOpts
Custom Maven options, default is "-U -P-lgpl,-scala,-examples,-test,-benchmarks -Dmaven.javadoc.skip=true".
+.PARAMETER jarDirs
+Java jar files source folders, default is "modules\indexing\target,modules\core\target,modules\spring\target"
+
+.PARAMETER asmDirs
+.NET assembly directories to copy pre-build binaries from. Default is "", which means no copy.
+
+.PARAMETER nugetPath
+Path to nuget.exe.
+
.EXAMPLE
.\build.ps1 -clean
# Full rebuild of Java, .NET and NuGet packages.
@@ -63,6 +75,7 @@ Custom Maven options, default is "-U -P-lgpl,-scala,-examples,-test,-benchmarks
param (
[switch]$skipJava,
+ [switch]$skipDotNet,
[switch]$skipNuGet,
[switch]$skipCodeAnalysis,
[switch]$clean,
@@ -70,15 +83,22 @@ param (
[string]$platform="Any CPU",
[ValidateSet("Release", "Debug")]
[string]$configuration="Release",
- [string]$mavenOpts="-U -P-lgpl,-scala,-examples,-test,-benchmarks -Dmaven.javadoc.skip=true"
+ [string]$mavenOpts="-U -P-lgpl,-scala,-examples,-test,-benchmarks -Dmaven.javadoc.skip=true",
+ [string]$jarDirs="modules\indexing\target,modules\core\target,modules\spring\target",
+ [string]$asmDirs="",
+ [string]$nugetPath=""
)
# 1) Build Java (Maven)
# Detect Ignite root directory
cd $PSScriptRoot\..
-while (!((Test-Path bin) -and (Test-Path examples) -and ((Test-Path modules) -or (Test-Path platforms))))
-{ cd .. }
+while (!((Test-Path bin) -and (Test-Path examples) -and ((Test-Path modules) -or (Test-Path platforms)))) {
+ cd ..
+ if ((Get-Location).Drive.Root -eq (Get-Location).Path) {
+ break
+ }
+}
echo "Ignite home detected at '$pwd'."
@@ -116,56 +136,80 @@ else {
$libsDir = "$PSScriptRoot\bin\Libs"
mkdir -Force $libsDir; del -Force $libsDir\*.*
-ls modules\indexing\target,modules\core\target,modules\spring\target *.jar -recurse `
+ls $jarDirs.Split(',') *.jar -recurse `
-include "ignite-core*","ignite-indexing*","ignite-shmem*","ignite-spring*","lucene*","h2*","cache-api*","commons-*","spring*" `
- -exclude "*-sources*","*-javadoc*","*-tests*" `
+ -exclude "*-sources*","*-javadoc*","*-tests*","*optional*" `
| % { copy -Force $_ $libsDir }
-
+
# Restore directory
cd $PSScriptRoot
# 2) Build .NET
-# Detect MSBuild 4.0+
-for ($i=20; $i -ge 4; $i--) {
- $regKey = "HKLM:\software\Microsoft\MSBuild\ToolsVersions\$i.0"
- if (Test-Path $regKey) { break }
+
+# Detect NuGet
+$ng = if ($nugetPath) { $nugetPath } else { "nuget" }
+
+if ((Get-Command $ng -ErrorAction SilentlyContinue) -eq $null) {
+ $ng = ".\nuget.exe"
+
+ if (-not (Test-Path $ng)) {
+ echo "Downloading NuGet..."
+ (New-Object System.Net.WebClient).DownloadFile("https://dist.nuget.org/win-x86-commandline/v3.3.0/nuget.exe", "nuget.exe");
+ }
}
-if (!(Test-Path $regKey)) {
- echo "Failed to detect MSBuild path, exiting."
- exit -1
+echo "Using NuGet from: $ng"
+
+if (!$skipDotNet) {
+ # Detect MSBuild 4.0+
+ for ($i=20; $i -ge 4; $i--) {
+ $regKey = "HKLM:\software\Microsoft\MSBuild\ToolsVersions\$i.0"
+ if (Test-Path $regKey) { break }
+ }
+
+ if (!(Test-Path $regKey)) {
+ echo "Failed to detect MSBuild path, exiting."
+ exit -1
+ }
+
+ $msbuildExe = (join-path -path (Get-ItemProperty $regKey)."MSBuildToolsPath" -childpath "msbuild.exe")
+ echo "MSBuild detected at '$msbuildExe'."
+
+ # Restore NuGet packages
+ echo "Restoring NuGet..."
+ & $ng restore
+
+ # Build
+ $targets = if ($clean) {"Clean;Rebuild"} else {"Build"}
+ $codeAnalysis = if ($skipCodeAnalysis) {"/p:RunCodeAnalysis=false"} else {""}
+ $msBuildCommand = "`"$msBuildExe`" Apache.Ignite.sln /target:$targets /p:Configuration=$configuration /p:Platform=`"$platform`" $codeAnalysis /p:UseSharedCompilation=false"
+ echo "Starting MsBuild: '$msBuildCommand'"
+ cmd /c $msBuildCommand
+
+ # Check result
+ if ($LastExitCode -ne 0) {
+ echo ".NET build failed."
+ exit -1
+ }
}
-$msbuildExe = (join-path -path (Get-ItemProperty $regKey)."MSBuildToolsPath" -childpath "msbuild.exe")
-echo "MSBuild detected at '$msbuildExe'."
+if ($asmDirs) {
+ ls $asmDirs.Split(',') | % `
+ {
+ $projName = [System.IO.Path]::GetFileNameWithoutExtension($_.Name);
-# Detect NuGet
-$ng = "nuget"
-if ((Get-Command $ng -ErrorAction SilentlyContinue) -eq $null) {
- $ng = ".\nuget.exe"
+ if ($_.Name.EndsWith(".exe.config")) {
+ $projName = [System.IO.Path]::GetFileNameWithoutExtension($projName);
+ }
- if (-not (Test-Path $ng)) {
- echo "Downloading NuGet..."
- (New-Object System.Net.WebClient).DownloadFile("https://dist.nuget.org/win-x86-commandline/v3.3.0/nuget.exe", "nuget.exe");
- }
-}
+ if ($projName.StartsWith("Apache.Ignite")) {
+ $target = "$projName\bin\Release"
+ mkdir -Force $target
-# Restore NuGet packages
-echo "Restoring NuGet..."
-& $ng restore
-
-# Build
-$targets = if ($clean) {"Clean;Rebuild"} else {"Build"}
-$codeAnalysis = if ($skipCodeAnalysis) {"/p:RunCodeAnalysis=false"} else {""}
-$msBuildCommand = "`"$msBuildExe`" Apache.Ignite.sln /target:$targets /p:Configuration=$configuration /p:Platform=`"$platform`" $codeAnalysis /p:UseSharedCompilation=false"
-echo "Starting MsBuild: '$msBuildCommand'"
-cmd /c $msBuildCommand
-
-# Check result
-if ($LastExitCode -ne 0) {
- echo ".NET build failed."
- exit -1
+ xcopy /s /y $_.FullName $target
+ }
+ }
}
# Copy binaries