ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [25/50] [abbrv] ignite git commit: IGNITE-3886 .NET: Build script added
Date Mon, 26 Dec 2016 11:16:41 GMT
IGNITE-3886 .NET: Build script added

This closes #1298


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c864fe44
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c864fe44
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c864fe44

Branch: refs/heads/ignite-2.0
Commit: c864fe443284508c7eb1d2341d9fdc2a5a844c45
Parents: 0a33644
Author: Pavel Tupitsyn <ptupitsyn@apache.org>
Authored: Wed Dec 21 15:50:36 2016 +0300
Committer: Pavel Tupitsyn <ptupitsyn@apache.org>
Committed: Wed Dec 21 15:50:36 2016 +0300

----------------------------------------------------------------------
 modules/platforms/dotnet/Apache.Ignite.sln |   2 +
 modules/platforms/dotnet/DEVNOTES.txt      |  12 +-
 modules/platforms/dotnet/build.bat         |  14 ++
 modules/platforms/dotnet/build.ps1         | 211 ++++++++++++++++++++++++
 4 files changed, 236 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c864fe44/modules/platforms/dotnet/Apache.Ignite.sln
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.sln b/modules/platforms/dotnet/Apache.Ignite.sln
index ef953b1..bcaa753 100644
--- a/modules/platforms/dotnet/Apache.Ignite.sln
+++ b/modules/platforms/dotnet/Apache.Ignite.sln
@@ -30,6 +30,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
 		Apache.Ignite.FxCop = Apache.Ignite.FxCop
 		Apache.Ignite.sln.DotSettings = Apache.Ignite.sln.DotSettings
 		Apache.Ignite.sln.TeamCity.DotSettings = Apache.Ignite.sln.TeamCity.DotSettings
+		build.bat = build.bat
+		build.ps1 = build.ps1
 		DEVNOTES.txt = DEVNOTES.txt
 		README.txt = README.txt
 		README.md = README.md

http://git-wip-us.apache.org/repos/asf/ignite/blob/c864fe44/modules/platforms/dotnet/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/DEVNOTES.txt b/modules/platforms/dotnet/DEVNOTES.txt
index 630960e..df0ebb5 100644
--- a/modules/platforms/dotnet/DEVNOTES.txt
+++ b/modules/platforms/dotnet/DEVNOTES.txt
@@ -5,12 +5,18 @@ Requirements:
 * Windows (XP and up), Windows Server (2008 and up)
 * Oracle JDK 7 and above
 * .NET Framework 4.0
+* PowerShell 3.0+
 * Visual Studio 2010 (later versions require upgrading "common" C++ project, see below)
-* JAVA_HOME environment variable set to the corresponding JDK (x64 or x86).
+* JAVA_HOME environment variable set to the corresponding JDK (x64 or x86)
+* Apache Maven bin directory in PATH, or MAVEN_HOME environment variable
 
 Building binaries:
-  msbuild Apache.Ignite.sln /p:Configuration=Release
-Resulting binaries will be in Apache.Ignite\bin folder
+  build.bat -skipCodeAnalysis
+Resulting binaries will be in bin folder, and NuGet packages in nupkg folder.
+
+Running built binaries: resulting "bin" folder in self contained, you can copy it anywhere
and run
+  bin\Apache.Ignite.exe  
+
 NOTE: 
 * x86 solution platform requires x86 Oracle JDK.
 * x64 solution platform requires x64 Oracle JDK.

