Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for idlpp's -j option #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## [UNRELEASED](https://github.com/atolab/vortex-gateway/tree/master)
- add `renamePackages` to `opensplice-idl-plugin` (uses idlpp's `-j` option)

## [3.0.1](https://github.com/atolab/vortex-gateway/tree/V3.0.0) - 2018-05-14

Expand Down
44 changes: 24 additions & 20 deletions opensplice-idl-plugin/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,37 +33,41 @@ source files to be compiled by Maven during the "compile" phase.

In addition, the following optional parameters can be configured:

[options="header",cols="15,15,70"]
[options="header",cols="18,15,70"]
|===============================================================================
| Name | Type | Description
| Name | Type | Description

| outDir | File | The directory to output the generated sources to.
| outDir | File | The directory to output the generated sources to.

Default value is:
*${project.build.directory}/generated-sources/idl*
Default value is:
*${project.build.directory}/generated-sources/idl*

| includeDirs | File[] | Additional include directories containing additional
*.idl files required for compilation.
| includeDirs | File[] | Additional include directories containing
additional *.idl files required for compilation.

| idlDir | File | The source directory containing +++*+++.idl files.
| idlDir | File | The source directory containing +++*+++.idl files.

Default value is:
*${basedir}/src/main/idl*
Default value is:
*${basedir}/src/main/idl*

| macros | String[] | Preprocessing macros definitions
(used with `-D` options)
| macros | String[] | Preprocessing macros definitions
(used with `-D` options)

| idlc | String | The compiler executable.
| idlc | String | The compiler executable.

Default value is: *idlc*
Default value is: *idlc*

| language | String | The language of generated code.
Should be one of `java`, `c`, `c++` or `cs`.
| language | String | The language of generated code.
Should be one of `java`, `c`, `c++` or `cs`.

Default value is: *java*
Default value is: *java*

| mode | String | Standalone or CORBA mode.
Should be either `-S` or `-C`.
| mode | String | Standalone or CORBA mode.
Should be either `-S` or `-C`.

Default value is: *-S*

| renamePackages | String[] | Rename or prefix packages using the idlpp's `-j`
option. Applies only when generating Java code.

Default value is: *-S*
|===============================================================================
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ public class IDLMojo
@Parameter(property = "opensplice.idlc.mode", defaultValue = "-S")
private String mode;

/**
* rename packages. renames should be specified in the form "[old]:new". if "old" is specified,
* then the (partial) package name matching "old" is replaced with "new". otherwise, all packages
* prefixed with "new". applicable only for the Java programming language
* @ parameter
*/
@Parameter
private String[] renamePackages;

/**
* Process arguments
*/
Expand Down Expand Up @@ -168,6 +177,15 @@ public void execute() throws MojoExecutionException
}
}

if (renamePackages != null && renamePackages.length > 0)
{
for (int x = 0; x < renamePackages.length; x++)
{
arguments.add("-j");
arguments.add(renamePackages[x]);
}
}

boolean idlExists = false;
IDLProcessor proc = new IDLProcessor(getLog());
String idlFile = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ public void testFields() throws Exception
String mode = (String) getVariableValueFromObject(mojo, "mode");
assertTrue(mode.equals("-S"));

String[] renames = (String[]) getVariableValueFromObject(mojo, "renamePackages");
assertTrue(renames.length == 2);
assertTrue(renames[0].equals("package:my.package"));
assertTrue(renames[1].equals("from.package:to.package"));

File idlDir = (File) getVariableValueFromObject(mojo, "idlDir");
assertTrue(idlDir.getName().equals("project1"));

Expand Down
4 changes: 4 additions & 0 deletions opensplice-idl-plugin/src/test/resources/project1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
<macro>Hello</macro>
<macro>World</macro>
</macros>
<renamePackages>
<renamePackage>package:my.package</renamePackage>
<renamePackage>from.package:to.package</renamePackage>
</renamePackages>
<language>java</language>
<mode>-S</mode>
</configuration>
Expand Down