Merge "Fix identation format"
[integration.git] / autorelease / scripts / generate-pom.sh
1 #!/bin/bash
2 #
3 # Copyright 2016-2017 Huawei Technologies Co., Ltd.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17
18 # autorelease root dir
19 ROOT=`git rev-parse --show-toplevel`/autorelease
20 VERSION="1.1.0-SNAPSHOT"
21
22 BUILD_DIR=$ROOT/build
23
24 mkdir -p $BUILD_DIR
25 cd $BUILD_DIR
26
27 FILE=$BUILD_DIR/pom-raw.xml
28
29 cat > $FILE <<EOF
30 <!--
31    Copyright (c) 2016-2017 Huawei Technologies Co., Ltd.
32
33    Licensed under the Apache License, Version 2.0 (the "License");
34    you may not use this file except in compliance with the License.
35    You may obtain a copy of the License at
36
37        http://www.apache.org/licenses/LICENSE-2.0
38
39    Unless required by applicable law or agreed to in writing, software
40    distributed under the License is distributed on an "AS IS" BASIS,
41    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42    See the License for the specific language governing permissions and
43    limitations under the License.
44 -->
45 <!-- AUTOGENERATED by generate-pom.sh; DO NOT MODIFY MANUALLY -->
46 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
47   <modelVersion>4.0.0</modelVersion>
48   <parent>
49     <groupId>org.openo.oparent</groupId>
50     <artifactId>oparent</artifactId>
51     <version>$VERSION</version>
52     <relativePath>oparent</relativePath>
53   </parent>
54   <groupId>org.openo.integration.distribution</groupId>
55   <artifactId>openo</artifactId>
56   <packaging>pom</packaging>
57   <modules>
58 EOF
59
60 find -mindepth 1 -type d -exec test -e "{}/pom.xml" ';' -prune -printf "%P\n" | sort | while read p; do
61     if [ $p != "integration/autorelease/build" ]; then
62         cat >> $FILE <<EOF
63     <module>$p</module>
64 EOF
65     fi
66 done
67
68 cat >> $FILE <<EOF
69   </modules>
70   <dependencies>
71 EOF
72
73 $ROOT/scripts/generate-binary-deps.py >> $FILE
74
75 cat >> $FILE <<EOF
76   </dependencies>
77
78   <build>
79     <plugins>
80       <plugin>
81         <artifactId>maven-assembly-plugin</artifactId>
82         <version>2.6</version>
83         <configuration>
84           <appendAssemblyId>true</appendAssemblyId>
85           <descriptors>
86             <descriptor>assembly.xml</descriptor>
87           </descriptors>
88         </configuration>
89         <executions>
90           <execution>
91             <id>make-assembly</id>
92             <phase>package</phase>
93             <goals>
94               <goal>single</goal>
95             </goals>
96           </execution>
97         </executions>
98       </plugin>
99     </plugins>
100   </build>
101
102 </project>
103 EOF
104
105 xmlstarlet fo pom-raw.xml > pom.xml
106 rm -f pom-raw.xml
107
108 $ROOT/scripts/generate-assembly.py > $BUILD_DIR/assembly.xml