You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jm...@apache.org on 2013/01/24 02:05:38 UTC

svn commit: r1437816 - /flex/sdk/branches/develop/ide/setFlashPlayerVersion.sh

Author: jmclean
Date: Thu Jan 24 01:05:37 2013
New Revision: 1437816

URL: http://svn.apache.org/viewvc?rev=1437816&view=rev
Log:
script to set minimum player version and download player globals and AIR if needed

Added:
    flex/sdk/branches/develop/ide/setFlashPlayerVersion.sh   (with props)

Added: flex/sdk/branches/develop/ide/setFlashPlayerVersion.sh
URL: http://svn.apache.org/viewvc/flex/sdk/branches/develop/ide/setFlashPlayerVersion.sh?rev=1437816&view=auto
==============================================================================
--- flex/sdk/branches/develop/ide/setFlashPlayerVersion.sh (added)
+++ flex/sdk/branches/develop/ide/setFlashPlayerVersion.sh Thu Jan 24 01:05:37 2013
@@ -0,0 +1,227 @@
+#!/bin/sh -e
+
+################################################################################
+##
+##  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.
+##
+################################################################################
+
+#
+# Usage: setFlashPlayerVersion "Apache Flex directory" "Flash Player version" 
+#
+# This script will download and add the specified version of AIR to an SDK and
+# update it's configuration.
+
+# Process the parameters.
+
+IDE_SDK_DIR="$1"
+if [ "${IDE_SDK_DIR}" = "" ]
+then
+    echo Usage: $0 "Apache Flex directory"
+    echo Or
+    echo Usage: $0 "Apache Flex directory" "Flash Player version"  
+    exit 1;
+fi
+
+echo The Apache Flex directory for the IDE is "$IDE_SDK_DIR"
+
+FLASH_VERSION="$2"
+
+askYesNo() {
+	read -n 1 accept
+	echo
+		
+    yesNo="N"
+		
+	if [[ "${accept}" = "Y" || "${accept}" = "y" ]]
+	then
+	   yesNo="Y"
+	fi
+}
+
+determineVersion()
+{
+    echo
+    echo "Do you want to use the latest version of the Flash Player?"
+    askYesNo
+    latest=$yesNo
+    echo
+    
+    if [ $latest = "N" ]
+    then
+	    echo "Do you need to support all older versions of the Flash Player?"
+	    askYesNo
+	    legacy=$yesNo
+	    echo
+	else
+	    legacy="N"
+	fi
+	
+    echo "Do you want to create browser based applications?"
+    askYesNo
+    useBrowser=$yesNo
+    echo
+    echo "Do you want to create desktop applications?"
+    askYesNo
+    useDesktop=$yesNo
+    echo
+    echo "Do you want to create mobile applications?"
+    askYesNo
+    useMobile=$yesNo
+	echo
+
+	FLASH_VERSION="10.2"
+
+    if [[ $legacy = "N" ]]
+    then
+       FLASH_VERSION="11.1"
+    fi
+    
+    if [[ $useMobile = "Y" || $useDesktop != "Y" ]]
+    then
+        if [[ $useBrowser = "Y" ]]
+        then 
+            FLASH_VERSION="11.1"
+        else
+            FLASH_VERSION="11.5"
+        fi
+    fi
+    
+    if [ ${latest} = "Y" ]
+    then
+    	FLASH_VERSION="11.5"
+    fi
+    
+    echo "Setting minimum Flash Player version to ${FLASH_VERSION}"
+    echo
+    echo
+}
+
+if [[ -z "${FLASH_VERSION}" ]]
+then
+	determineVersion
+fi
+
+if [[ "${FLASH_VERSION}" != "10.2" && "${FLASH_VERSION}" != "10.2"  && "${FLASH_VERSION}" != "11.0"  && "${FLASH_VERSION}" != "11.1" && "${FLASH_VERSION}" != "11.2" && "${FLASH_VERSION}" != "11.3" && "${FLASH_VERSION}" != "11.4" && "${FLASH_VERSION}" != "11.5" ]]
+then
+	echo Unknown version ${FLASH_VERSION} of Flash Player. Versions 10.2, 10.3, 11.0, 11.1, 11.2, 11.3, 11.4 and 11.5 are supported.
+	exit 1;
+fi
+
+# If this is an Apache Flex dir then there should be a NOTICE file.
+
+if [ ! -f "${IDE_SDK_DIR}/NOTICE" ]
+then
+    echo ${IDE_SDK_DIR} does not appear to be an Apache Flex distribution.
+    exit 1;
+fi
+
+echo Checking player globals
+echo
+./checkAllPlayerGlobals.sh "$IDE_SDK_DIR"
+
+if [[ $useMobile = "Y" || $useDesktop = "Y" ]] 
+then
+	echo Installing AIR
+	echo
+
+    if [[ $FLASH_VERSION = "11.5" ]]
+    then
+        ./addAIRtoSDK.sh 3.5 "$IDE_SDK_DIR"
+    fi
+    
+    if [[ $FLASH_VERSION = "11.1" ]]
+    then
+        ./addAIRtoSDK.sh 3.1 "$IDE_SDK_DIR"
+    fi
+fi
+
+# update config file
+
+updatePlayerVersion() {
+	playerversion=$1
+	configFile=$2
+	sed "s/<target-player>[0-9][0-9]\.[0-9]<\/target-player>/<target-player>${playerversion}<\/target-player>/" < "${configFile}"  > "${configFile}.tmp"
+	mv "${configFile}.tmp" "${configFile}"
+}
+
+updateSWFVersion() {
+	swfversion=$1
+	configFile=$2
+	sed "s/<swf-version>[0-9][0-9]<\/swf-version>/<swf-version>${swfversion}<\/swf-version>/" < "${configFile}"  > "${configFile}.tmp"
+	mv "${configFile}.tmp" "${configFile}"
+}
+
+configFiles=(
+"${IDE_SDK_DIR}/frameworks/flex-config.xml"
+"${IDE_SDK_DIR}/frameworks/air-config.xml"
+"${IDE_SDK_DIR}/frameworks/airmobile-config.xml"
+)
+
+for configFile in "${configFiles[@]}"
+do
+	echo Updating ${configFile}
+
+	if [ ${FLASH_VERSION} = "11.5" ]
+	then
+		updatePlayerVersion 11.5 "${configFile}"
+		updateSWFVersion 18 "${configFile}"
+	fi
+	
+	if [ ${FLASH_VERSION} = "11.4" ]
+	then
+		updatePlayerVersion 11.4 "${configFile}"
+		updateSWFVersion 17 "${configFile}"
+	fi
+
+	if [ ${FLASH_VERSION} = "11.3" ]
+	then
+		updatePlayerVersion 11.3 "${configFile}"
+		updateSWFVersion 16 "${configFile}"
+	fi
+	
+	if [ ${FLASH_VERSION} = "11.2" ]
+	then
+		updatePlayerVersion 11.2 "${configFile}"
+		updateSWFVersion 15 "${configFile}"
+	fi
+	
+	if [ ${FLASH_VERSION} = "11.1" ]
+	then
+		updatePlayerVersion 11.1 "${configFile}"
+		updateSWFVersion 14 "${configFile}"
+	fi
+	
+    if [ ${FLASH_VERSION} = "11.0" ]
+	then
+		updatePlayerVersion 11.0 "${configFile}"
+		updateSWFVersion 13 "${configFile}"
+	fi
+	
+	if [ ${FLASH_VERSION} = "10.3" ]
+	then
+		updatePlayerVersion 10.3 "${configFile}"
+		updateSWFVersion 12 "${configFile}"
+	fi
+	
+	if [ ${FLASH_VERSION} = "10.2" ]
+	then
+		updatePlayerVersion 10.2 "${configFile}"
+		updateSWFVersion 11 "${configFile}"
+	fi
+done
+
+

Propchange: flex/sdk/branches/develop/ide/setFlashPlayerVersion.sh
------------------------------------------------------------------------------
    svn:executable = *