2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2016 The Linux Foundation and others.
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 ##############################################################################
12 # If we detect a snapshot build then there is no need to run this script.
13 # YangIDE has indicated that the only want the latest snapshot released to
14 # the snapshot directory.
15 if echo "$P2ZIP_URL" | grep opendaylight.snapshot; then
18 if [[ "$P2ZIP_URL" == "" ]]; then
22 EPOCH_DATE=$(date +%s%3N)
23 MVN_METADATA=$(echo "$P2ZIP_URL" | sed 's,/*[^/]\+/*$,,' | sed 's,/*[^/]\+/*$,,')/maven-metadata.xml
24 P2_COMPOSITE_ARTIFACTS=compositeArtifacts.xml
25 P2_COMPOSITE_CONTENT=compositeContent.xml
27 wget "$MVN_METADATA" -O maven-metadata.xml
29 VERSIONS=$(xmlstarlet sel -t -m "/metadata/versioning/versions" -v "version" maven-metadata.xml)
30 NUM_VERSIONS=$(echo "$VERSIONS" | wc -w)
34 ## Create compositeArtifacts.xml and compositeContent.xml files
37 cat > $P2_COMPOSITE_ARTIFACTS <<EOF
38 <?xml version='1.0' encoding='UTF-8'?>
39 <?compositeArtifactRepository version='1.0.0'?>
40 <repository name='OpenDaylight $PROJECT'
41 type='org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository' version='1.0.0'>
43 <property name='p2.timestamp' value='$EPOCH_DATE'/>
45 <children size='$NUM_VERSIONS'>
48 cat > $P2_COMPOSITE_CONTENT <<EOF
49 <?xml version='1.0' encoding='UTF-8'?>
50 <?compositeMetadataRepository version='1.0.0'?>
51 <repository name='OpenDaylight $PROJECT'
52 type='org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository' version='1.0.0'>
54 <property name='p2.timestamp' value='$EPOCH_DATE'/>
56 <children size='$NUM_VERSIONS'>
65 echo " <child location='$ver'/>" >> $P2_COMPOSITE_ARTIFACTS
66 echo " <child location='$ver'/>" >> $P2_COMPOSITE_CONTENT
73 cat >> $P2_COMPOSITE_ARTIFACTS <<EOF
78 cat >> $P2_COMPOSITE_CONTENT <<EOF
84 ## Create poms for uploading
87 zip composite-repo.zip $P2_COMPOSITE_ARTIFACTS $P2_COMPOSITE_CONTENT
89 cat > deploy-composite-repo.xml <<EOF
90 <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">
91 <modelVersion>4.0.0</modelVersion>
92 <groupId>org.opendaylight.$PROJECT</groupId>
93 <artifactId>p2repo</artifactId>
94 <version>1.0.0-SNAPSHOT</version>
95 <packaging>pom</packaging>
100 <groupId>org.apache.maven.plugins</groupId>
101 <artifactId>maven-deploy-plugin</artifactId>
102 <version>2.8.2</version>
108 <groupId>org.sonatype.plugins</groupId>
109 <artifactId>maven-upload-plugin</artifactId>
110 <version>0.0.1</version>
113 <id>publish-site</id>
114 <phase>deploy</phase>
116 <goal>upload-file</goal>
119 <serverId>opendaylight-p2</serverId>
120 <repositoryUrl>https://nexus.opendaylight.org/service/local/repositories/p2repos/content-compressed</repositoryUrl>
121 <file>composite-repo.zip</file>
122 <repositoryPath>org.opendaylight.$PROJECT/release</repositoryPath>