-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathtoggle-project
More file actions
executable file
·27 lines (24 loc) · 936 Bytes
/
Copy pathtoggle-project
File metadata and controls
executable file
·27 lines (24 loc) · 936 Bytes
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
#!/bin/bash
set -e
if [ $# -lt 1 ]; then
echo "$0 <project> [<project> ...]"
echo toggles the activation of the named projects.
exit 1
fi
while [ -n "$1" ]; do
echo -n "Processing $1... "
for file in $(git grep -l "<id>$1</id>"); do
xmlstarlet ed -P -N mvn=http://maven.apache.org/POM/4.0.0 \
-u //mvn:profile[mvn:id=\"$1\"]/mvn:activation[mvn:activeByDefault=\"true\"]/mvn:activeByDefault \
-v wastrue "${file}" > "${file}.1"
xmlstarlet ed -P -N mvn=http://maven.apache.org/POM/4.0.0 \
-u //mvn:profile[mvn:id=\"$1\"]/mvn:activation[mvn:activeByDefault=\"false\"]/mvn:activeByDefault \
-v true "${file}.1" > "${file}.2"
xmlstarlet ed -P -N mvn=http://maven.apache.org/POM/4.0.0 \
-u //mvn:profile[mvn:id=\"$1\"]/mvn:activation[mvn:activeByDefault=\"wastrue\"]/mvn:activeByDefault \
-v false "${file}.2" > "${file}"
rm -f "${file}".{1,2}
done
echo done.
shift
done