blob: 4429e0760054c37d5503ab68961430c75c6e53cd [file] [log] [blame]
Thomas Vachuskaad37e372017-08-03 12:07:01 -07001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Assembles ONOS application jar from the compiled YANG model artifacts.
4# -----------------------------------------------------------------------------
5
6classes=${1:-classes}
7jar=${2:-model.jar}
8modelId=${3-org.onosproject.model.unknown}
9
10# Generate the app.xml descriptor file and stage it at the top of the jar
11sed "s/MODEL_ID/$modelId/g" $(dirname $0)/app.xml > $classes/app.xml
12
13# Generate features.xml file and stage it at the top of the jar
14sed "s/MODEL_ID/$modelId/g" $(dirname $0)/features.xml > $classes/features.xml
15mkdir -p $classes/m2/org/onosproject/$modelId/1.0/
16cp $classes/features.xml $classes/m2/org/onosproject/$modelId/1.0/$modelId-1.0-features.xml
17
18# Generate model self-registrator SCR descriptor
19mkdir -p $classes/OSGI-INF
20sed "s/PACKAGE/$modelId/g" $(dirname $0)/YangModelRegistrator.xml \
21 > $classes/OSGI-INF/$modelId.YangModelRegistrator.xml
22
23cd $classes
24jar cf $jar *