Skip to content
Snippets Groups Projects
Commit 08578908 authored by Daniel Stonier's avatar Daniel Stonier
Browse files

provide a limited scope path for unofficial message generation to avoid picking up old versions.

parent 730ae15d
No related branches found
No related tags found
No related merge requests found
......@@ -108,9 +108,11 @@ class CatkinPackage {
def name
def version
def dependencies
def directory
def CatkinPackage(File packageXmlFilename) {
def packageXml = new XmlParser().parse(packageXmlFilename)
directory = packageXmlFilename.parent
name = packageXml.name.text()
version = packageXml.version.text()
dependencies = []
......@@ -181,7 +183,7 @@ class CatkinPackage {
def generateSourcesTask = p.tasks.create("generateSources", JavaExec)
generateSourcesTask.description = "Generate sources for " + name
generateSourcesTask.outputs.dir(p.file(generatedSourcesDir))
generateSourcesTask.args = new ArrayList<String>([generatedSourcesDir, name])
generateSourcesTask.args = new ArrayList<String>([generatedSourcesDir, '--package-path=' + directory, name])
generateSourcesTask.classpath = p.configurations.runtime
generateSourcesTask.main = 'org.ros.internal.message.GenerateInterfaces'
p.tasks.compileJava.source generateSourcesTask.outputs.files
......
......@@ -33,6 +33,7 @@ import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.ListIterator;
/**
* @author damonkohler@google.com (Damon Kohler)
......@@ -69,7 +70,6 @@ public class GenerateInterfaces {
packages = topicDefinitionFileProvider.getPackages();
}
for (String pkg : packages) {
System.out.println("Package: " + pkg);
Collection<MessageIdentifier> messageIdentifiers =
topicDefinitionFileProvider.getMessageIdentifiersByPackage(pkg);
if (messageIdentifiers != null) {
......@@ -159,6 +159,15 @@ public class GenerateInterfaces {
arguments.add(".");
}
String rosPackagePath = System.getenv(ROS_PACKAGE_PATH);
// Overwrite with a supplied package path if specified (--package-path=)
for (ListIterator<String> iter = arguments.listIterator(); iter.hasNext(); ) {
String arg = iter.next();
if (arg.contains("--package-path=")) {
rosPackagePath = arg.replace("--package-path=", "");
iter.remove();
break;
}
}
Collection<File> packagePath = Lists.newArrayList();
for (String path : rosPackagePath.split(File.pathSeparator)) {
File packageDirectory = new File(path);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment