Remove unused {jdks} variable
[releng/builder.git] / jjb / generate-p2pom.sh
1 #!/bin/bash
2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2016 The Linux Foundation and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11
12 if [[ "$P2ZIP_URL" == "" ]]; then
13     P2ZIP_URL=opendaylight.snapshot/$(find . -name "*.zip" -type f -exec ls "{}" + | head -1)
14     FILE_NAME=$(echo "$P2ZIP_URL" | awk -F'/' '{ print $NF }')
15     RELEASE_PATH="snapshot"
16 else
17     FILE_NAME=$(echo "$P2ZIP_URL" | awk -F'/' '{ print $NF }')
18     VERSION=$(echo "$P2ZIP_URL" | awk -F'/' '{ print $(NF-1) }')
19     RELEASE_PATH="release/$VERSION"
20     wget --quiet "$P2ZIP_URL" -O "$FILE_NAME"
21 fi
22
23 # If we detect a snapshot build then release to a snapshot repo
24 # YangIDE has indicated that the only want the latest snapshot released to
25 # the snapshot directory.
26 if echo "$P2ZIP_URL" | grep opendaylight.snapshot; then
27     RELEASE_PATH="snapshot"
28 fi
29
30 cat > "${WORKSPACE}/pom.xml" <<EOF
31 <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">
32   <modelVersion>4.0.0</modelVersion>
33   <groupId>org.opendaylight.$PROJECT</groupId>
34   <artifactId>p2repo</artifactId>
35   <version>1.0.0-SNAPSHOT</version>
36   <packaging>pom</packaging>
37
38   <build>
39     <plugins>
40       <plugin>
41         <groupId>org.apache.maven.plugins</groupId>
42         <artifactId>maven-deploy-plugin</artifactId>
43         <version>2.8.2</version>
44         <configuration>
45           <skip>true</skip>
46         </configuration>
47       </plugin>
48       <plugin>
49         <groupId>org.sonatype.plugins</groupId>
50         <artifactId>maven-upload-plugin</artifactId>
51         <version>0.0.1</version>
52         <executions>
53           <execution>
54             <id>publish-site</id>
55             <phase>deploy</phase>
56             <goals>
57               <goal>upload-file</goal>
58             </goals>
59             <configuration>
60               <serverId>opendaylight-p2</serverId>
61               <repositoryUrl>https://nexus.opendaylight.org/service/local/repositories/p2repos/content-compressed</repositoryUrl>
62               <file>$FILE_NAME</file>
63               <repositoryPath>org.opendaylight.$PROJECT/$RELEASE_PATH</repositoryPath>
64             </configuration>
65           </execution>
66         </executions>
67       </plugin>
68     </plugins>
69   </build>
70 </project>
71 EOF