lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mhern...@apache.org
Subject [Lucene.Net] svn commit: r1175056 - /incubator/lucene.net/trunk/build/scripts/validate-tool-chain.ps1
Date Fri, 23 Sep 2011 22:30:28 GMT
Author: mherndon
Date: Fri Sep 23 22:30:28 2011
New Revision: 1175056

URL: http://svn.apache.org/viewvc?rev=1175056&view=rev
Log:
fixing up the validate tool chain script, this should let people who are setting up a build
server or env, download and install software that lucene.net requires to run its full build.
Also handy for new dev boxes, however you are responsible for your own licenses and the script
makes its clear for that.

Modified:
    incubator/lucene.net/trunk/build/scripts/validate-tool-chain.ps1

Modified: incubator/lucene.net/trunk/build/scripts/validate-tool-chain.ps1
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/build/scripts/validate-tool-chain.ps1?rev=1175056&r1=1175055&r2=1175056&view=diff
==============================================================================
--- incubator/lucene.net/trunk/build/scripts/validate-tool-chain.ps1 (original)
+++ incubator/lucene.net/trunk/build/scripts/validate-tool-chain.ps1 Fri Sep 23 22:30:28 2011
@@ -1,32 +1,48 @@
-@'
- 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.
- 
-'@
-
-function DirExists($path) { 
- 
-    if ([IO.Directory]::Exists($path)) 
-    { 
-        return $true; 
-    } 
-    else 
-    { 
-        return $false; 
-    } 
-} 
+#
+# 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.
+#
+#
+#
+# NOTICE: This script could mess up your development box. Use with extreme 
+# caution. Better yet, test this on a non-production env vm before attempting
+# to use it on any box of importance.
+#
+#
+# This is essentially a devopts script for installing tools that needed for
+# the Lucene.NEt build scripts to run CI on windows. 
+#
+# Its could use some refactoring and increase its functionality for version 
+# & error checking.
+# 
+# But it beats having to remember where to download & install packages from. 
+#
+# This could also be handy for setting up new dev machines on windows 8 previews. 
+#
+#
+# When Co-App is finally released and is considered stable, we could potentially 
+# replace this script with that. 
+# http://coapp.org/
+
+function Get-ScriptDirectory
+{
+	$script = (Get-Variable MyInvocation -Scope 1).Value
+	Split-Path $script.MyCommand.Path
+}
+
+$cd = Get-ScriptDirectory;
 
 $Folder64 = $Env:ProgramFiles;
 $Folder32 = ${Env:ProgramFiles(x86)};
@@ -34,6 +50,7 @@ $Folder32 = ${Env:ProgramFiles(x86)};
 $RequireWin7_1 = $false;
 $RequireFxCop10 = $false;
 $RequireSHFB = $false;
+$RequireNCover = $false;
 
 echo $Folder32;
 
@@ -58,6 +75,13 @@ if($FindFxCop10 -eq $false) {
 	echo "Fx Cop 10                     ..Found."; 
 }
 
+$FindNCover = Test-Path ($Folder32 + "\NCover\NCover.Console.exe");
+if($FindNCover -eq $false) {
+	echo "NCover is not installed in its expected location.";
+	$RequireNCover = $true;
+} else {
+	echo "NCover                        ..Found."; 
+}
 
 $FindSHFB = Test-Path ($Folder32 + "\EWSoftware\Sandcastle Help File Builder");
 
