Thomas Vachuska
Committed by Gerrit Code Review

Removing need for boilerplate app.xml; Instead defining onos.app.name and onos.a…

…pp.origin (optional) is sufficient to trigger generation of boilerplate app.xml and features.xml files.

Change-Id: Ied8f3f8bf8774fae85e11c79a733b34dd5868949
......@@ -14,7 +14,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<app name="org.onosproject.bgprouter" origin="ON.Lab" version="${feature.version}"
<app name="org.onosproject.bgprouter" origin="ON.Lab" version="${short.version}"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}">
<description>${project.description}</description>
......
......@@ -14,9 +14,9 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${feature.version}">
<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${short.version}">
<repository>mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features</repository>
<feature name="${project.artifactId}" version="${feature.version}"
<feature name="${project.artifactId}" version="${project.version}"
description="${project.description}">
<feature>onos-api</feature>
<bundle>mvn:${project.groupId}/onos-app-routing-api/${project.version}</bundle>
......
......@@ -39,6 +39,12 @@
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-app-routing</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onlab-misc</artifactId>
</dependency>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015 Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<app name="org.onosproject.config" origin="ON.Lab" version="${feature.version}"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}">
<description>${project.description}</description>
<artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
</app>
......@@ -31,6 +31,10 @@
<description>Network configuration application</description>
<properties>
<onos.app.name>org.onosproject.config</onos.app.name>
</properties>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015 Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<app name="org.onosproject.fwd" origin="ON.Lab" version="${feature.version}"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}">
<description>${project.description}</description>
<artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
</app>
......@@ -31,6 +31,10 @@
<description>Reactive forwarding application using flow subsystem</description>
<properties>
<onos.app.name>org.onosproject.fwd</onos.app.name>
</properties>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015 Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<app name="org.onosproject.metrics" origin="ON.Lab" version="${feature.version}"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}">
<description>${project.description}</description>
<artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
</app>
......@@ -31,6 +31,10 @@
<description>Performance metrics collection</description>
<properties>
<onos.app.name>org.onosproject.metrics</onos.app.name>
</properties>
<dependencies>
<dependency>
<groupId>org.onosproject</groupId>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015 Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<app name="org.onosproject.mobility" origin="ON.Lab" version="${feature.version}"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}">
<description>${project.description}</description>
<artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
</app>
......@@ -31,6 +31,10 @@
<description>Host mobility application</description>
<properties>
<onos.app.name>org.onosproject.mobility</onos.app.name>
</properties>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015 Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<app name="org.onosproject.optical" origin="ON.Lab" version="${feature.version}"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}">
<description>${project.description}</description>
<artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
</app>
......@@ -31,8 +31,11 @@
<description>Packet/Optical use-case application</description>
<dependencies>
<properties>
<onos.app.name>org.onosproject.optical</onos.app.name>
</properties>
<dependencies>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-cli</artifactId>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015 Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<app name="org.onosproject.proxyarp" origin="ON.Lab" version="${feature.version}"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}">
<description>${project.description}</description>
<artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
</app>
......@@ -31,6 +31,10 @@
<description>Proxy ARP/NDP application</description>
<properties>
<onos.app.name>org.onosproject.proxyarp</onos.app.name>
</properties>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015 Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<app name="org.onosproject.routing" origin="ON.Lab" version="${feature.version}"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}">
<description>${project.description}</description>
<artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
</app>
\ No newline at end of file
......@@ -19,10 +19,6 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>onos-app-reactive-routing</artifactId>
<packaging>bundle</packaging>
<description>SDN-IP reactive routing application</description>
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-apps</artifactId>
......@@ -30,6 +26,15 @@
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>onos-app-reactive-routing</artifactId>
<packaging>bundle</packaging>
<description>SDN-IP reactive routing application</description>
<properties>
<onos.app.name>org.onosproject.routing</onos.app.name>
</properties>
<dependencies>
<dependency>
<groupId>org.onosproject</groupId>
......
......@@ -14,7 +14,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<app name="org.onosproject.sdnip" origin="ON.Lab" version="${feature.version}"
<app name="org.onosproject.sdnip" origin="ON.Lab" version="${short.version}"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}">
<description>${project.description}</description>
......
......@@ -14,9 +14,9 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${feature.version}">
<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${short.version}">
<repository>mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features</repository>
<feature name="onos-app-sdnip" version="${feature.version}"
<feature name="onos-app-sdnip" version="${project.version}"
description="${project.description}">
<feature>onos-api</feature>
<feature>onos-app-proxyarp</feature>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015 Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<app name="org.onosproject.segmentrouting" origin="ON.Lab" version="${feature.version}"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}">
<description>${project.description}</description>
<artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
</app>
......@@ -30,4 +30,8 @@
<description>Segment routing application</description>
<properties>
<onos.app.name>org.onosproject.segmentrouting</onos.app.name>
</properties>
</project>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015 Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<app name="org.onosproject.demo" origin="ON.Lab" version="${feature.version}"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}">
<description>${project.description}</description>
<artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
</app>
......@@ -32,6 +32,7 @@
<description>Flow throughput test application</description>
<properties>
<onos.app.name>org.onosproject.demo</onos.app.name>
<web.context>/onos/demo</web.context>
</properties>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015 Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<app name="org.onosproject.election" origin="ON.Lab" version="${feature.version}"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}">
<description>${project.description}</description>
<artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
</app>
......@@ -32,8 +32,11 @@
<description>Master election test application</description>
<dependencies>
<properties>
<onos.app.name>org.onosproject.election</onos.app.name>
</properties>
<dependencies>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-api</artifactId>
......
......@@ -31,6 +31,10 @@
<description>Intent performance test application</description>
<properties>
<onos.app.name>org.onosproject.intentperf</onos.app.name>
</properties>
<dependencies>
<dependency>
<groupId>org.onosproject</groupId>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015 Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<app name="org.onosproject.drivers" origin="ON.Lab" version="${feature.version}"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}">
<description>${project.description}</description>
<artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
</app>
......@@ -32,6 +32,10 @@
<description>Builtin device drivers</description>
<properties>
<onos.app.name>org.onosproject.drivers</onos.app.name>
</properties>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
......@@ -44,12 +48,6 @@
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-core-serializers</artifactId>
<version>1.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<scope>test</scope>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015 Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<app name="org.onosproject.null" origin="ON.Lab" version="${feature.version}"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}">
<description>${project.description}</description>
<artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
</app>
......@@ -31,6 +31,10 @@
<description>Null southbound providers application</description>
<properties>
<onos.app.name>org.onosproject.null</onos.app.name>
</properties>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
......
......@@ -14,7 +14,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<app name="org.onosproject.openflow" origin="ON.Lab" version="${feature.version}"
<app name="org.onosproject.openflow" origin="ON.Lab" version="${short.version}"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}">
<description>${project.description}</description>
......
......@@ -14,9 +14,9 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${feature.version}">
<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
<repository>mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features</repository>
<feature name="${project.artifactId}" version="${feature.version}"
<feature name="${project.artifactId}" version="${project.version}"
description="${project.description}">
<feature>onos-api</feature>
<bundle>mvn:io.netty/netty/3.9.2.Final</bundle>
......
......@@ -15,7 +15,7 @@
*/
package org.onosproject.maven;
import com.google.common.io.ByteStreams;
import com.google.common.collect.ImmutableList;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.XMLConfiguration;
import org.apache.maven.artifact.repository.ArtifactRepository;
......@@ -39,6 +39,7 @@ import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import static com.google.common.io.ByteStreams.toByteArray;
import static org.codehaus.plexus.util.FileUtils.*;
/**
......@@ -51,7 +52,6 @@ public class OnosAppMojo extends AbstractMojo {
private static final String NAME = "[@name]";
private static final String VERSION = "[@version]";
private static final String FEATURES_REPO = "[@featuresRepo]";
private static final String DESCRIPTION = "description";
private static final String ARTIFACT = "artifact";
private static final String APP_XML = "app.xml";
......@@ -60,16 +60,31 @@ public class OnosAppMojo extends AbstractMojo {
private static final String MVN_URL = "mvn:";
private static final String M2_PREFIX = "m2";
private static final String ONOS_APP_NAME = "onos.app.name";
private static final String ONOS_APP_ORIGIN = "onos.app.origin";
private static final String SNAPSHOT = "-SNAPSHOT";
private static final String JAR = "jar";
private static final String XML = "xml";
private static final String APP_ZIP = "oar";
private static final String PACKAGE_DIR = "oar";
private static final String DEFAULT_ORIGIN = "ON.Lab";
private static final String DEFAULT_VERSION = "${short.version}";
private static final String DEFAULT_FEATURES_REPO =
"mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features";
private static final String DEFAULT_ARTIFACT =
"mvn:${project.groupId}/${project.artifactId}/${project.version}";
private static final int BUFFER_ZIZE = 8192;
private String name, version;
private String description, featuresRepo;
private String name;
private String origin;
private String version = DEFAULT_VERSION;
private String shortVersion;
private String featuresRepo = DEFAULT_FEATURES_REPO;
private List<String> artifacts;
/**
......@@ -127,27 +142,37 @@ public class OnosAppMojo extends AbstractMojo {
private File m2Directory;
protected File stageDirectory;
protected String projectPath;
protected String featureVersion;
@Override
public void execute() throws MojoExecutionException {
File appFile = new File(baseDir, APP_XML);
File featuresFile = new File(baseDir, FEATURES_XML);
if (!appFile.exists()) {
name = (String) project.getProperties().get(ONOS_APP_NAME);
// If neither the app.xml file exists, nor the onos.app.name property
// is defined, there is nothing for this Mojo to do, so bail.
if (!appFile.exists() && name == null) {
return;
}
m2Directory = new File(localRepository.getBasedir());
stageDirectory = new File(dstDirectory, PACKAGE_DIR);
featureVersion = projectVersion.replace(SNAPSHOT, "");
shortVersion = projectVersion.replace(SNAPSHOT, "");
projectPath = M2_PREFIX + "/" + artifactDir(projectGroupId, projectArtifactId, projectVersion);
origin = (String) project.getProperties().get(ONOS_APP_ORIGIN);
origin = origin != null ? origin : DEFAULT_ORIGIN;
if (appFile.exists()) {
loadAppFile(appFile);
} else {
artifacts = ImmutableList.of(eval(DEFAULT_ARTIFACT));
}
// If there are any artifacts, stage the
if (!artifacts.isEmpty()) {
getLog().info("Building ONOS application package for " + name + " (v" + version + ")");
getLog().info("Building ONOS application package for " + name + " (v" + eval(version) + ")");
artifacts.forEach(a -> getLog().debug("Including artifact: " + a));
if (stageDirectory.exists() || stageDirectory.mkdirs()) {
......@@ -173,8 +198,6 @@ public class OnosAppMojo extends AbstractMojo {
name = xml.getString(NAME);
version = eval(xml.getString(VERSION));
description = xml.getString(DESCRIPTION)
.replaceAll("\\$\\{project.description\\}", projectDescription);
featuresRepo = eval(xml.getString(FEATURES_REPO));
artifacts = xml.configurationsAt(ARTIFACT).stream()
......@@ -195,8 +218,15 @@ public class OnosAppMojo extends AbstractMojo {
try {
File file = new File(stageDirectory, APP_XML);
forceMkdir(stageDirectory);
String s = eval(fileRead(appFile));
fileWrite(file.getAbsolutePath(), s);
String contents;
if (appFile.exists()) {
contents = fileRead(appFile);
} else {
byte[] bytes = toByteArray(getClass().getResourceAsStream(APP_XML));
contents = new String(bytes);
}
fileWrite(file.getAbsolutePath(), eval(contents));
} catch (IOException e) {
throw new MojoExecutionException("Unable to process app.xml", e);
}
......@@ -226,7 +256,7 @@ public class OnosAppMojo extends AbstractMojo {
artifactFile(projectArtifactId, projectVersion, XML, "features");
File dstDir = new File(stageDirectory, projectPath);
forceMkdir(dstDir);
String s = eval(new String(ByteStreams.toByteArray(stream)));
String s = eval(new String(toByteArray(stream)));
fileWrite(new File(dstDir, featuresArtifact).getAbsolutePath(), s);
}
......@@ -310,11 +340,13 @@ public class OnosAppMojo extends AbstractMojo {
// Returns the given string with project variable substitutions.
private String eval(String string) {
return string == null ? null :
string.replaceAll("\\$\\{project.groupId\\}", projectGroupId)
string.replaceAll("\\$\\{onos.app.name\\}", name)
.replaceAll("\\$\\{onos.app.origin\\}", origin)
.replaceAll("\\$\\{project.groupId\\}", projectGroupId)
.replaceAll("\\$\\{project.artifactId\\}", projectArtifactId)
.replaceAll("\\$\\{project.version\\}", projectVersion)
.replaceAll("\\$\\{project.description\\}", description)
.replaceAll("\\$\\{feature.version\\}", featureVersion);
.replaceAll("\\$\\{short.version\\}", shortVersion)
.replaceAll("\\$\\{project.description\\}", projectDescription);
}
// Recursively archives the specified directory into a given ZIP stream.
......
......@@ -14,7 +14,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<app name="org.onosproject.intentperf" origin="ON.Lab" version="${feature.version}"
<app name="${onos.app.name}" origin="${onos.app.origin}" version="${short.version}"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}">
<description>${project.description}</description>
......
......@@ -14,9 +14,9 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${feature.version}">
<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${short.version}">
<repository>mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features</repository>
<feature name="${project.artifactId}" version="${feature.version}"
<feature name="${project.artifactId}" version="${project.version}"
description="${project.description}">
<feature>onos-api</feature>
<bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
......