This repository has been archived by the owner on Nov 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 in LIBS/ihmc-pub-sub from feature/move-generato…
…r-in-with-pub-sub to develop * commit 'e83470f39effacee882b12eee7468f6797444af0': Move ihmc-pub-sub-generator into ihmc-pub-sub repo. Delete the submodule for now. We are going to switch to Gradle clone instead.
- Loading branch information
Showing
237 changed files
with
6,909 additions
and
144 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,145 +1,11 @@ | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
maven { url "http://dl.bintray.com/ihmcrobotics/maven-release" } | ||
maven { url "http://dl.bintray.com/ihmcrobotics/maven-vendor" } | ||
maven { url "https://plugins.gradle.org/m2/" } | ||
mavenLocal() | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath "us.ihmc:ihmc-build:0.12.8" | ||
classpath "us.ihmc:ihmc-pub-sub-generator:0.3.7" | ||
classpath "gradle.plugin.nl.javadude.gradle.plugins:license-gradle-plugin:0.13.1" | ||
} | ||
} | ||
apply plugin: "us.ihmc.ihmc-build" | ||
apply plugin: "com.github.hierynomus.license" | ||
|
||
ihmc { | ||
group = "us.ihmc" | ||
version = "0.4.0" | ||
vcsUrl = "https://github.com/ihmcrobotics/ihmc-pub-sub" | ||
openSource = true | ||
maintainer = "Jesper Smith ([email protected])" | ||
|
||
configureDependencyResolution() | ||
resourceDirectory("main", "idl") | ||
javaDirectory("main", "generated") | ||
javaDirectory("main", "../../swig/FastRTPS/generated") | ||
configurePublications() | ||
} | ||
|
||
// For swig builds | ||
//buildDir = 'build-java' | ||
|
||
task generateChatMessage(type: us.ihmc.idl.generator.IDLGeneratorTask) { | ||
idlFiles = fileTree(dir: 'idl') | ||
includeDirs = files(".", "idl") | ||
targetDirectory = file("src/main/generated") | ||
packagePrefix = "us.ihmc.idl.generated" | ||
} | ||
|
||
license { | ||
header rootProject.file('license-header.txt') | ||
ext.year = Calendar.getInstance().get(Calendar.YEAR) | ||
strictCheck true | ||
} | ||
|
||
mainDependencies { | ||
compile group: 'us.ihmc', name: 'IHMCNativeLibraryLoader', version: '1.0' | ||
compile group: 'net.sf.trove4j', name: 'trove4j', version: '3.0.3' | ||
compile group: "us.ihmc", name: "euclid-core", version: "0.4.13" | ||
} | ||
|
||
testDependencies { | ||
compile group: 'junit', name: 'junit', version: '4.11' | ||
} | ||
|
||
task wrapper(type: Wrapper) { | ||
gradleVersion = '4.5' | ||
} | ||
|
||
//sourceSets { | ||
// main { | ||
// java { | ||
// srcDirs += ['swig/FastRTPS/generated'] | ||
// srcDirs += ['generated'] | ||
// } | ||
// } | ||
// | ||
// code { | ||
// java { | ||
// srcDirs += ['src', 'test'] | ||
// } | ||
// } | ||
//} | ||
|
||
// sourceSets = project.container(SourceSet) | ||
// sourceSets.add(project.sourceSets.code) | ||
|
||
//task sourceJar(type: Jar) { | ||
// from sourceSets.main.allJava | ||
//} | ||
// | ||
//jar { | ||
// manifest { | ||
// attributes( | ||
// "Created-By": "IHMC Gradle Build Script", | ||
// "Implementation-Title": project.name, | ||
// "Implementation-Version": project.version, | ||
// "Implementation-Vendor": "IHMC", | ||
// | ||
// "Bundle-Name": project.name, | ||
// "Bundle-Version": project.version, | ||
// "Bundle-License": "http://www.apache.org/licenses/LICENSE-2.0.txt", | ||
// "Bundle-Vendor": "IHMC") | ||
// } | ||
//} | ||
|
||
//repositories { | ||
// jcenter() | ||
// mavenCentral() | ||
// maven { url "http://dl.bintray.com/ihmcrobotics/maven-release" } | ||
//} | ||
|
||
//publishing { | ||
// publications { | ||
// mavenJava(MavenPublication) { | ||
// | ||
// groupId 'us.ihmc' | ||
// artifactId project.name | ||
// version "$version" | ||
// from components.java | ||
// | ||
// pom.withXml { | ||
// asNode().children().last() + { | ||
// resolveStrategy = Closure.DELEGATE_FIRST | ||
// name project.name | ||
// url project.ext.vcsUrl | ||
// licenses { | ||
// license { | ||
// name 'The Apache Software License, Version 2.0' | ||
// url 'http://www.apache.org/license/LICENSE-2.0.txt' | ||
// distribution 'repo' | ||
// } | ||
// } | ||
// developers { | ||
// developer { | ||
// id 'jsmith' | ||
// name 'Jesper Smith' | ||
// email '[email protected]' | ||
// } | ||
// } | ||
// } | ||
// } | ||
// | ||
// artifact sourceJar { | ||
// classifier "sources" | ||
// } | ||
// } | ||
// } | ||
//} | ||
|
||
//def labels = ['ihmc', 'java', 'rtps', 'dds', 'net'] | ||
//ihmc.configureForIHMCOpenSourceBintrayPublish(false, "mavenJava", "maven-release", labels) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
kebabCasedName = ihmc-pub-sub | ||
pascalCasedName = IHMCPubSub | ||
extraSourceSets = ["test"] | ||
isProjectGroup = true | ||
kebabCasedName = ihmc-pub-sub-group | ||
pascalCasedName = IHMCPubSubGroup | ||
publishMode = LOCAL | ||
depthFromWorkspaceDirectory = 0 | ||
excludeFromCompositeBuild = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# IHMC Pub/Sub Generator | ||
|
||
The IHMC Pub/Sub generator creates Java classes from OMG DDS IDL formatted files. The resulting classes can be used in conjunction with [IHMC Pub/Sub](https://github.com/ihmcrobotics/ihmc-pub-sub) to serialize and deserialize to the Common Data Representation(CDR) format. | ||
|
||
## Toolchain | ||
- [IHMC Pub/Sub](https://github.com/ihmcrobotics/ihmc-pub-sub): IHMC Pub/Sub RTPS library | ||
- [IHMC Pub/Sub generator](https://github.com/ihmcrobotics/ihmc-pub-sub-generator): Gradle plugin and standalone application to generate java classes from .idl messages. | ||
- [IHMC RTPS Visualizer](https://github.com/ihmcrobotics/ihmc-rtps-visualizer): GUI to display partitions, topics, participants, subscribers, publisher and publisher data on a RTPS domain. | ||
- [IHMC Pub/Sub serializers extra](https://github.com/ihmcrobotics/ihmc-pub-sub-serializers-extra): Optional serializer to generated JSON, BSON, YAML, Java Properties and XML(limited) output from .idl messages. | ||
|
||
## License | ||
The IHMC Pub/Sub generator is licensed under the Apache 2.0. See LICENSE.txt | ||
|
||
## Features | ||
- Pure Java serialization/deserialization. Allows message generation without having to compile native libraries. | ||
- Allocation free during serialization/deserialization. All elements of the message are preallocated. | ||
- StringBuilder instead of string allow allocation free string deserialzation. | ||
- Support for wchar and wstring to map directly to Java's UTF-16. | ||
- Automatically generated equals() and toString() methods for testing and debugging. | ||
- Support for #include directives and other C preprocessor directives. The include search path is the current directory and the parent directory of the .idl file. | ||
- Optional (using [IHMC pub/sub serializers extra](https://github.com/ihmcrobotics/ihmc-pub-sub-serializers-extra) ) serialization and deserialization to JSON/BSON/YAML and XML. | ||
- @Abstract(type="[fully qualified class name]") annotation to generate an abstract Pub/Sub type. This allows reusing exisiting Java data objects in combination with IDL specified data without marshalling. Use [Name]PubSubType.setImplementation() to implement. | ||
|
||
### Limitations | ||
- Sequences of arrays and arrays of sequences are not supported. | ||
- Long Doubles are not supported due to limitations in the Java language. | ||
- Union, alias, value, sparse, set and map are not implemented. | ||
- Interfaces are not implemented. | ||
|
||
### Compatibility notes | ||
- CDR Byte stream is validated against FastCDR generated byte stream. | ||
- FastRTPS's fastrtpsgen does not seem to support wstring and Sequence\<Enum\> | ||
|
||
|
||
## Usage | ||
|
||
The IHMC Pub/Sub generator can either be used as a gradle plugin (recommended) or standalone library. | ||
|
||
### Gradle | ||
Include the IHMC Pub Sub Generator into your build file | ||
``` | ||
buildscript { | ||
repositories { | ||
maven { | ||
url "http://dl.bintray.com/ihmcrobotics/maven-release" | ||
} | ||
} | ||
dependencies { | ||
classpath group: 'us.ihmc', name: 'IHMCPubSubGenerator', version: '0.2.4' | ||
} | ||
} | ||
``` | ||
|
||
This creates a task to compile IDL files. The following properties can be set | ||
- idlFiles: FileCollection of idl files to compile [Required] | ||
- inludeDirs: FileCollection of include directories | ||
- targetDirectory: File target directory | ||
|
||
``` | ||
task generateIDL(type: us.ihmc.idl.generator.IDLGeneratorTask) { | ||
idlFiles = fileTree(dir: 'idl') | ||
includeDirs = files(".") | ||
targetDirectory = file("generated") | ||
packagePrefix = "us.ihmc.idl.generated" | ||
} | ||
``` | ||
|
||
|
||
|
||
### Java application | ||
Run us.ihmc.idl.generator.IDLGenerator. There are three options for generating IDL files | ||
|
||
- No command line arguments: Dialogs will popup to select the IDL file and provide a target directory and package name. | ||
- Command line arguments: us.ihmc.idl.generator.IDLGenerator \[idl filename\] \[package\] \[target directory\] | ||
- Call directly from Java: us.ihmc.idl.generator.IDLGenerator.execute(String idlFilename, String packageName, File targetDirectory) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
buildscript { | ||
repositories { | ||
maven { url "https://plugins.gradle.org/m2/" } | ||
mavenLocal() | ||
maven { url "http://dl.bintray.com/ihmcrobotics/maven-release" } | ||
maven { url "http://dl.bintray.com/ihmcrobotics/maven-vendor" } | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath "us.ihmc:ihmc-build:0.12.8" | ||
classpath group: "us.ihmc", name: "ihmc-pub-sub-generator", version: "0.3.8-LOCAL" | ||
classpath "gradle.plugin.nl.javadude.gradle.plugins:license-gradle-plugin:0.13.1" | ||
} | ||
} | ||
apply plugin: "us.ihmc.ihmc-build" | ||
apply plugin: "com.github.hierynomus.license" | ||
apply plugin: "application" | ||
|
||
buildDir = "build-java" | ||
mainClassName = "us.ihmc.idl.generator.IDLGenerator" | ||
|
||
ihmc { | ||
group = "us.ihmc" | ||
version = "0.3.8" | ||
vcsUrl = "https://stash.ihmc.us/projects/LIBS/repos/ihmc-pub-sub-generator" | ||
openSource = true | ||
maintainer = "Jesper Smith ([email protected])" | ||
|
||
configureDependencyResolution() | ||
resourceDirectory("main", "templates") | ||
javaDirectory("test", "generated-java") | ||
resourceDirectory("test", "idl") | ||
configurePublications() | ||
} | ||
|
||
dependencies { | ||
compile gradleApi() | ||
compile group: "us.ihmc.thirdparty.eprosima", name: "idl-parser", version: "1.0.0-ihmc3" | ||
compile group: "org.anarres", name: "jcpp", version: "1.4.12" | ||
compile group: "us.ihmc", name: "euclid-core", version: "0.4.13" | ||
} | ||
|
||
testDependencies { | ||
compile group: "us.ihmc", name: "ihmc-pub-sub", version: "0.4.0" | ||
compile group: "junit", name: "junit", version: "4.12" | ||
} | ||
|
||
license { | ||
header rootProject.file("license-header.txt") | ||
ext.year = Calendar.getInstance().get(Calendar.YEAR) | ||
strictCheck true | ||
|
||
sourceSets = project.container(SourceSet) | ||
sourceSets.add(ihmc.sourceSet("main")) | ||
} | ||
|
||
task generateIDLElementTest(type: us.ihmc.idl.generator.IDLGeneratorTask) { | ||
idlFiles = fileTree(dir: "src/test/idl") | ||
includeDirs = files(".", "idl") | ||
targetDirectory = file("src/test/generated-java") | ||
packagePrefix = "us.ihmc.idl.generated" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kebabCasedName = ihmc-pub-sub-generator | ||
pascalCasedName = IHMCPubSubGenerator | ||
extraSourceSets = ["test"] | ||
publishMode = LOCAL | ||
groupDependencyVersion = source | ||
depthFromWorkspaceDirectory = 1 | ||
excludeFromCompositeBuild = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
buildscript { | ||
repositories { | ||
maven { url "https://plugins.gradle.org/m2/" } | ||
mavenLocal() | ||
} | ||
dependencies { | ||
classpath "us.ihmc:ihmc-build:0.12.8" | ||
} | ||
} | ||
|
||
import us.ihmc.build.IHMCSettingsConfigurator | ||
|
||
/** | ||
* Browse source at https://github.com/ihmcrobotics/ihmc-build | ||
*/ | ||
def ihmcSettingsConfigurator = new IHMCSettingsConfigurator(settings, logger, ext) | ||
ihmcSettingsConfigurator.checkRequiredPropertiesAreSet() | ||
ihmcSettingsConfigurator.configureExtraSourceSets() | ||
ihmcSettingsConfigurator.findAndIncludeCompositeBuilds() |
Oops, something went wrong.