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