File: NewLibrary.sh

package info (click to toggle)
cpputest 4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,688 kB
  • sloc: cpp: 31,212; sh: 4,978; ansic: 1,360; makefile: 775; ruby: 676; xml: 8; sed: 1
file content (35 lines) | stat: -rwxr-xr-x 935 bytes parent folder | download | duplicates (6)
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
#!/bin/bash -x
TEMPLATE_DIR=${CPPUTEST_HOME}/scripts/templates
LIBRARY=$1

if [ -e ${LIBRARY} ] ; then
	echo "The directory ${LIBRARY} already exists"
	exit 1;
fi

echo "Copy template project to  ${LIBRARY}"
cp -R ${TEMPLATE_DIR}/ProjectTemplate/Project ${LIBRARY}
find ${LIBRARY} -name \.svn | xargs rm -rf

echo "Update to the new LIBRARY name"
substituteProjectName="-e s/Project/${LIBRARY}/g -i .bak"
 
cd ${LIBRARY}

sed ${substituteProjectName} *.*
sed ${substituteProjectName} Makefile

for name in BuildTime.h BuildTime.cpp BuildTimeTest.cpp ; do
	mv Project${name} ${LIBRARY}${name}
done

cd ..

sed -e "s/DIRS = /DIRS = ${LIBRARY} /g" -i .bak Makefile

find  ${LIBRARY} -name \*.bak | xargs rm -f

echo "#include \"../${LIBRARY}/AllTests.h\"" >> AllTests/AllTests.cpp

echo "You have to manually add the library reference to the AllTests Makefile"
echo "and maybe change the order of the library builds in the main Makefile"