Committed by
Gerrit Code Review
Preparing assembly of Karaf and ONOS artifacts for off-line deployments.
Change-Id: I113490bc6735f5372e33bb671ad5adec640b2e36
Showing
4 changed files
with
135 additions
and
11 deletions
| ... | @@ -39,7 +39,6 @@ | ... | @@ -39,7 +39,6 @@ |
| 39 | <description>Open Network Operating System root project</description> | 39 | <description>Open Network Operating System root project</description> |
| 40 | 40 | ||
| 41 | <modules> | 41 | <modules> |
| 42 | - <module>tools/package/maven-plugin</module> | ||
| 43 | <module>utils</module> | 42 | <module>utils</module> |
| 44 | <module>core</module> | 43 | <module>core</module> |
| 45 | <module>web</module> | 44 | <module>web</module> |
| ... | @@ -55,6 +54,8 @@ | ... | @@ -55,6 +54,8 @@ |
| 55 | 54 | ||
| 56 | <module>tools/package/archetypes</module> | 55 | <module>tools/package/archetypes</module> |
| 57 | <module>tools/package/branding</module> | 56 | <module>tools/package/branding</module> |
| 57 | + <module>tools/package/karaf-assembly</module> | ||
| 58 | + <module>tools/package/maven-plugin</module> | ||
| 58 | <module>tools/build/conf</module> | 59 | <module>tools/build/conf</module> |
| 59 | </modules> | 60 | </modules> |
| 60 | 61 | ... | ... |
| ... | @@ -50,16 +50,21 @@ function build_stage_dir() { | ... | @@ -50,16 +50,21 @@ function build_stage_dir() { |
| 50 | $ONOS_ROOT/tools/package/bin/onos-client > bin/onos | 50 | $ONOS_ROOT/tools/package/bin/onos-client > bin/onos |
| 51 | chmod a+x bin/onos-service bin/onos | 51 | chmod a+x bin/onos-service bin/onos |
| 52 | 52 | ||
| 53 | - # Stage the ONOS bundles, but only those that match the version | 53 | + if [ -d $ONOS_ROOT/tools/package/karaf-assembly/target/repo ]; then |
| 54 | - mkdir -p $ONOS_STAGE/$KARAF_DIST/system/org/onosproject | 54 | + cp -r $ONOS_ROOT/tools/package/karaf-assembly/target/repo/* $ONOS_STAGE/$KARAF_DIST/system |
| 55 | - find $M2_REPO/org/onosproject -type f -path "*/$ONOS_POM_VERSION/*" \ | 55 | + else |
| 56 | - \( -name '*.jar' -o -name '*.pom' -o -name '*-features.xml' \) \ | 56 | + # TODO: Deprecated so remove when confident staging works. |
| 57 | - | grep -v -Ee '-tests.jar|-[0-9]{8}.[0-9]{6}-' \ | 57 | + # Stage the ONOS bundles, but only those that match the version |
| 58 | - | while read src; do | 58 | + mkdir -p $ONOS_STAGE/$KARAF_DIST/system/org/onosproject |
| 59 | - dst=$ONOS_STAGE/$KARAF_DIST/system/${src#$M2_REPO/*} | 59 | + find $M2_REPO/org/onosproject -type f -path "*/$ONOS_POM_VERSION/*" \ |
| 60 | - mkdir -p $(dirname $dst) | 60 | + \( -name '*.jar' -o -name '*.pom' -o -name '*-features.xml' \) \ |
| 61 | - cp $src $dst | 61 | + | grep -v -Ee '-tests.jar|-[0-9]{8}.[0-9]{6}-' \ |
| 62 | - done | 62 | + | while read src; do |
| 63 | + dst=$ONOS_STAGE/$KARAF_DIST/system/${src#$M2_REPO/*} | ||
| 64 | + mkdir -p $(dirname $dst) | ||
| 65 | + cp $src $dst | ||
| 66 | + done | ||
| 67 | + fi | ||
| 63 | 68 | ||
| 64 | # ONOS Patching ---------------------------------------------------------------- | 69 | # ONOS Patching ---------------------------------------------------------------- |
| 65 | 70 | ... | ... |
tools/package/karaf-assembly/onos-assembly
0 → 100755
| 1 | +#!/bin/bash | ||
| 2 | +# ----------------------------------------------------------------------------- | ||
| 3 | +# Assembles together all bundles required to run ONOS off-line. | ||
| 4 | +# ----------------------------------------------------------------------------- | ||
| 5 | + | ||
| 6 | +mkdir -p target | ||
| 7 | + | ||
| 8 | +features=target/features-list.xml | ||
| 9 | +repos=target/staged-repos.xml | ||
| 10 | + | ||
| 11 | +echo "<features>" > $repos | ||
| 12 | +echo " <repository>mvn:org.onosproject/onos-features/1.4.0-SNAPSHOT/xml/features</repository>" >> $repos | ||
| 13 | + | ||
| 14 | +# Find all app feature files | ||
| 15 | +find $ONOS_ROOT -name '*-features.xml' | grep -v features-repo > $features | ||
| 16 | + | ||
| 17 | +# Produce repository entry for each file | ||
| 18 | +cat $features | while read feature; do | ||
| 19 | + echo " <repository>file:$feature</repository>" >> $repos | ||
| 20 | +done | ||
| 21 | + | ||
| 22 | +# Create a synthetic feature that depends on all other ONOS features | ||
| 23 | +echo " <feature name=\"foo\">" >> $repos | ||
| 24 | +grep "feature name=" $ONOS_ROOT/features/features.xml | cut -d\" -f2 | while read f; do | ||
| 25 | + echo " <feature>$f</feature>" >> $repos | ||
| 26 | +done | ||
| 27 | + | ||
| 28 | +cat $features | while read feature; do | ||
| 29 | + grep "feature name=" $feature | cut -d\" -f2 | while read f; do | ||
| 30 | + echo " <feature>$f</feature>" >> $repos | ||
| 31 | + done | ||
| 32 | +done | ||
| 33 | +echo " </feature>" >> $repos | ||
| 34 | + | ||
| 35 | +echo "</features>" >> $repos | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
tools/package/karaf-assembly/pom.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | + | ||
| 3 | +<!-- | ||
| 4 | + ~ Copyright 2014-2015 Open Networking Laboratory | ||
| 5 | + ~ | ||
| 6 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 7 | + ~ you may not use this file except in compliance with the License. | ||
| 8 | + ~ You may obtain a copy of the License at | ||
| 9 | + ~ | ||
| 10 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| 11 | + ~ | ||
| 12 | + ~ Unless required by applicable law or agreed to in writing, software | ||
| 13 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
| 14 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 15 | + ~ See the License for the specific language governing permissions and | ||
| 16 | + ~ limitations under the License. | ||
| 17 | + --> | ||
| 18 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 19 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 20 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
| 21 | + <modelVersion>4.0.0</modelVersion> | ||
| 22 | + | ||
| 23 | + <parent> | ||
| 24 | + <groupId>org.onosproject</groupId> | ||
| 25 | + <artifactId>onos</artifactId> | ||
| 26 | + <version>1.4.0-SNAPSHOT</version> | ||
| 27 | + <relativePath>../../../pom.xml</relativePath> | ||
| 28 | + </parent> | ||
| 29 | + | ||
| 30 | + <artifactId>onos-assembly</artifactId> | ||
| 31 | + <packaging>pom</packaging> | ||
| 32 | + | ||
| 33 | + <description>ONOS Apache Karaf assembly definitions</description> | ||
| 34 | + | ||
| 35 | + <build> | ||
| 36 | + <plugins> | ||
| 37 | + <plugin> | ||
| 38 | + <artifactId>maven-antrun-plugin</artifactId> | ||
| 39 | + <version>1.8</version> | ||
| 40 | + <executions> | ||
| 41 | + <execution> | ||
| 42 | + <phase>generate-sources</phase> | ||
| 43 | + <configuration> | ||
| 44 | + <target> | ||
| 45 | + <exec executable="bash"> | ||
| 46 | + <arg value="${basedir}/onos-assembly"/> | ||
| 47 | + </exec> | ||
| 48 | + </target> | ||
| 49 | + </configuration> | ||
| 50 | + <goals> | ||
| 51 | + <goal>run</goal> | ||
| 52 | + </goals> | ||
| 53 | + </execution> | ||
| 54 | + </executions> | ||
| 55 | + </plugin> | ||
| 56 | + <plugin> | ||
| 57 | + <groupId>org.apache.karaf.tooling</groupId> | ||
| 58 | + <artifactId>karaf-maven-plugin</artifactId> | ||
| 59 | + <version>3.0.3</version> | ||
| 60 | + | ||
| 61 | + <executions> | ||
| 62 | + <execution> | ||
| 63 | + <id>features-add-to-repo</id> | ||
| 64 | + <phase>generate-resources</phase> | ||
| 65 | + <goals> | ||
| 66 | + <goal>features-add-to-repository</goal> | ||
| 67 | + </goals> | ||
| 68 | + <configuration> | ||
| 69 | + <descriptors> | ||
| 70 | + <descriptor>file:${basedir}/target/staged-repos.xml</descriptor> | ||
| 71 | + </descriptors> | ||
| 72 | + <features> | ||
| 73 | + <feature>foo</feature> | ||
| 74 | + </features> | ||
| 75 | + <repository>target/repo</repository> | ||
| 76 | + </configuration> | ||
| 77 | + </execution> | ||
| 78 | + </executions> | ||
| 79 | + </plugin> | ||
| 80 | + </plugins> | ||
| 81 | + </build> | ||
| 82 | + | ||
| 83 | +</project> |
-
Please register or login to post a comment