forked from degauden/Elements
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaddElementsModule_test
More file actions
executable file
·92 lines (73 loc) · 2.5 KB
/
Copy pathaddElementsModule_test
File metadata and controls
executable file
·92 lines (73 loc) · 2.5 KB
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
#!/bin/sh
# export KEEPTEMPDIR=1
home_dir=${PWD}
project_name="ProjectTest"
version="1.0"
module_name="ModuleTest"
module_dep_name="Alexandria"
# Create a unique directory
tmploc=$(mktemp -dq -t temp.XXXXXX)
# Set to the User_area
cd ${tmploc}
export User_area=${tmploc}
# Clean and exit
local_clean_exit() {
cd ${home_dir}
if [ -z "${KEEPTEMPDIR}" ]; then
rm -rf ${tmploc}
fi
exit $1
}
# We need first to create a project
CreateElementsProject $project_name $version --yes
# Error? stop and clean up
if [ $? -ne 0 ]; then
echo "Error: <CreateElementsProject $project_name $version> command failed!" 1>&2
local_clean_exit 1
fi
# Move to the project
cd $User_area/$project_name/$version/
# Create a module
AddElementsModule $module_name -md $module_dep_name --yes
# Error? stop and clean up
if [ $? -ne 0 ]; then
echo "Error: <AddElementsModule $module_name -md $module_dep_name> command failed!" 1>&2
local_clean_exit 1
fi
# Make sure the module is created
if [ ! -d $module_name ]; then
echo "Error: <AddElementsModule $module_name -md $module_dep_name> command failed!" 1>&2
local_clean_exit 1
fi
module_path="$User_area/$project_name/$version/$module_name"
# Make sure <CMakeLists.txt> file has been created
if [ ! -e $module_path/CMakeLists.txt ]; then
echo "Error: <$module_path/CMakeLists.txt> file not found!" 1>&2
local_clean_exit 1
fi
# Make sure the <module_test> is there
result=$( grep "elements_subdir" $module_path/CMakeLists.txt | grep "$module_name" )
if [ $? -ne 0 ];then
echo "Error: <elements_subdir> macro with <$module_name> module not found!" 1>&2
local_clean_exit 1
fi
# Make sure the <ElementsKernel> is there
result=$( grep "elements_depends_on_subdirs" $module_path/CMakeLists.txt |
grep -v "#" | grep "ElementsKernel" )
if [ $? -ne 0 ];then
echo "Error: <elements_depends_on_subdirs> macro with <ElementsKernel> module not found!" 1>&2
local_clean_exit 1
fi
# Make sure the <Alexandria> is there
result=$( grep "elements_depends_on_subdirs" $module_path/CMakeLists.txt |
grep -v "#" | grep $module_dep_name )
if [ $? -ne 0 ];then
echo "Error: <elements_depends_on_subdirs> macro with <$module_dep_name> dependency not found!" 1>&2
local_clean_exit 1
fi
# Make sure directories are created
if [ ! -d $module_path/conf ] || [ ! -d $module_path/doc ] || [ ! -d $module_path/tests/src ]; then
echo "Error: <$module_path/conf or $module_path/doc or $module_path/tests/src> directory not found!" 1>&2
local_clean_exit 1
fi
local_clean_exit 0