summaryrefslogtreecommitdiff
path: root/build.sh
blob: 445cf24f8aaa2d83cbdf057a8441c6c4dcd42d0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#!/bin/bash
start_path=`pwd`

###############################################################
##
## Please modify parameter value.
##
###############################################################
build_type=N
build_id=dynamicanalyzeride_build
build_path="`pwd`/../build_result"

###############################################################
##
## Do not touch here.
##
###############################################################
build_result_directory=${build_type}.${build_id}
build_result_path="$build_path/$build_result_directory"
builder_path="$start_path/builder"
equinox_launcher=`echo org.eclipse.equinox.launcher_*.jar`
## check base-native-ide-produce 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
pde_build=`echo org.eclipse.pde.build_*`
metadata_path=$start_path/builder
fresh_ide_path=$3

if [ "x$1" = "x" ]
then
	echo "
Usage : build.sh PLATFORM_NAME TARGET_ECLIPSE_PATH

   PLATFORM_NAME		You can set \"linux\" or \"windows\"
   TARGET_ECLIPSE_PATH		Set target eclipse path.
				For example, $HOME/git/fresh-ide-pde
"
	exit 1
fi

if [ "x$2" = "x" ]
then
	echo "
Usage : build.sh $1 TARGET_ECLIPSE_PATH
   TARGET_ECLIPSE_PATH	Set target eclipse path.
			For example, $HOME/git/fresh-ide-pde
"
	exit 1
fi

#if [ "x$3" != "x" ]
#then
#	build_path=$3
#fi

platform=$1
based_eclipse_path=$2
parent_path_of_based_eclipse=${based_eclipse_path}/..
architecture=x86

case ${platform} in
	linux)
		archive_platform_name=linux
		windowing=gtk
		;;
	windows)
		archive_platform_name=win32
		windowing=win32
		;;
	*)
		echo "${platform} is not support yet."
		exit 1
		;;
esac

result_archive_file=${build_id}-${archive_platform_name}.${windowing}.${architecture}.zip

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/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

echo "Copy features from $start_path to $build_path/features"
cp -r $start_path/*.feature $build_path/features

echo "Copy plugins from $start_path to $build_path/plugins"
cp -r $start_path/* $build_path/plugins
rm -rf $build_path/plugins/*.feature

echo "Copy fresh ide plugins..."
if [ -d ${fresh_ide_path} ]
then
	cp -rf ${fresh_ide_path}/${archive_platform_name}.${windowing}.${architecture}/IDE/plugins/* ${build_path}/plugins
	cp -rf ${fresh_ide_path}/${archive_platform_name}.${windowing}.${architecture}/IDE/features/* ${build_path}/features
else
	echo "ERROR : Fresh IDE does not exist..."
	exit 1
fi

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 $builder_path/customTargets.xml $build_path

if [ -d $based_eclipse_path ] 
then
	sed -e "s;\(^buildDirectory=\).*;\1${build_path};g" -e "s;\(^base=\).*;\1${parent_path_of_based_eclipse};g" -e "s;\(^baseLocation=\).*;\1${based_eclipse_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" < $build_path/build.properties.clean > $build_path/build.properties
else
	echo "ERROR : target eclipse is not exist."
	exit 1
fi

echo "Execute Product Ant Builder..."
java -server -XX:+UseParNewGC -jar ${based_eclipse_path}/plugins/$equinox_launcher -application org.eclipse.ant.core.antRunner -buildfile ${based_eclipse_path}/plugins/$pde_build/scripts/productBuild/productBuild.xml -Dbuilder=$build_path 2>&1

if [ $? != 0 ];
then
	echo "Build failed..."
	exit 1
fi

echo "unzip to $build_result_path"
unzip -a $build_result_path/${result_archive_file} -d $build_result_path/${archive_platform_name}.${windowing}.${architecture}

#echo "Delete temp files..."
#rm -rf $build_path/features
#rm -rf $build_path/plugins
#rm $build_path/*.xml
#rm $build_path/*.properties
#rm $build_path/*.properties.clean

echo "Build SUCCESS. You will find SDK IDE in \"${build_result_path}\"."