|
6 | 6 | #/ versions to the one provided as argument.
|
7 | 7 | #/
|
8 | 8 | #/
|
| 9 | +#/ Notice |
| 10 | +#/ ====== |
| 11 | +#/ |
| 12 | +#/ This script does not use the Maven `versions` plugin (with goals such as |
| 13 | +#/ `versions:update-parent`, `versions:update-child-modules`, or `versions:set`) |
| 14 | +#/ because running Maven requires that the *current* versions are all correct |
| 15 | +#/ and existing (available for download or installed locally). |
| 16 | +#/ |
| 17 | +#/ We have frequently found that this is a limitation, because some times it is |
| 18 | +#/ needed to update from an unexisting version (like if some component is |
| 19 | +#/ skipping a patch number, during separate development of different modules), |
| 20 | +#/ or when doing a Release (when the release version is not yet available). |
| 21 | +#/ |
| 22 | +#/ It ends up being less troublesome to just edit the pom.xml directly. |
| 23 | +#/ |
| 24 | +#/ |
9 | 25 | #/ Arguments
|
10 | 26 | #/ =========
|
11 | 27 | #/
|
|
40 | 56 | set -o errexit -o errtrace -o pipefail -o nounset
|
41 | 57 |
|
42 | 58 | # Check dependencies.
|
43 |
| -command -v mvn >/dev/null || { |
44 |
| - echo "ERROR: 'mvn' is not installed; please install it" |
| 59 | +command -v xmlstarlet >/dev/null || { |
| 60 | + echo "ERROR: 'xmlstarlet' is not installed; please install it" |
45 | 61 | exit 1
|
46 | 62 | }
|
47 | 63 |
|
@@ -131,25 +147,39 @@ function git_add() {
|
131 | 147 | # Apply version
|
132 | 148 | # =============
|
133 | 149 |
|
134 |
| -MVN_ARGS=() |
135 |
| - |
136 |
| -if [[ "$CFG_RELEASE" == "true" ]]; then |
137 |
| - MVN_ALLOW_SNAPSHOTS="false" |
138 |
| -else |
139 |
| - MVN_ALLOW_SNAPSHOTS="true" |
140 |
| - MVN_ARGS+=(-U -Psnapshot) |
141 |
| -fi |
142 |
| - |
143 |
| -# Parent version: Update to latest available. |
144 |
| -mvn "${MVN_ARGS[@]}" versions:update-parent \ |
145 |
| - -DgenerateBackupPoms=false \ |
146 |
| - -DparentVersion="[$VERSION_JAVA,)" \ |
147 |
| - -DallowSnapshots="$MVN_ALLOW_SNAPSHOTS" |
148 |
| - |
149 |
| -# Children versions: Make them inherit from parent. |
150 |
| -mvn "${MVN_ARGS[@]}" versions:update-child-modules \ |
151 |
| - -DgenerateBackupPoms=false \ |
152 |
| - -DallowSnapshots="$MVN_ALLOW_SNAPSHOTS" |
| 150 | +# Parent: Update to the new version of kurento-java. |
| 151 | +xmlstarlet edit -S --inplace \ |
| 152 | + --update "/_:project/_:parent/_:version" \ |
| 153 | + --value "$VERSION_JAVA" \ |
| 154 | + pom.xml |
| 155 | + |
| 156 | +# Children: Make them inherit from the new parent. |
| 157 | +CHILDREN=( |
| 158 | + kurento-chroma |
| 159 | + kurento-crowddetector |
| 160 | + kurento-group-call |
| 161 | + kurento-hello-world |
| 162 | + kurento-hello-world-recording |
| 163 | + kurento-hello-world-repository |
| 164 | + kurento-magic-mirror |
| 165 | + kurento-metadata-example |
| 166 | + kurento-one2many-call |
| 167 | + kurento-one2one-call |
| 168 | + kurento-one2one-call-advanced |
| 169 | + kurento-one2one-call-recording |
| 170 | + kurento-platedetector |
| 171 | + kurento-player |
| 172 | + kurento-pointerdetector |
| 173 | + kurento-rtp-receiver |
| 174 | + kurento-send-data-channel |
| 175 | + kurento-show-data-channel |
| 176 | +) |
| 177 | +for CHILD in "${CHILDREN[@]}"; do |
| 178 | + find "$CHILD" -name pom.xml -print0 | xargs -0 -n1 \ |
| 179 | + xmlstarlet edit -S --inplace \ |
| 180 | + --update "/_:project/_:parent/_:version" \ |
| 181 | + --value "$VERSION_JAVA" |
| 182 | +done |
153 | 183 |
|
154 | 184 | git_add \
|
155 | 185 | '*pom.xml'
|
|
0 commit comments