Permalink
Browse files

Fixed the Info.plist patching when doing a darwin build. Refs #47.

  • Loading branch information...
1 parent a6965d7 commit c90d1bee82eea2be7a88100bc70fa7ae4c20fc8c @mtoader mtoader committed Aug 10, 2011
Showing with 117 additions and 105 deletions.
  1. +2 −0 .idea/inspectionProfiles/Project_Default.xml
  2. +55 −1 build-distribution.xml
  3. +54 −97 go-ide/package.sh
  4. +6 −7 go-ide/package_darwin.sh
@@ -4,6 +4,8 @@
<option name="myLocal" value="false" />
<inspection_tool class="AntDuplicateImportedTargetsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ArithmeticOnVolatileField" enabled="true" level="WARNING" enabled_by_default="true" />
+ <inspection_tool class="Evaluate expansion" enabled="false" level="WARNING" enabled_by_default="false" />
+ <inspection_tool class="Fix shebang" enabled="true" level="WARNING" enabled_by_default="true">/bin/sh#/bin/bash</inspection_tool>
<inspection_tool class="InjectOfNonPublicMember" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpDynamicAsStaticMethodCallInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpIncludeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
@@ -20,6 +20,9 @@
<!--<mkdir dir="${target.root}" />-->
<echo message="Assembling Go-Ide into archive: ${go.ide.target.package}"/>
+ <condition property="is.darwin">
+ <equals arg1="${target.platform}" arg2="darwin" />
+ </condition>
</target>
<target name="resources" depends="init" description="Builds the GoIde resources jar">
@@ -36,7 +39,58 @@
</jar>
</target>
- <target name="assemble" depends="clean,init,resources" description="compile the source">
+ <target name="fix.Info.plist" depends="init" if="is.darwin" >
+ <replaceregexp
+ file="${idea.community.build}/Contents/Info.plist"
+ byline="false"
+ match="(&lt;key&gt;idea.platform.prefix&lt;/key&gt;[\r\n \t]+&lt;string&gt;)Idea(&lt;/string&gt;)"
+ replace="\1GoIde\2"
+ />
+
+ <replaceregexp
+ file="${idea.community.build}/Contents/Info.plist"
+ byline="false"
+ match="(&lt;key&gt;idea.paths.selector&lt;/key&gt;[\r\n \t]+&lt;string&gt;)[^&lt;]+(&lt;/string&gt;)"
+ replace="\1.GoIde1\2"
+ />
+
+ <replaceregexp
+ file="${idea.community.build}/Contents/Info.plist"
+ byline="false"
+ match="(&lt;key&gt;CFBundleName&lt;/key&gt;[\r\n \t]+&lt;string&gt;)[^&lt;]+(&lt;/string&gt;)"
+ replace="\1Go Ide\2"
+ />
+
+ <replaceregexp
+ file="${idea.community.build}/Contents/Info.plist"
+ byline="false"
+ match="(&lt;key&gt;CFBundleIdentifier&lt;/key&gt;[\r\n \t]+&lt;string&gt;)[^&lt;]+(&lt;/string&gt;)"
+ replace="\1ro.redeul.google.go.ide\2"
+ />
+
+ <replaceregexp
+ file="${idea.community.build}/Contents/Info.plist"
+ byline="false"
+ match="(&lt;key&gt;CFBundleGetInfoString&lt;/key&gt;[\r\n \t]+&lt;string&gt;)[^&lt;]+(&lt;/string&gt;)"
+ replace="\1GoIde 1.0.0, build 0.4.2\2"
+ />
+
+ <replaceregexp
+ file="${idea.community.build}/Contents/Info.plist"
+ byline="false"
+ match="(&lt;key&gt;CFBundleShortVersionString&lt;/key&gt;[\r\n \t]+&lt;string&gt;)[^&lt;]+(&lt;/string&gt;)"
+ replace="\11.0.0\2"
+ />
+
+ <replaceregexp
+ file="${idea.community.build}/Contents/Info.plist"
+ byline="false"
+ match="(&lt;key&gt;CFBundleVersion&lt;/key&gt;[\r\n \t]+&lt;string&gt;)[^&lt;]+(&lt;/string&gt;)"
+ replace="\11.0.0 (0.4.2)\2"
+ />
+ </target>
+
+ <target name="assemble" depends="clean,init,resources,fix.Info.plist" description="compile the source">
<concat destfile="${work}/idea.properties" force="true">
<fileset dir="${idea.community.build}/bin" includes="idea.properties"/>
View
@@ -24,7 +24,7 @@ RELEASE_TAG_IDEA=${RELEASE_TAG_IDEA:-idea/108.857}
GO_IDE_VERSION=${GO_IDE_VERSION:-1.0.0}
-FOLDER_DIST=${FOLDER_DIST:-$SOURCE_PATH_GO_PLUGIN/dist}
+FOLDER_DIST=${FOLDER_DIST:-${SOURCE_PATH_GO_PLUGIN}/dist}
# linux | darwin | windows
TARGET_HOST=${TARGET_HOST:-linux}
@@ -43,8 +43,8 @@ function validate_go_sdk_location {
pushd "${SOURCE_PATH_GO}" >/dev/null
ACTUAL_RELEASE_TAG_GO=`hg identify -t`
- if [ "release $RELEASE_TAG_GO" != "$ACTUAL_RELEASE_TAG_GO" ]; then
- echo "Error: Go Source code is at the wrong tag: $ACTUAL_RELEASE_TAG_GO."
+ if [ "release ${RELEASE_TAG_GO}" != "${ACTUAL_RELEASE_TAG_GO}" ]; then
+ echo "Error: Go Source code is at the wrong tag: ${ACTUAL_RELEASE_TAG_GO}."
echo -e " Try this:"
echo -e "\tpushd '${SOURCE_PATH_GO}' && hg pull && hg update --clean ${RELEASE_TAG_GO} && popd"
exit 1
@@ -56,27 +56,27 @@ function validate_go_sdk_location {
function validate_idea_community_location() {
- if [ ! -d "$SOURCE_PATH_IDEA" ]; then
- echo "Error: '$SOURCE_PATH_IDEA' is not a folder"
+ if [ ! -d "${SOURCE_PATH_IDEA}" ]; then
+ echo "Error: '${SOURCE_PATH_IDEA}' is not a folder"
exit 1
fi
- if [ ! -d "$SOURCE_PATH_IDEA/.git" ]; then
- echo "Error: '$SOURCE_PATH_IDEA' is not a idea checkout folder (is missing Git metadata)"
+ if [ ! -d "${SOURCE_PATH_IDEA}/.git" ]; then
+ echo "Error: '${SOURCE_PATH_IDEA}' is not a idea checkout folder (is missing Git metadata)"
exit 1
fi
- pushd "$SOURCE_PATH_IDEA" >/dev/null
+ pushd "${SOURCE_PATH_IDEA}" >/dev/null
ACTUAL_RELEASE_TAG_IDEA=`git describe`
- if [ "$RELEASE_TAG_IDEA" != "$ACTUAL_RELEASE_TAG_IDEA" ]; then
- echo "Error: Intellij Idea Community source tree is at the wrong tag: $ACTUAL_RELEASE_TAG_IDEA"
+ if [ "${RELEASE_TAG_IDEA}" != "${ACTUAL_RELEASE_TAG_IDEA}" ]; then
+ echo "Error: Intellij Idea Community source tree is at the wrong tag: ${ACTUAL_RELEASE_TAG_IDEA}"
echo -e " Try this:"
- echo -e "\tpushd '$SOURCE_PATH_IDEA' && git pull && git checkout $RELEASE_TAG_IDEA && popd"
+ echo -e "\tpushd '${SOURCE_PATH_IDEA}' && git pull && git checkout ${RELEASE_TAG_IDEA} && popd"
echo
exit 1
fi
- echo "GOOD: Intellij Idea Community source tree is at the proper release ('$RELEASE_TAG_IDEA' vs '$ACTUAL_RELEASE_TAG_IDEA')"
+ echo "GOOD: Intellij Idea Community source tree is at the proper release ('${RELEASE_TAG_IDEA}' vs '${ACTUAL_RELEASE_TAG_IDEA}')"
popd >/dev/null
}
@@ -86,18 +86,18 @@ function build_go_sdk() {
echo "Clean building Go Sdk"
echo
- pushd "$SOURCE_PATH_GO/src" >/dev/null
+ pushd "${SOURCE_PATH_GO}/src" >/dev/null
./clean.bash
- rm -rf "$SOURCE_PATH_GO"/{pkg,bin}/*
+ rm -rf "${SOURCE_PATH_GO}"/pkg/* "${SOURCE_PATH_GO}"/bin/*
GOHOSTARCH=$1 ./all.bash
popd >/dev/null
- rm -rf "$FOLDER_DIST/go-sdk-${TARGET_HOST}_$1"
- mkdir -p "$FOLDER_DIST/go-sdk-${TARGET_HOST}_$1"
+ rm -rf "${FOLDER_DIST}/go-sdk-${TARGET_HOST}_$1"
+ mkdir -p "${FOLDER_DIST}/go-sdk-${TARGET_HOST}_$1"
- cp -r "$SOURCE_PATH_GO"/{bin,src,pkg,doc,include} "$FOLDER_DIST/go-sdk-${TARGET_HOST}_$1"
- cp -r "$SOURCE_PATH_GO"/{AUTHORS,CONTRIBUTORS,LICENSE,PATENTS,README,robots.txt,favicon.ico} "$FOLDER_DIST/go-sdk-${TARGET_HOST}_$1"
+ cp -r "${SOURCE_PATH_GO}"/{bin,src,pkg,doc,include} "${FOLDER_DIST}/go-sdk-${TARGET_HOST}_$1"
+ cp -r "${SOURCE_PATH_GO}"/{AUTHORS,CONTRIBUTORS,LICENSE,PATENTS,README,robots.txt,favicon.ico} "${FOLDER_DIST}/go-sdk-${TARGET_HOST}_$1"
}
function unpack_go_sdk_windows() {
@@ -109,10 +109,10 @@ function unpack_go_sdk_windows() {
# SOURCE_PATH_GO_WIN
- rm -rf "$FOLDER_DIST/go-sdk-${TARGET_HOST}_386"
- mkdir -p "$FOLDER_DIST/go-sdk-${TARGET_HOST}_386"
- pushd "$FOLDER_DIST/go-sdk-${TARGET_HOST}_386" > /dev/null
- unzip "$SOURCE_PATH_GO_WIN"
+ rm -rf "${FOLDER_DIST}/go-sdk-${TARGET_HOST}_386"
+ mkdir -p "${FOLDER_DIST}/go-sdk-${TARGET_HOST}_386"
+ pushd "${FOLDER_DIST}/go-sdk-${TARGET_HOST}_386" > /dev/null
+ unzip "${SOURCE_PATH_GO_WIN}"
mv go/{bin,pkg,src,doc,include} .
mv go/{AUTHORS,CONTRIBUTORS,LICENSE,PATENTS,README,robots.txt,favicon.ico} .
@@ -138,107 +138,64 @@ function build_idea_go_plugin() {
echo
echo "Cleanly building Idea Go plugin"
echo
- pushd "$SOURCE_PATH_GO_PLUGIN" >/dev/null
+ pushd "${SOURCE_PATH_GO_PLUGIN}" >/dev/null
# the default build target in Intellij Community will do a clean,build
- ant -Didea.community.build=$SOURCE_PATH_IDEA_BUILT -f build-package.xml
+ ant -Didea.community.build=${SOURCE_PATH_IDEA_BUILT} -f build-package.xml
popd
}
-#function getIdeaPackageFileNameSuffixForOS()
-#{
-# if [ "$1" == "linux" ]; then
-# ideaFileNameSuffix=".tar.gz"
-# elif [ "$1" == "mac" ]; then
-# ideaFileNameSuffix=".mac.zip"
-# elif [ "$1" == "windows" ]; then
-# ideaFileNameSuffix=".win.zip"
-# fi
-#}
-#
-#function decompressBuild()
-#{
-# if [ "$1" == "linux" ]; then
-# tar -xzvf $2
-# elif [ "$1" == "mac" ]; then
-# unzip -f $2
-# elif [ "$1" == "windows" ]; then
-# unzip $2
-# fi
-#}
-#
-#function decompressBuild()
-#{
-# if [ "$1" == "linux" ]; then
-# tar -xzvf $2
-# elif [ "$1" == "mac" ]; then
-# unzip -f $2
-# elif [ "$1" == "windows" ]; then
-# unzip $2 -d idea-IC-win
-# fi
-#}
-#
-#function getSourcePathIdeaBuilt()
-#{
-# if [ "$1" == "linux" ]; then
-# sourcePathIdeaBuilt=$FOLDER_DIST/idea-IC-$IDEA_BUILD_VERSION
-# elif [ "$1" == "mac" ]; then
-# sourcePathIdeaBuilt=$FOLDER_DIST/IntelliJ\ IDEA\ 10\ CE.app
-# elif [ "$1" == "windows" ]; then
-# sourcePathIdeaBuilt=$FOLDER_DIST/idea-IC-win
-# fi
-#}
-
function extract_idea_community_build() {
- IDEA_BUILD_VERSION=`cat "$SOURCE_PATH_IDEA/build.txt"`
+ IDEA_BUILD_VERSION=`cat "${SOURCE_PATH_IDEA}/build.txt"`
- SOURCE_PATH_IDEA_BUILT=$FOLDER_DIST/idea-IC-$IDEA_BUILD_VERSION-$TARGET_HOST
+ SOURCE_PATH_IDEA_BUILT=${FOLDER_DIST}/idea-IC-${IDEA_BUILD_VERSION}-${TARGET_HOST}
- if [ -d "$SOURCE_PATH_IDEA_BUILT" ]; then
- rm -rf "$SOURCE_PATH_IDEA_BUILT"
+ if [ -d "${SOURCE_PATH_IDEA_BUILT}" ]; then
+ rm -rf "${SOURCE_PATH_IDEA_BUILT}"
fi
- pushd "$FOLDER_DIST" >/dev/null
- if [ "$TARGET_HOST" == "linux" ]; then
+ pushd "${FOLDER_DIST}" >/dev/null
+ if [ "${TARGET_HOST}" == "linux" ]; then
- if [ -d "$FOLDER_DIST/idea-IC-$IDEA_BUILD_VERSION" ]; then
- rm -rf "$FOLDER_DIST/idea-IC-$IDEA_BUILD_VERSION"
+ if [ -d "${FOLDER_DIST}/idea-IC-${IDEA_BUILD_VERSION}" ]; then
+ rm -rf "${FOLDER_DIST}/idea-IC-${IDEA_BUILD_VERSION}"
fi
- tar -xzvf $SOURCE_PATH_IDEA/out/artifacts/ideaIC-$IDEA_BUILD_VERSION.tar.gz
- mv $FOLDER_DIST/idea-IC-$IDEA_BUILD_VERSION $FOLDER_DIST/idea-IC-$IDEA_BUILD_VERSION-linux
- elif [ "$TARGET_HOST" == "darwin" ]; then
+ tar -xzvf ${SOURCE_PATH_IDEA}/out/artifacts/ideaIC-${IDEA_BUILD_VERSION}.tar.gz
+ mv ${FOLDER_DIST}/idea-IC-${IDEA_BUILD_VERSION} ${FOLDER_DIST}/idea-IC-${IDEA_BUILD_VERSION}-linux
+ elif [ "${TARGET_HOST}" == "darwin" ]; then
- if [ -d "$FOLDER_DIST/Community Edition-IC-$IDEA_BUILD_VERSION.app" ]; then
- rm -rf "$FOLDER_DIST/Community Edition-IC-$IDEA_BUILD_VERSION.app"
+ if [ -d "${FOLDER_DIST}/Community Edition-IC-${IDEA_BUILD_VERSION}.app" ]; then
+ rm -rf "${FOLDER_DIST}/Community Edition-IC-${IDEA_BUILD_VERSION}.app"
fi
- unzip "$SOURCE_PATH_IDEA/out/artifacts/ideaIC-$IDEA_BUILD_VERSION.mac.zip"
- mv "$FOLDER_DIST/Community Edition-IC-$IDEA_BUILD_VERSION.app" "$SOURCE_PATH_IDEA_BUILT"
- elif [ "$TARGET_HOST" == "windows" ]; then
- mkdir $SOURCE_PATH_IDEA_BUILT
- pushd $SOURCE_PATH_IDEA_BUILT >/dev/null
- unzip $SOURCE_PATH_IDEA/out/artifacts/ideaIC-$IDEA_BUILD_VERSION.win.zip
+ unzip "${SOURCE_PATH_IDEA}/out/artifacts/ideaIC-${IDEA_BUILD_VERSION}.mac.zip"
+ mv "${FOLDER_DIST}/Community Edition-IC-${IDEA_BUILD_VERSION}.app" "${SOURCE_PATH_IDEA_BUILT}"
+ elif [ "${TARGET_HOST}" == "windows" ]; then
+ mkdir ${SOURCE_PATH_IDEA_BUILT}
+ pushd ${SOURCE_PATH_IDEA_BUILT} >/dev/null
+ unzip ${SOURCE_PATH_IDEA}/out/artifacts/ideaIC-${IDEA_BUILD_VERSION}.win.zip
popd >/dev/null
fi
popd >/dev/null
- echo $SOURCE_PATH_IDEA_BUILT
+ echo ${SOURCE_PATH_IDEA_BUILT}
}
function assemble_distribution() {
echo
echo
echo "Assembling distribution for arch $1"
echo
- pushd "$SOURCE_PATH_GO_PLUGIN" >/dev/null
+ pushd "${SOURCE_PATH_GO_PLUGIN}" >/dev/null
ant \
- -Dgo.ide.target.package=$SOURCE_PATH_GO_PLUGIN/dist/goide-${TARGET_HOST}_$1.zip \
- -Didea.community.build=$SOURCE_PATH_IDEA_BUILT \
- -Dgo.sdk.build=$SOURCE_PATH_GO_PLUGIN/dist/go-sdk-${TARGET_HOST}_$1 \
- -Dgo.plugin=$SOURCE_PATH_GO_PLUGIN/dist/ro.redeul.google.go.jar \
+ -Dgo.ide.target.package=${SOURCE_PATH_GO_PLUGIN}/dist/goide-${TARGET_HOST}_$1.zip \
+ -Didea.community.build=${SOURCE_PATH_IDEA_BUILT} \
+ -Dtarget.platform=${TARGET_HOST} \
+ -Dgo.sdk.build=${SOURCE_PATH_GO_PLUGIN}/dist/go-sdk-${TARGET_HOST}_$1 \
+ -Dgo.plugin=${SOURCE_PATH_GO_PLUGIN}/dist/ro.redeul.google.go.jar \
-f build-distribution.xml
popd > /dev/null
@@ -250,23 +207,23 @@ set -eo pipefail
validate_go_sdk_location
validate_idea_community_location
-if [ "$SKIP_GO_SDK_BUILD" != "true" ]; then
+if [ "${SKIP_GO_SDK_BUILD}" != "true" ]; then
build_go_sdk 386
build_go_sdk amd64
fi
-if [ "$SKIP_IDEA_BUILD" != "true" ]; then
+if [ "${SKIP_IDEA_BUILD}" != "true" ]; then
build_idea_community
fi
-if [ "$TARGET_HOST" == "windows" ]; then
+if [ "${TARGET_HOST}" == "windows" ]; then
unpack_go_sdk_windows
fi
extract_idea_community_build
build_idea_go_plugin
assemble_distribution 386
-if [ "$TARGET_HOST" != "windows" ]; then
+if [ "${TARGET_HOST}" != "windows" ]; then
assemble_distribution amd64
fi
@@ -3,7 +3,7 @@
# Author: Alexandre Normand (https://github.com/alexandre-normand)
# Date: July 30th, 2011
#
-# Many variables (including source paths) can/must be overriden.
+# Many variables (including source paths) can/must be overriden.
# Refer to package.sh for the list
SOURCE_PATH_GO_PLUGIN=${SOURCE_PATH_GO_PLUGIN:-`pwd`/..}
@@ -12,14 +12,13 @@ TARGET_HOST=darwin ./package.sh
function createDmg()
{
echo
- echo "Creating dmg image from $SOURCE_PATH_GO_PLUGIN/dist/darwin_$1"
+ echo "Creating dmg image from ${SOURCE_PATH_GO_PLUGIN}/dist/darwin_$1"
echo
- rm -r $SOURCE_PATH_GO_PLUGIN/dist/darwin_$1
- unzip -o $SOURCE_PATH_GO_PLUGIN/dist/goide-darwin_$1.zip -d $SOURCE_PATH_GO_PLUGIN/dist/darwin_$1
- mv -f "$SOURCE_PATH_GO_PLUGIN/dist/darwin_$1/go-ide" "$SOURCE_PATH_GO_PLUGIN/dist/darwin_$1/Go Ide.app"
- IMAGE_FILE=$SOURCE_PATH_GO_PLUGIN/dist/goide_$1.dmg
- SRC_FOLDER="$SOURCE_PATH_GO_PLUGIN/dist/darwin_$1" IMAGE_FILE=$SOURCE_PATH_GO_PLUGIN/dist/goide_$1.dmg ./make_dmg.sh
+ rm -r ${SOURCE_PATH_GO_PLUGIN}/dist/darwin_$1
+ unzip -o ${SOURCE_PATH_GO_PLUGIN}/dist/goide-darwin_$1.zip -d ${SOURCE_PATH_GO_PLUGIN}/dist/darwin_$1
+ mv -f "${SOURCE_PATH_GO_PLUGIN}/dist/darwin_$1/go-ide" "${SOURCE_PATH_GO_PLUGIN}/dist/darwin_$1/Go Ide.app"
+ SRC_FOLDER="${SOURCE_PATH_GO_PLUGIN}/dist/darwin_$1" IMAGE_FILE=${SOURCE_PATH_GO_PLUGIN}/dist/goide_$1.dmg ./make_dmg.sh
}
createDmg 386

0 comments on commit c90d1be

Please sign in to comment.