3 function show_extension_points
() {
4 echo "Valid extension points are:"
6 for point
in $V_EX_POINTS; do
12 function find_extension_points
() {
13 for file in $
(find -iname '*addin.xml'); do
14 points
=$
(grep '<ExtensionPoint' $file | \
15 awk 'BEGIN { FS="=" } { print $2 }' | \
18 id
=$
(awk 'BEGIN { FS="id=\"" } { print $2 }' < $file | \
19 awk 'BEGIN { FS="\" " } { print $1 }')
21 [[ -z $points ||
-z $id ]] && continue
23 for point
in $points; do
24 V_EX_POINTS
="${V_EX_POINTS} ${point}"
25 V_EX_POINTS_IDS
="${V_EX_POINTS_IDS} ${point},${id}"
31 echo "Usage: $0 <name> <path> [<extension-point> ...]"
33 echo "Example: ./create-extension Banshee.InternetRadio Extensions/"
41 EX_NAME
=$1; test -z $EX_NAME && usage ||
shift
46 *) test -z $1 || EX_PATH
="$1"; shift ;;
49 if test ! -d "${EX_PATH}"; then
50 echo "Extension root path \`${EX_PATH}' does not exist."
54 EX_PATH
="${EX_PATH}/${EX_NAME}"
55 TEMPLATE_PATH
="Extensions/Template"
57 if test ! -d $TEMPLATE_PATH; then
58 echo "Extension template path \`${TEMPLATE_PATH}' does not exist."
59 echo "This script must be run from the src/ directory of a Banshee checkout"
63 if test -d "${EX_PATH}"; then
64 echo "Extension \`${EX_PATH}' already exists."
70 for v_point
in $V_EX_POINTS; do
71 if [ "x$point" = "x$v_point" ]; then
76 if [ $found -eq 0 ]; then
77 echo "Extension point \`${point}' is not valid."
84 echo "Creating Extension ($EX_PATH)..."
87 for v_point
in $V_EX_POINTS_IDS; do
88 if [ "$point" = "${v_point%,*}" ]; then
89 dependency
="${v_point##*,}"
91 for dep_added
in $deps_added; do
92 if test "x${dependency}" = "x${dep_added}"; then
98 if [ $dep_found -eq 0 ]; then
99 deps_added
="${deps_added} ${dependency}"
100 EX_DEPS
="${EX_DEPS} <Addin id=\"${dependency}\" version=\"1.0\"/>^"
104 EX_NODES
="${EX_NODES} <Extension path=\"${point}\">^ <${name} class=\"\"/>^ </Extension>^^"
106 echo " Added extension node \`${name}' at path \`${point}'"
111 EX_DEPS
=" <Dependencies>^${EX_DEPS}^ </Dependencies>"
113 mkdir
-p "${EX_PATH}/${EX_NAME}"
114 cp ${TEMPLATE_PATH}/Template.mdp "${EX_PATH}/${EX_NAME}.mdp
"
115 cp ${TEMPLATE_PATH}/Template.addin.xml "${EX_PATH}/${EX_NAME}.addin.xml"
116 cp ${TEMPLATE_PATH}/Makefile.am
"${EX_PATH}"
118 pushd "${EX_PATH}" &>/dev
/null
121 sed -e "s/\@EXTENSION_NAME\@/${EX_NAME}/g" < $file > $file.tmp
&&
123 sed -e "s,\@EXTENSION_DEPS\@,${EX_DEPS},g" < $file |
124 sed -r 's,[\^]+,\^,g' |
tr ^
'\n' > $file.tmp
&&
126 sed -e "s,\@EXTENSION_NODES\@,${EX_NODES},g" < $file |
127 tr ^
'\n' > $file.tmp
&&
134 echo "You will need to fix the generated Makefile.am, .addins.xml file, "
135 echo "and add an entry to ../configure.ac, then run autogen.sh again."