Coder Social home page Coder Social logo

genjava's Introduction

RosJava

Metapackage for the official rosjava repositories.

See the rosjava_core readme for more details.

genjava's People

Contributors

adamantivm avatar daniel-s-ingram avatar exo-core avatar meyerj avatar peci1 avatar stonier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

genjava's Issues

catkin_make_isolated failed to generate java source for message file

#1. reproduce steps

1.1 create a test message catkin package
mkdir -p ~/test/src/my_msgs/msg

echo "
<?xml version="1.0"?>
<package>
  <name>my_msgs</name>
  <version>0.0.1</version>
  <description>
  This package is just for message test.
  </description>
  <maintainer email="[email protected]">Test</maintainer>
  <license>BSD</license>
  <url type="website">http://ros.org/wiki/test</url>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>message_generation</build_depend>
  <build_depend>geometry_msgs</build_depend>
  <build_depend>std_msgs</build_depend>
  <run_depend>message_runtime</run_depend>
  <run_depend>geometry_msgs</run_depend>
  <run_depend>std_msgs</run_depend>
</package>
" >  ~/test/src/my_msgs/package.xml
echo "
cmake_minimum_required(VERSION 2.8.3)
project(my_msgs)

set(MSG_DEPS
    std_msgs
    geometry_msgs
    )

find_package(catkin REQUIRED COMPONENTS
  message_generation
  ${MSG_DEPS}
)

set(MSG_FILES Test.msg)
add_message_files(DIRECTORY msg FILES ${MSG_FILES})
generate_messages(DEPENDENCIES ${MSG_DEPS})

catkin_package(CATKIN_DEPENDS message_runtime ${MSG_DEPS})
" > ~/test/src/my_msgs/CMakeLists.txt
echo "
Header header
uint32 id
uint32 confidence
geometry_msgs/PoseStamped pose
" > ~/test/src/my_msgs/msg/Test.msg

1.2 build test package using catkin_make_isolated
cd ~/test && catkin_make_isolated

1.3 check generated java source for message
$ ls build_isolated/my_msgs/java/my_msgs/src/main/java/my_msgs
ls: cannot access build_isolated/my_msgs/java/my_msgs/src/main/java/my_msgs: No such file or directory
#2. the cause

By comparing to the build.gradle generated by catkin_make, I find that there is trailing "/." in "--package-path" path:
$ grep package-path build_isolated/my_msgs/java/my_msgs/build.gradle
args = new ArrayList<String>([generated_sources_directory, '--package-path=/home/xxx/test/src/my_msgs/.', 'my_msgs'])

After removing the trailing "/." in "--package-path" path in build.gradle, it could successfully generate the java source:
$ ls build_isolated/my_msgs/java/my_msgs/src/main/java/my_msgs
Test.java
#3. how to fix

Here is the change I made on genjava/src/genjava/gradle_project.py (just for your reference).

diff --git a/src/genjava/gradle_project.py b/src/genjava/gradle_project.py
index 39d5957..3d1df38 100644
--- a/src/genjava/gradle_project.py
+++ b/src/genjava/gradle_project.py
@@ -155,6 +155,7 @@ def create(msg_pkg_name, output_dir):

     create_gradle_wrapper(genjava_gradle_dir)
     pkg_directory = os.path.dirname(msg_package_index[msg_pkg_name].filename)
+    pkg_directory = os.path.abspath(pkg_directory)
     msg_pkg_version = msg_package_index[msg_pkg_name].version
     populate_project(msg_pkg_name, msg_pkg_version, pkg_directory, genjava_gradle_dir, msg_dependencies)

ImportError: No module named rosdistro

When i compile my java messages on ROS build farm.
(but working on local workspace)

