-
Notifications
You must be signed in to change notification settings - Fork 9
Build sources jar for rcljava #56
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
Build sources jar for rcljava #56
Conversation
Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar>
jacobperron
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this!
I've given it a first pass and left some initial feedback. Was there some references used when adding this? It might be good to attribute any references used.
This is highly inspired in the add_jar function found in UseJava cmake module. It is also intended to be used together with it, as there are some functions defined in that module used here. |
Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar>
|
After looking at this a bit more, I'm confused why It seems rather simple to do from the command-line, e.g. @gonzodepedro Do you think we could make this cmake implementation simpler (to make maintenance easier)? It seems like there's a lot of special cases being handled that we don't care about. Really, all we want is a way to bundle resources files without doing any compiling. Roughly, I imagine the minimum function looking something like this: function(add_source_jar TARGET_NAME)
# argument parsing goes here ...
# Run 'jar passing source files directly (we don't really care what kinds of files they are)
add_custom_command(
OUTPUT ${_add_source_jar_OUTPUT}
COMMAND ${Java_JAR_EXECUTABLE} -cf ${_add_source_jar_OUTPUT} ${_add_source_jar_SOURCES}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_custom_target(${TARGET_NAME} ALL DEPENDS ${_add_source_jar_OUTPUT})
# Set install property (for 'install_jar()').
set_property(
TARGET ${_target_name}
PROPERTY
INSTALL_FILES ${_source_jar_file}
)
# Maybe also set JAR_FILE property?
# I don't think that JNI_SYMLINK or CLASSDIR makes sense for resource-only jars
endfunction()What do you think? |
Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar>
jacobperron
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for refactoring and moving to rcljava_common. Looks more straight-forward now 😅
A couple more minor comments, otherwise LGTM
rcljava/CMakeLists.txt
Outdated
| endif() | ||
| include(UseJava) | ||
| include(JavaExtra) | ||
| #include(cmake/add_source_jar.cmake) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we can remove this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
| "SOURCES" | ||
| ${ARGN} | ||
| ) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably handle the case where OUTPUT_NAME is not given. Maybe it can default to the "${_TARGET_NAME}.jar"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar>
* Add cmake function for bundling source files into a jar * Create and install source jar for rcljava Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> Co-authored-by: Jacob Perron <jacob@openrobotics.org>
* Add cmake function for bundling source files into a jar * Create and install source jar for rcljava Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> Co-authored-by: Jacob Perron <jacob@openrobotics.org>
Adds a cmake file and instructions to CMakeList.txt to build a sources jar for rcljava
Signed-off-by: Gonzalo de Pedro gonzalo@depedro.com.ar