From 4c200a1199643a806bb62d5ed27676c4061b8f05 Mon Sep 17 00:00:00 2001 From: hyocheol ahn Date: Sat, 5 Sep 2015 13:56:01 +0900 Subject: [PATCH] MISC: Added ant script for package build Change-Id: I8af1a6cdb5b9d747cdc2ac891caa1064e584fa57 Signed-off-by: hyocheol ahn --- script/ant-build.xml | 278 ++++++++++++++++++++++++++++++++++++++++++++++++ script/ant-clean.xml | 41 ++++++++ script/ant-install.xml | 106 +++++++++++++++++++ script/build.sh | 279 +++---------------------------------------------- script/clean.sh | 20 +++- script/install.sh | 58 ++-------- 6 files changed, 459 insertions(+), 323 deletions(-) create mode 100644 script/ant-build.xml create mode 100644 script/ant-clean.xml create mode 100644 script/ant-install.xml diff --git a/script/ant-build.xml b/script/ant-build.xml new file mode 100644 index 0000000..63e7970 --- /dev/null +++ b/script/ant-build.xml @@ -0,0 +1,278 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IDE ANT Update Site: ${update.plugin.path} exist... + + + + + + + + + + + + + + + + IDE ANT Update Site: ${update.plugin.path} exist... + + + + + + + + + + + + + + + + IDE ANT - builder.path : ${builder.path} + IDE ANT - parent.path.of.based.eclipse : ${parent.path.of.based.eclipse} + + + + + IDE ANT - Make build.properties file... + + + + + + + + + + + + + IDE ANT - ${reference.ide.path} exist... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IDE ANT - ${about.mapping.path} exist... + + + + + + + IDE ANT - ${about.mapping.path} not exist... + + + + + + + + + + + + + + + + + + + + + + + + IDE ANT - unzip to ${build.result.path} + + + + + + + diff --git a/script/ant-clean.xml b/script/ant-clean.xml new file mode 100644 index 0000000..b9b37d7 --- /dev/null +++ b/script/ant-clean.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + IDE ANT - Clena : ${SRCDIR} : ${SRCDIR}/build_result : ${SRCDIR}/package/${package.name}.package.${BUILD_TARGET_OS} + + + + + + + + + + + + + \ No newline at end of file diff --git a/script/ant-install.xml b/script/ant-install.xml new file mode 100644 index 0000000..cd5e1a4 --- /dev/null +++ b/script/ant-install.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${build.result.path}/${archive.platform.name}.${windowing}.${architecture}/${package.name}/ + + + + + ${install.ide.path} is completed + + + + + \ No newline at end of file diff --git a/script/build.sh b/script/build.sh index afe3c9e..8508db2 100755 --- a/script/build.sh +++ b/script/build.sh @@ -1,277 +1,22 @@ #!/bin/bash -xe -build_path=${SRCDIR}/build_result -package_name=$1 +PACKAGE_NAME=$1 pde_name=$2 - -__set_parameter() -{ - build_id=${package_name} - build_type=N - build_result_directory=${build_type}.${build_id} - build_result_path="$build_path/$build_result_directory" - ide_root_path_name=ide - - case ${TARGET_OS} in - ubuntu-32) - archive_platform_name=linux - windowing=gtk - architecture=x86 - if [ ! "x${pde_name}" = "x" ] - then - ide_root_path_name=eclipse-pde/eclipse - fi - ;; - windows-32) - archive_platform_name=win32 - windowing=win32 - architecture=x86 - if [ ! "x${pde_name}" = "x" ] - then - ide_root_path_name=eclipse-pde/eclipse - fi - ;; - ubuntu-64) - archive_platform_name=linux - windowing=gtk - architecture=x86_64 - if [ ! "x${pde_name}" = "x" ] - then - ide_root_path_name=eclipse-pde/eclipse - fi - ;; - windows-64) - archive_platform_name=win32 - windowing=win32 - architecture=x86_64 - if [ ! "x${pde_name}" = "x" ] - then - ide_root_path_name=eclipse-pde/eclipse - fi - ;; - macos-64) - archive_platform_name=macosx - windowing=cocoa - architecture=x86_64 - if [ ! "x${pde_name}" = "x" ] - then - ide_root_path_name=eclipse-pde/eclipse - fi - ;; - *) - echo "${TARGET_OS} is not support yet." - ;; - esac - - result_archive_file=${build_id}-${archive_platform_name}.${windowing}.${architecture}.zip -} - -__set_build_parameter() -{ - build_script_path=${ROOTDIR}/pde-build - reference_ide_path=${ROOTDIR}/${ide_root_path_name} -} - -__clean_build_environment() -{ - if [ -d $build_path ] - then - echo "Build result directory : [$build_path]" - else - echo "Make build result directory [$build_path]" - mkdir -p $build_path - fi - - echo "Remove legacy build files..." - if [ -d ${build_result_path}/${archive_platform_name}.${windowing}.${architecture} ] - then - rm -rf ${build_result_path}/${archive_platform_name}.${windowing}.${architecture} - fi - if [ -e ${build_result_path}/${result_archive_file} ] - then - rm -rf ${build_result_path}/${result_archive_file} - fi - if [ -d ${build_path}/tmp ] - then - rm -rf ${build_path}/tmp - fi - - if [ -d ${build_path}/buildRepo ] - then - rm -rf ${build_path}/buildRepo - fi - - rm -rf ${build_path}/*.xml - rm -rf ${build_path}/*.properties - rm -rf ${build_path}/*.clean - - - if [ -d $build_path/plugins ] - then - echo "plugins directory recreate..." - rm -rf $build_path/plugins - mkdir $build_path/plugins - else - echo "Make plugins directory..." - mkdir $build_path/plugins - fi - if [ -d $build_path/features/ ] - then - echo "features directory recreate..." - rm -rf $build_path/features - mkdir $build_path/features - else - echo "Make features directory..." - mkdir $build_path/features - fi - -} - -__copy_build_sources() -{ - echo "Copy features from $SRCDIR to $build_path/features" - temp_dir="`mktemp -d /tmp/ide.XXXXX`" - cp -r $SRCDIR/* $temp_dir - cp -r $temp_dir/* $build_path/features - rm -rf $temp_dir - - echo "Copy plugins from $SRCDIR to $build_path/plugins" - temp_dir="`mktemp -d /tmp/ide.XXXXX`" - cp -r $SRCDIR/* $temp_dir - cp -r $temp_dir/* $build_path/plugins - rm -rf $temp_dir -} - -__copy_dependency_plugins() +echo "TARGET_OS : ${TARGET_OS}...." +echo "ROOTDIR : ${ROOTDIR}..." +echo "SRCDIR : ${SRCDIR}..." +build_plugins() { - dependency_plugin_path=${ROOTDIR}/${ide_root_path_name} - - equinox_launcher=`echo org.eclipse.equinox.launcher_*.jar` - - ## check base-native-ide-product p2 install - update_plugin_path=${ROOTDIR}/ide/updatablenative - if [ -d ${update_plugin_path} ] - then - ## install native feature by p2 for install script failure on the cross build - java -jar ${reference_ide_path}/plugins/$equinox_launcher \ - -application org.eclipse.equinox.p2.director \ - -repository "file:/${update_plugin_path}" \ - -installIU org.tizen.base.native.feature.feature.group \ - -noSplash \ - -p2.os ${archive_platform_name} \ - -p2.ws ${windowing} \ - -p2.arch ${architecture} - rm -rf ${update_plugin_path} - fi - ## check base-web-ide-product p2 install - update_plugin_path=${ROOTDIR}/ide/updatableweb - if [ -d ${update_plugin_path} ] - then - ## install web feature by p2 for install script failure on the cross build - java -jar ${reference_ide_path}/plugins/$equinox_launcher \ - -application org.eclipse.equinox.p2.director \ - -repository "file:/${update_plugin_path}" \ - -installIU org.tizen.base.web.feature.feature.group \ - -noSplash \ - -p2.os ${archive_platform_name} \ - -p2.ws ${windowing} \ - -p2.arch ${architecture} - rm -rf ${update_plugin_path} - fi - -} - -__make_ant_build_properties_file() -{ - builder_path="${SRCDIR}/builder" - parent_path_of_based_eclipse=${reference_ide_path}/.. - - echo "Make build.properties file..." - if [ ! -e $builder_path/build.properties.clean ] ; then - echo "ERROR : \"build.properties.clean\" file does not exist..." - exit 1 - fi - cp $builder_path/build.properties.clean $build_path - cp ${build_script_path}/customTargets.xml $build_path - - if [ -d $reference_ide_path ] - then - sed -e "s;\(^buildDirectory=\).*;\1${build_path};g" \ - -e "s;\(^base=\).*;\1${parent_path_of_based_eclipse};g" \ - -e "s;\(^baseLocation=\).*;\1${reference_ide_path};g" \ - -e "s;\(^configs=\).*;\1${archive_platform_name},${windowing},${architecture};g" \ - -e "s;\(^buildType=\).*;\1${build_type};g" \ - -e "s;\(^buildId=\).*;\1${build_id};g" \ - -e "s;\(^archivePrefix=\).*;\1${build_id};g" \ - < $build_path/build.properties.clean > $build_path/build.properties - - else - echo "ERROR : target eclipse is not exist." - exit 1 - fi -} - -__execute_pde_build() -{ - echo "Execute Product Ant Builder..." - equinox_launcher=`echo org.eclipse.equinox.launcher_*.jar` - pde_build=`echo org.eclipse.pde.build_*` - - java -server -XX:+UseParNewGC -Xmx256m -jar ${reference_ide_path}/plugins/$equinox_launcher -application org.eclipse.ant.core.antRunner -buildfile ${reference_ide_path}/plugins/$pde_build/scripts/productBuild/productBuild.xml -Dbuilder=$build_path -Dosgi.locking=none 2>&1 - - if [ $? != 0 ]; - then - echo "Build failed..." - exit 1 - fi -} - -__unzip_plugin_pack() -{ - echo "unzip to $build_result_path" - unzip -a $build_result_path/${result_archive_file} -d $build_result_path/${archive_platform_name}.${windowing}.${architecture} -} + echo "=============================================================================================" + echo "IDE ANT - Ant build for package" + ant -f ${ROOTDIR}/pde-build/ant-build.xml -DROOTDIR=${ROOTDIR} -DSRCDIR=${SRCDIR} -DPACKAGE_NAME=${PACKAGE_NAME} -DTARGET_OS=${TARGET_OS} + echo "Ant completed." + echo "=============================================================================================" -__modify_about_mappings_file() -{ - branding_plugin=`grep "topLevelElementId=" ${build_path}/build.properties | cut -f2 -d"="` - branding_path=`grep "plugin=" ${build_path}/features/${branding_plugin}/feature.xml -m1 | cut -f2 -d"\""` - about_mapping_path="${build_path}/plugins/${branding_path}/about.mappings" - - if [ -d ${build_path}/plugins/${branding_path} -a -e ${about_mapping_path} ] - then - build_time=`date +%Y%m%d-%H%M` - about_build_time_parameter="1" - sed -e "s;\(^${about_build_time_parameter}=\).*;\1${build_time};g" \ - < ${about_mapping_path} > ${about_mapping_path}.mod - mv ${about_mapping_path}.mod ${about_mapping_path} - fi + echo "IDE ANT - Build SUCCESS. You will find SDK IDE in \"${PACKAGE_NAME}\"." } -build_plugins() -{ - case ${TARGET_OS} in - ubuntu-32|ubuntu-64|windows-32|windows-64|macos-64) - echo "build plugin for ${TARGET_OS}" - ;; - *) - echo "${TARGET_OS} is not support yet." - exit 1 - ;; - esac - - __set_parameter - __set_build_parameter - __clean_build_environment - __copy_build_sources - __copy_dependency_plugins - __make_ant_build_properties_file - __modify_about_mappings_file - __execute_pde_build - __unzip_plugin_pack +build_plugins - echo "Build SUCCESS. You will find SDK IDE in \"${build_result_path}\"." -} -build_plugins diff --git a/script/clean.sh b/script/clean.sh index 6cf9762..44fa458 100755 --- a/script/clean.sh +++ b/script/clean.sh @@ -1,8 +1,18 @@ #!/bin/bash -xe -package_name=$1 +PACKAGE_NAME=$1 + +clean_plugins() +{ + + echo "=============================================================================================" + echo "IDE ANT - Ant Clean Script for package" + ant -f ${ROOTDIR}/pde-build/ant-clean.xml -DROOTDIR=${ROOTDIR} -DSRCDIR=${SRCDIR} -DPACKAGE_NAME=${PACKAGE_NAME} -DBUILD_TARGET_OS=${BUILD_TARGET_OS} + echo "Ant completed." + echo "=============================================================================================" + + echo "IDE ANT - Clean SUCCESS. You will find SDK IDE in \"${PACKAGE_NAME}\"." +} + +clean_plugins -rm -rf ${SRCDIR}/*.zip -rm -rf ${SRCDIR}/*.tar.gz -rm -rf ${SRCDIR}/build_result -rm -rf ${SRCDIR}/${package_name}.package.${BUILD_TARGET_OS} diff --git a/script/install.sh b/script/install.sh index 26fcd66..1aa1cdc 100755 --- a/script/install.sh +++ b/script/install.sh @@ -1,61 +1,17 @@ #!/bin/bash -xe -build_path=${SRCDIR}/build_result -package_name=$1 - -__set_parameter() -{ - build_id=${package_name} - build_type=N - build_result_directory=${build_type}.${build_id} - build_result_path="$build_path/$build_result_directory" - ide_root_path_name=ide - INSTALL_DIR=${SRCDIR}/package/${package_name}.package.${TARGET_OS}/data - - case ${TARGET_OS} in - ubuntu-32) - archive_platform_name=linux - windowing=gtk - architecture=x86 - ;; - windows-32) - archive_platform_name=win32 - windowing=win32 - architecture=x86 - ;; - ubuntu-64) - archive_platform_name=linux - windowing=gtk - architecture=x86_64 - ;; - windows-64) - archive_platform_name=win32 - windowing=win32 - architecture=x86_64 - ;; - macos-64) - archive_platform_name=macosx - windowing=cocoa - architecture=x86_64 - ;; - *) - echo "${TARGET_OS} is not support yet." - ;; - esac -} +PACKAGE_NAME=$1 packaging_plugins() { - __set_parameter - install_ide_path=${INSTALL_DIR}/${ide_root_path_name} - if [ ! -d ${install_ide_path} ] - then - mkdir -p ${install_ide_path} - fi + echo "=============================================================================================" + echo "IDE ANT - Ant Install for package" + ant -f ${ROOTDIR}/pde-build/ant-install.xml -DROOTDIR=${ROOTDIR} -DSRCDIR=${SRCDIR} -DPACKAGE_NAME=${PACKAGE_NAME} -DTARGET_OS=${TARGET_OS} + echo "Ant completed." + echo "=============================================================================================" - cp -rf ${build_result_path}/${archive_platform_name}.${windowing}.${architecture}/${package_name}/* ${install_ide_path}/ - touch ${install_ide_path}/init + echo "IDE ANT - Install SUCCESS. You will find SDK IDE in \"${PACKAGE_NAME}\"." } packaging_plugins -- 2.7.4