You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cf...@apache.org on 2012/05/17 21:50:29 UTC
svn commit: r1339824 - in /incubator/flex/trunk/ide/flashbuilder:
makeApacheFlexForFlashBuilder.bat winUtil.vbs
Author: cframpton
Date: Thu May 17 19:50:28 2012
New Revision: 1339824
URL: http://svn.apache.org/viewvc?rev=1339824&view=rev
Log:
For Windows, replace calls to powershell with cscript calls to a vbs script because only Windows 7 has powershell installed by default. Put both functions in the same script to eliminate one of the two vbs scripts. Tested on VMware Window 7 and Windows XP images. Since it isn't worth spending any more time on this, if this version has problems we're going to bail and resort to written instructions for now.
Added:
incubator/flex/trunk/ide/flashbuilder/winUtil.vbs (with props)
Modified:
incubator/flex/trunk/ide/flashbuilder/makeApacheFlexForFlashBuilder.bat
Modified: incubator/flex/trunk/ide/flashbuilder/makeApacheFlexForFlashBuilder.bat
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/ide/flashbuilder/makeApacheFlexForFlashBuilder.bat?rev=1339824&r1=1339823&r2=1339824&view=diff
==============================================================================
--- incubator/flex/trunk/ide/flashbuilder/makeApacheFlexForFlashBuilder.bat (original)
+++ incubator/flex/trunk/ide/flashbuilder/makeApacheFlexForFlashBuilder.bat Thu May 17 19:50:28 2012
@@ -67,41 +67,19 @@ set tempDir=%FLEX_HOME%\temp
if not exist "%tempDir%" mkdir "%tempDir%"
REM
-REM See if jar.exe is in the PATH. If so we can use it to uncompress the zip files
-REM since it is much faster than the vbs script.
-REM
-for %%X in (jar.exe) do (set hasJarExe=%%~$PATH:X)
-
-REM
REM Download Apache Flex SDK.
REM
-echo Downloading Apache Flex SDK from "%APACHE_FLEX_BIN_DISTRO_URL%" to "%tempDir%\%APACHE_FLEX_BIN_DISTRO_FILE%"
-PowerShell -Command "& {(new-object System.Net.WebClient).DownloadFile('%APACHE_FLEX_BIN_DISTRO_URL%', '%tempDir%\%APACHE_FLEX_BIN_DISTRO_FILE%')}"
+echo Downloading and unzipping Apache Flex SDK from "%APACHE_FLEX_BIN_DISTRO_URL%" to "%FLEX_HOME%
+cscript //B //nologo winUtil.vbs "%APACHE_FLEX_BIN_DISTRO_URL%" "%tempDir%\%APACHE_FLEX_BIN_DISTRO_FILE%" "%FLEX_HOME%"
if %errorlevel% neq 0 goto errorExit
-echo Uncompressing Apache Flex SDK to "%FLEX_HOME%"
-if defined hasJarExe (
- pushd "%FLEX_HOME%" & jar xf "%tempDir%\%APACHE_FLEX_BIN_DISTRO_FILE%" & popd
-) else (
- PowerShell -Command "& {$zipPackage=(new-object -com shell.application).NameSpace('%tempDir%\%APACHE_FLEX_BIN_DISTRO_FILE%'); $destinationFolder=(new-object -com shell.application).NameSpace('%FLEX_HOME%'); $destinationFolder.CopyHere($zipPackage.Items(),20)}"
- if %errorlevel% neq 0 goto errorExit
-)
-
REM
REM Download AIR Runtime Kit for Windows
REM
-echo Downloading Adobe AIR Runtime Kit for Windows from "%ADOBE_AIR_SDK_WIN_URL%" to "%tempDir%\%ADOBE_AIR_SDK_WIN_FILE%"
-PowerShell -Command "& {(new-object System.Net.WebClient).DownloadFile('%ADOBE_AIR_SDK_WIN_URL%', '%tempDir%\%ADOBE_AIR_SDK_WIN_FILE%')}"
+echo Downloading and unzipping Adobe AIR Runtime Kit for Windows from "%ADOBE_AIR_SDK_WIN_URL%" to "%FLEX_HOME%
+cscript //B //nologo winUtil.vbs "%ADOBE_AIR_SDK_WIN_URL%" "%tempDir%\%ADOBE_AIR_SDK_WIN_FILE%" "%FLEX_HOME%"
if %errorlevel% neq 0 goto errorExit
-echo Uncompressing Adobe AIR Runtime Kit for Windows from "%tempDir%\%ADOBE_AIR_SDK_WIN_FILE%" to "%FLEX_HOME%"
-if defined hasJarExe (
- pushd "%FLEX_HOME%" & jar xf "%tempDir%\%ADOBE_AIR_SDK_WIN_FILE%" & popd
-) else (
- PowerShell -Command "& {$zipPackage=(new-object -com shell.application).NameSpace('%tempDir%\%ADOBE_AIR_SDK_WIN_FILE%'); $destinationFolder=(new-object -com shell.application).NameSpace('%FLEX_HOME%'); $destinationFolder.CopyHere($zipPackage.Items(),20)}"
- if %errorlevel% neq 0 goto errorExit
-)
-
REM
REM Download playerglobal.swc
REM
@@ -109,7 +87,7 @@ set FB_GLOBALPLAYER_DIR=%FLEX_HOME%\fram
if not exist "%FB_GLOBALPLAYER_DIR%" mkdir "%FB_GLOBALPLAYER_DIR%"
echo Downloading Adobe Flash Player playerglobal.swc from "%ADOBE_FB_GLOBALPLAYER_SWC_URL%" to "%FB_GLOBALPLAYER_DIR%\playerglobal.swc"
-PowerShell -Command "& {(new-object System.Net.WebClient).DownloadFile('%ADOBE_FB_GLOBALPLAYER_SWC_URL%', '%FB_GLOBALPLAYER_DIR%\playerglobal.swc')}"
+cscript //B //nologo winUtil.vbs "%ADOBE_FB_GLOBALPLAYER_SWC_URL%" "%FB_GLOBALPLAYER_DIR%\playerglobal.swc"
if %errorlevel% neq 0 goto errorExit
REM
@@ -128,4 +106,4 @@ goto :eof
:errorExit
echo Exiting: error %errorlevel%
-exit /b %errorlevel%
\ No newline at end of file
+exit /b %errorlevel%
Added: incubator/flex/trunk/ide/flashbuilder/winUtil.vbs
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/ide/flashbuilder/winUtil.vbs?rev=1339824&view=auto
==============================================================================
--- incubator/flex/trunk/ide/flashbuilder/winUtil.vbs (added)
+++ incubator/flex/trunk/ide/flashbuilder/winUtil.vbs Thu May 17 19:50:28 2012
@@ -0,0 +1,89 @@
+'################################################################################
+'##
+'## 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.
+'##
+'################################################################################
+
+' Note: this script could be improved with the addition of error handling
+
+' Download and optionally unzip a binary.
+'
+' arg1 is the URL of the binary to download
+' arg2 is the local path for the binary file
+' [arg3] if specified, is the target dir to unzip arg2
+
+DownloadBinary WScript.Arguments(0), WScript.Arguments(1)
+
+If WScript.Arguments.Count = 3 Then
+ Unzip WScript.Arguments(1), WScript.Arguments(2)
+End If
+
+'
+' Windows doesn't have a builtin HTTP GET.
+' HTTP Get the URL specified with sBinURL to the local file specified by sBinFilePath
+'
+Function DownloadBinary(sBinURL, sBinFilePath)
+
+ ' Fetch the file
+ Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
+
+ objXMLHTTP.open "GET", sBinURL, false
+ objXMLHTTP.send()
+
+ 'wait until the data has downloaded successfully
+ do until objXMLHTTP.Status = 200 : wcript.sleep(1000) : loop
+
+ If objXMLHTTP.Status = 200 Then
+ Set objStream = CreateObject("ADODB.Stream")
+
+ objStream.Open
+
+ ' Type is binary.
+ objStream.Type = 1
+
+ objStream.Write objXMLHTTP.ResponseBody
+ objStream.Position = 0
+
+ ' 2: Overwrite the binary if it already exists.
+ objStream.savetofile sBinFilePath, 2
+ objStream.Close
+
+ Set objStream = Nothing
+ End if
+
+ Set objXMLHTTP = Nothing
+
+End Function
+
+'
+' Windows doesn't have a built in unzip command so unzip a zip file with vbScript.
+' sZipFilePath is the absolute path to the zip file
+' sDestinationDir is the existing target directory
+'
+Function Unzip(sZipFilePath, sDestinationDir)
+ Dim objshell
+
+ ' Create Shell.Application so we can use the CopyHere method
+ Set objshell = CreateObject("Shell.Application")
+
+ ' Use CopyHere to extract files
+ ' Note the options do not work on Windows XP when manipulating a zip file.
+ ' 4: Do not display a progress dialog box.
+ ' 16: Click "Yes to All" in any dialog box that is displayed.
+ objshell.NameSpace(sDestinationDir).CopyHere objshell.NameSpace(sZipFilePath).Items, 16
+
+ Set objshell = Nothing
+End Function
Propchange: incubator/flex/trunk/ide/flashbuilder/winUtil.vbs
------------------------------------------------------------------------------
svn:eol-style = native