http://git-wip-us.apache.org/repos/asf/ignite/blob/c864fe44/modules/platforms/dotnet/build.bat
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/build.bat b/modules/platforms/dotnet/build.bat
new file mode 100644
index 0000000..ef0a96f
--- /dev/null
+++ b/modules/platforms/dotnet/build.bat
@@ -0,0 +1,14 @@
+:: Licensed under the Apache License, Version 2.0 (the "License");
+:: you may not use this file except in compliance with the License.
+:: You may obtain a copy of the License at
+::
+::      http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+
+:: Apache Ignite.NET build script runner, see build.ps1 for more details.
+powershell -executionpolicy remotesigned -file build.ps1 %*
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c864fe44/modules/platforms/dotnet/build.ps1
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/build.ps1 b/modules/platforms/dotnet/build.ps1
new file mode 100644
index 0000000..be7e638
--- /dev/null
+++ b/modules/platforms/dotnet/build.ps1
@@ -0,0 +1,211 @@
+<#
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+ #>
+
+ <#
+
+.SYNOPSIS
+Apache Ignite.NET build script.
+
+.DESCRIPTION
+Builds all parts of Apache Ignite.NET: Java, .NET, NuGet. Copies results to 'bin' and 'nupkg'
folders.
+
+Requirements:
+* PowerShell 3
+* JDK 7+
+* MAVEN_HOME environment variable or mvn.bat in PATH
+
+.PARAMETER skipJava
+Skip Java build.
+
+.PARAMETER skipNuGet
+Skip NuGet packaging.
+
+.PARAMETER skipCodeAnalysis
+Skip code analysis.
+
+.PARAMETER clean
+Perform a clean rebuild.
+
+.PARAMETER platform
+Build platform ("Any CPU", "x86", "x64").
+
+.PARAMETER configuration
+Build configuration ("Release", "Debug").
+
+.PARAMETER mavenOpts
+Custom Maven options, default is "-U -P-lgpl,-scala,-examples,-test,-benchmarks -Dmaven.javadoc.skip=true".
+
+.EXAMPLE
+.\build.ps1 -clean  
+# Full rebuild of Java, .NET and NuGet packages.
+
+.EXAMPLE
+.\build.ps1 -skipJava -skipCodeAnalysis -skipNuGet -configuration Debug -platform x64
+# Quick build of .NET code only.
+
+#>
+
+param (
+    [switch]$skipJava,
+    [switch]$skipNuGet,
+    [switch]$skipCodeAnalysis,  
+    [switch]$clean,
+    [ValidateSet("Any CPU", "x64", "x86")]
+    [string]$platform="Any CPU",
+    [ValidateSet("Release", "Debug")]
+    [string]$configuration="Release",
+    [string]$mavenOpts="-U -P-lgpl,-scala,-examples,-test,-benchmarks -Dmaven.javadoc.skip=true"
+ )
+
+# 1) Build Java (Maven)
+if (!$skipJava) {
+    # Detect Ignite root directory
+    cd $PSScriptRoot\..
+
+    while (!((Test-Path bin) -and (Test-Path examples) -and ((Test-Path modules) -or (Test-Path
platforms))))
+    { cd .. }
+
+    echo "Ignite home detected at '$pwd'."
+
+    # Detect Maven
+    $mv = "mvn"
+    if ((Get-Command $mv -ErrorAction SilentlyContinue) -eq $null) { 
+        $mvHome = ($env:MAVEN_HOME, $env:M2_HOME, $env:M3_HOME, $env:MVN_HOME -ne $null)[0]
+
+        if ($mvHome -eq $null) {
+            echo "Maven not found. Make sure to update PATH variable or set MAVEN_HOME, M2_HOME,
M3_HOME, or MVN_HOME."
+            exit -1
+        }
+
+        $mv = "`"" + (join-path $mvHome "bin\mvn.bat") + "`""
+        echo "Maven detected at $mv."
+    }
+
+    # Run Maven
+    echo "Starting Java (Maven) build..."
+    
+    $mvnTargets = if ($clean)  { "clean package" } else { "package" }
+    cmd /c "$mv $mvnTargets -DskipTests $mavenOpts"
+
+    # Check result
+    if ($LastExitCode -ne 0) {
+        echo "Java (Maven) build failed."; exit -1
+    }
+
+    # Copy (relevant) jars
+    $libsDir = "$PSScriptRoot\bin\Libs"
+    mkdir -Force $libsDir; del -Force $libsDir\*.*
+    
+    copy -Force target\release-package\libs\*.jar $libsDir
+    copy -Force target\release-package\libs\ignite-spring\*.jar $libsDir
+    copy -Force target\release-package\libs\ignite-indexing\*.jar $libsDir
+    copy -Force target\release-package\libs\licenses\*.jar $libsDir
+
+    # Restore directory
+    cd $PSScriptRoot
+}
+else {
+    echo "Java (Maven) build skipped."
+}
+
+
+# 2) Build .NET
+# Detect MSBuild 4.0+
+for ($i=4; $i -le 20; $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'."
+
+# Detect NuGet
+$ng = "nuget"
+if ((Get-Command $ng -ErrorAction SilentlyContinue) -eq $null) { 
+    echo "Downloading NuGet..."
+    (New-Object System.Net.WebClient).DownloadFile("https://dist.nuget.org/win-x86-commandline/v3.3.0/nuget.exe",
"nuget.exe");    
+    $ng = ".\nuget.exe"
+}
+
+# Restore NuGet packages
+echo "Restoring NuGet..."
+& $ng restore
+
+# Build
+echo "Starting MsBuild..."
+$targets = if ($clean) {"Clean;Rebuild"} else {"Build"}
+$codeAnalysis = if ($skipCodeAnalysis) {"/p:RunCodeAnalysis=false"} else {""}
+& $msbuildExe Apache.Ignite.sln /target:$targets /p:Configuration=$configuration /p:Platform=`"$platform`"
$codeAnalysis /p:UseSharedCompilation=false
+
+# Check result
+if ($LastExitCode -ne 0) {
+    echo ".NET build failed."
+    exit -1
+}
+
+# Copy binaries
+mkdir -Force bin; del -Force bin\*.*
+
+ls *.csproj -Recurse | where Name -NotLike "*Examples*" `
+                     | where Name -NotLike "*Tests*" `
+                     | where Name -NotLike "*Benchmarks*" | % {
+    $binDir = if (($configuration -eq "Any CPU") -or ($_.Name -ne "Apache.Ignite.Core.csproj"))
`
+                {"bin\$configuration"} else {"bin\$platform\$configuration"}
+    $dir = join-path (split-path -parent $_) $binDir    
+    xcopy /s /y $dir\*.* bin
+}
+
+
+# 3) Pack NuGet
+if (!$skipNuGet) {
+    # Check parameters
+    if (($platform -ne "Any CPU") -or ($configuration -ne "Release")) {
+        echo "NuGet can only package 'Release' 'Any CPU' builds; you have specified '$configuration'
'$platform'."
+        exit -1
+    }
+
+    $nupkgDir = "nupkg"
+    mkdir -Force $nupkgDir; del -Force $nupkgDir\*.*
+
+    # Detect version
+    $ver = (gi Apache.Ignite.Core\bin\Release\Apache.Ignite.Core.dll).VersionInfo.ProductVersion
+
+    # Find all nuspec files and run 'nuget pack' either directly, or on corresponding csproj
files (if present)
+    ls *.nuspec -Recurse  `
+        | % { 
+            If (Test-Path ([io.path]::ChangeExtension($_.FullName, ".csproj"))){
+                [io.path]::ChangeExtension($_.FullName, ".csproj")
+            } Else { $_.FullName }
+        } | % { 
+            & $ng pack $_ -Prop Configuration=Release -Prop Platform=AnyCPU -Version
$ver -OutputDirectory $nupkgDir
+
+            # check result
+            if ($LastExitCode -ne 0)
+            {
+                echo "NuGet pack failed."; exit -1
+            }
+        }
+
+    echo "NuGet packages created in '$pwd\$nupkgDir'."
+}
\ No newline at end of file


Mime
View raw message