@@ -65,6 +89,224 @@ if($FindSHFB -eq $false) {
 	echo "Sandcastle Help File Builder is not installed in its expected location."; 
 	$RequireSFHB = $true;
 } else {
-	echo "Sandcastle Help File Builder  ..Found."; 
-     
+	echo "Sandcastle Help File Builder  ..Found.";     
+}
+
+Function PromptForSHFBInstall
+{
+	$process = read-host "Do you want to download and install SandCastle Help File Builder ?
(Y) or (N)";
+	if($process -eq "Y")
+	{
+		
+		$license = Read-Host "Do you agree to reading and accepting the ms-pl license http://www.opensource.org/licenses/MS-PL
? (Y) or (N)";
+		
+		if($license -eq "Y")
+		{
+			[System.Reflection.Assembly]::LoadFrom((Join-Path ($cd) "..\..\lib\ICSharpCode\SharpZipLib\0.85\ICSharpCode.SharpZipLib.dll"));
+			$zip = New-Object ICSharpCode.SharpZipLib.Zip.FastZip
+			$client = new-object System.Net.WebClient;
+			$SHFBUrl = "http://download.codeplex.com/Download?ProjectName=shfb&DownloadId=214182&FileTime=129456589216470000&Build=18101";
+			$SHFBFileName = Join-Path $home Downloads\SHFBGuidedInstallation.zip;
+			$SHFBFileNameExtract = Join-Path $home Downloads\SHFBGuidedInstallation;
+			[System.Net.GlobalProxySelection]::Select = [System.Net.GlobalProxySelection]::GetEmptyWebProxy();
+			trap { $error[0].Exception.ToString() } 
+			
+			$exists = Test-Path $SHFBFileName;
+			if($exists -eq $false)
+			{
+				echo ("Downloading SHFB to " + $SHFBFileName);
+				$client.DownloadFile($SHFBUrl,$SHFBFileName);
+			}
+			
+			$exists = Test-Path $SHFBFileNameExtract;
+			if($exists -eq $false)
+			{
+				echo ("Extracting SHFB to " + $SHFBFileNameExtract);
+				$zip.ExtractZip($SHFBFileName, $SHFBFileNameExtract, $null);
+			}
+
+			
+			echo ("Installing SHFB...");
+			$installer = Join-Path $HOME Downloads\SHFBGuidedInstallation\SandCastleInstaller.exe
+			
+			
+			trap [Exception] {
+				echo $_.Exception.Message;
+				return;
+			}
+		    & $installer | Out-Null
+			
+			if($LASTEXITCODE -eq 0) 
+			{ 
+				echo "SHFB was installed" ;
+			} else {
+				echo "SHFB installation failed.";
+				return;
+			}
+			
+			echo ("Deleting SHFB Zip");
+			del $SHFBFileName;
+			
+			echo ("Deleteing Extracted Files...");
+			del $SHFBFileNameExtract;
+		} 
+		else 
+		{
+			echo "SandCastle Help File Builder install aborted.";
+		}
+	}
+}
+
+Function PromptForWinSdk7_1Install 
+{
+	$process = read-host "Do you want to download and install Windows Sdk 7.1 ? (Y) or (N)";
+	if($process -eq "Y")
+	{	
+		$client = new-object System.Net.WebClient;
+		$WinSdk7_1Url = "http://download.microsoft.com/download/A/6/A/A6AC035D-DA3F-4F0C-ADA4-37C8E5D34E3D/winsdk_web.exe";
+		$WinSdk7_1FileName = Join-Path $home Downloads\winsdk_web.exe;
+		[System.Net.GlobalProxySelection]::Select = [System.Net.GlobalProxySelection]::GetEmptyWebProxy();
+		trap { $error[0].Exception.ToString() } 
+		
+		$exists = Test-Path $WinSdk7_1FileName;
+		if($exists -eq $false)
+		{
+			echo ("Downloading Win Sdk 7.1 to " + $WinSdk7_1FileName);
+			$client.DownloadFile($WinSdk7_1Url,$WinSdk7_1FileName);
+		}
+		
+		
+		echo ("Installing Win Sdk 7.1  ...");
+		$installer = $WinSdk7_1FileName;
+		trap [Exception] {
+			echo $_.Exception.Message;
+			return;
+		}
+		
+	    & $installer
+		
+		echo "Attempting to setup Win Sdk Version...";
+		$verExe = "C:\Program Files\Microsoft SDKs\Windows\v7.1\Setup\WindowsSdkVer.exe";
+		$verExeExists = Test-Path $verExe;
+		
+		
+		echo "Say yes to the next next two prompts if you wish to set WindowsSdkVer to -version:v7.1
...";
+		if($verExeExists)
+		{
+			$p = [diagnostics.process]::Start($verExe, " -version:v7.1");
+			
+			trap [Exception] {
+				echo ("Most likely this action was cancelled by you.: " + $_.Exception.Message);
+				return;
+			}
+			
+			$p.WaitForExit()  | out-null
+			if($LASTEXITCODE -eq 0) 
+			{ 
+				echo "Win Sdk 7.1 was installed" ;
+			} else {
+				echo "Win Sdk 7.1 failed.";
+				return;
+			}
+			
+			
+		} else {
+			echo ($verExe + "was not found.")
+		}
+		
+		echo ("Deleteing installer...");
+		del $WinSdk7_1FileName;
+		$RequireWin7_1 = $false;
+			
+	} 
+	else 
+	{
+		echo "Win Sdk 7.1 install aborted.";
+	}
+	
+}
+
+Function PromptForFxCop10Install()
+{
+	$process = read-host "Do you want to install FxCop 10.0 (WinSdk 7.1 is required)? (Y) or
(N)";
+	if($process -eq "Y")
+	{
+		$fxCopExe = "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\FXCop\FxCopSetup.exe";
+		$fxCopExeExists = Test-Path $fxCopExe;
+		
+		if($fxCopExeExists -eq $true)
+		{
+			trap [Exception] {
+				echo $_.Exception.Message;
+				return;
+			}
+			& $fxCopExe;
+		
+		} else {
+			echo ("The installer for fxcop 10 was not found at its expected location: " + $fxCopExe);
+			return;
+		}
+	}
+}
+
+Function PromptForNCoverInstall()
+{
+	$process = read-host "NCover is not free, you are responsible for obtaining your own license.
Do you want to install NCover ? (Y) or (N)";
+	
+	
+	if($process -eq "Y")
+	{
+		$client = new-object System.Net.WebClient;
+		$download = "http://downloads.ncover.com/NCover-x64-3.4.18.6937.msi";
+		$downloadFileName = Join-Path ($home + "Downloads\NCover-x64-3.4.18.6937.msi");
+		[System.Net.GlobalProxySelection]::Select = [System.Net.GlobalProxySelection]::GetEmptyWebProxy();
+		trap { $error[0].Exception.ToString() } 
+			
+		
+		$exists = Test-Path $downloadFileName;
+		if($exists -eq $false)
+		{
+			echo ("Downloading NCover to " + $downloadFileName);
+			$client.DownloadFile($download,$downloadFileName);
+		}
+	
+		echo "Installing NCover...";
+		trap [Exception] {
+				echo $_.Exception.Message;
+				return;
+			}
+		& $fxCopExe;
+		
+		echo "Deleting installer....";
+		del $downloadFileName;
+	}
+}
+
+
+if($RequireSFHB -eq $true)
+{
+	PromptForSHFBInstall;
+}
+
+if($RequireWin7_1 -eq $true)
+{
+	PromptForWinSdk7_1Install
+}
+
+if($RequireWin7_1 -eq $false -and $RequireFxCop10 -eq $true)
+{
+	PromptForFxCop10Install
+}
+
+if($RequireNCover -eq $true)
+{
+	PromptForNCoverInstall
 }
+
+
+
+
+
+
+#$client.DownloadFile($WinSdk7_1Url, $WinSdk7_1FileName);
+



Mime
View raw message