Skip to content

Commit

Permalink
Keep old file names of plugin and add new platforms in build.sh
Browse files Browse the repository at this point in the history
JIRA:LMCROSSITXSADEPLOY-1397 Integrate MTA CLI plugin in CF community
plugin repo
  • Loading branch information
theghost5800 committed Apr 24, 2019
1 parent 0bfe677 commit 125d296
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 20 deletions.
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ mta-op-*/
.DS_Store
*/.DS_Store
.idea
multiapps_plugin_darwin_amd64
multiapps_plugin_linux_amd64
multiapps_plugin_windows_amd64.exe
mta_plugin_darwin_amd64
mta_plugin_linux_amd64
mta_plugin_windows_amd64.exe
multiapps-plugin.win32
multiapps-plugin.win64
multiapps-plugin.linux32
multiapps-plugin.linux64
multiapps-plugin.osx
45 changes: 28 additions & 17 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,40 @@ function build() {
local version=$1
local platform=$2
local arch=$3
local plugin_name=$4

echo calling to build for $platform $arch
GOOS=$platform GOARCH=$arch go build \
-ldflags "-X main.Version=${version}" \
-o multiapps_plugin_${platform}_${arch}
-o ${plugin_name}
}

function main() {
if [[ $# -ne 1 ]]; then
echo "usage: ${0} <version>"
exit 1
fi
local version=$1
local platforms="linux darwin windows"
for platform in $platforms; do
echo calling to build for $platform
build $version $platform "amd64"
#Make windows binary executable
if [[ $platform == "windows" ]] ; then
mv multiapps_plugin_${platform}_amd64 multiapps_plugin_${platform}_amd64.exe
fi
done
function copyPluginsWithOldNames() {
cp $PLUGIN_NAME_WIN_64 $OLD_PLUGIN_NAME_WIN_64
cp $PLUGIN_NAME_LINUX_64 $OLD_PLUGIN_NAME_LINUX_64
cp $PLUGIN_NAME_OSX $OLD_PLUGIN_NAME_OSX
}

script_dir="$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")"
cd "${script_dir}"
main "$@"
PLUGIN_NAME_WIN_32=multiapps-plugin.win32
PLUGIN_NAME_WIN_64=multiapps-plugin.win64
PLUGIN_NAME_LINUX_32=multiapps-plugin.linux32
PLUGIN_NAME_LINUX_64=multiapps-plugin.linux64
PLUGIN_NAME_OSX=multiapps-plugin.osx
OLD_PLUGIN_NAME_WIN_64=mta_plugin_windows_amd64.exe
OLD_PLUGIN_NAME_LINUX_64=mta_plugin_linux_amd64
OLD_PLUGIN_NAME_OSX=mta_plugin_darwin_amd64

if [[ $# -ne 1 ]]; then
echo "usage: ${0} <version>"
exit 1
fi
version=$1
build $version linux 386 $PLUGIN_NAME_LINUX_32
build $version linux amd64 $PLUGIN_NAME_LINUX_64
build $version windows 386 $PLUGIN_NAME_WIN_32
build $version windows amd64 $PLUGIN_NAME_WIN_64
build $version darwin amd64 $PLUGIN_NAME_OSX

copyPluginsWithOldNames

0 comments on commit 125d296

Please sign in to comment.