==> make -j1 in '/tmp/catkin_workspace/build_isolated/smarthome_media_msgs_java'
Scanning dependencies of target smarthome_media_msgs_java_generate_artifacts
[100%] Compiling rosjava message artifacts for [smarthome_media_msgs]
Traceback (most recent call last):
File "/opt/ros/indigo/share/genjava/cmake/../../../lib/genjava/genjava_message_artifacts", line 11, in
import genjava
File "/opt/ros/indigo/lib/python2.7/dist-packages/genjava/init.py", line 39, in
from .genjava_main import main, standalone_main
File "/opt/ros/indigo/lib/python2.7/dist-packages/genjava/genjava_main.py", line 45, in
import rosjava_build_tools
File "/opt/ros/indigo/lib/python2.7/dist-packages/rosjava_build_tools/init.py", line 12, in
from release import scrape_for_release_message_packages
File "/opt/ros/indigo/lib/python2.7/dist-packages/rosjava_build_tools/release.py", line 7, in
import rosdistro
ImportError: No module named rosdistro
make[2]: *** [CMakeFiles/smarthome_media_msgs_java_generate_artifacts] Error 1
make[1]: *** [CMakeFiles/smarthome_media_msgs_java_generate_artifacts.dir/all] Error 2
make: *** [all] Error 2
<== Failed to process package 'smarthome_media_msgs_java':

For : https://github.com/rosalfred/smarthome_media_msgs_java
Job : http://build.ros.org/job/Idev__smarthome_media_msgs_java__ubuntu_trusty_amd64/2/console

Any idea ?
Thank.

Genjava cmake api failing on the build farm

Getting problems with an undefined GENJAVA_DIR variable on the build farm.

See this jenkins job for rosjava_messages.

Excerpt of the error below:

-- Using these message generators: gencpp;genjava;genlisp;genpy
CMake Error: An attempt was made to access a variable: GENJAVA_DIR that has not been defined. This variable is created by the FIND_PACKAGE command. CMake version 1.6 always converted the variable name to upper-case, but this behavior is no longer the case.  To fix this you might need to set the cache value of CMAKE_BACKWARDS_COMPATIBILITY to 1.6 or less.  If you are writing a CMake listfile, you should change the variable reference to use the case of the argument to FIND_PACKAGE.
CMake Error: An attempt was made to access a variable: GENJAVA_DIR that has not been defined. This variable is created by the FIND_PACKAGE command. CMake version 1.6 always converted the variable name to upper-case, but this behavior is no longer the case.  To fix this you might need to set the cache value of CMAKE_BACKWARDS_COMPATIBILITY to 1.6 or less.  If you are writing a CMake listfile, you should change the variable reference to use the case of the argument to FIND_PACKAGE.
-- Configuring incomplete, errors occurred!
dh_auto_configure: cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCATKIN_BUILD_BINARY_PACKAGE=1 -DCMAKE_INSTALL_PREFIX=/opt/ros/indigo -DCMAKE_PREFIX_PATH=/opt/ros/indigo returned exit code 1
make[1]: *** [override_dh_auto_configure] Error 2
make[1]: Leaving directory `/tmp/buildd/ros-indigo-rosjava-messages-0.2.1-0saucy-20150226-0730'
make: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2
E: Failed autobuilding of package

ROS Melodic release for rosjava

Hi.

I see that rosjava does not have support for ROS Melodic as of yet. Being a relative newbie to the java world and the gradle build system, from what I attempted, it seems that all that is required is an upgrade in the gradle version to >= 4.7.

For the ROS message generators to work, it seems that they might have to be pre-installed before the workspace is built. Installing genjava and rosjava_build_tools from source and building it together with the rest of the ROS workspace results in some message dependencies not having the jar files built, due to race conditions in which packages get compiled first.

Hence, should a melodic branch be created for the relevant rosjava repos. I can submit some PRs for the update of the gradle version. Not sure how the release process works, and how long after being accepted will these changes be obtainable using rosdep

genjava should be able to recognize which message files really need rebuilding

At this moment, whenever I have genjava enabled in my workspace, every catkin_make call regenerates all the Java msg targets. This takes a lot of unnecessary time (if no message file has changed).

It is needed to implement a behavior similar to the other generators, so that only the message files changed since the last build are rebuilt.

Add message dependencies only if in source

Getting

CMake Warning (dev) at /opt/groot/rosjava/devel/share/genjava/cmake/genjava-catkin-api.cmake:51 (add_dependencies):
  Policy CMP0046 is not set: Error on non-existent dependency in
  add_dependencies.  Run "cmake --help-policy CMP0046" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  The dependency target "stereo_msgs_generate_messages" of target
  "rosjava_messages_generate_artifacts" does not exist.
Call Stack (most recent call first):
  rosjava_messages/CMakeLists.txt:14 (generate_rosjava_messages)
This warning is for project developers.  Use -Wno-dev to suppress it.

when the underlying stereo_msgs is installed as a deb, but not in the source workspace.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.