[Documentation] [TitleIndex] [WordIndex

Note: This tutorial assumes that you have completed the previous tutorials: Android Getting Started.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Updating Android Maven Artifacts

Description: This tutorial explains how to update the artifacts in https://github.com/ros-java/rosjava_mvn_repo when changes are made to the corresponding libraries.

Tutorial Level: INTERMEDIATE

Debs

You will need wstool for this to work.

$ sudo apt-get install python-wstool

or when that is not possible, fall back to pip:

$ sudo pip install -U wstool

Also you need to install rosdep

Build Library Sources

Do not source a ROS distribution. If you have previously updated the Maven artifacts, I would still recommend deleting those workspaces and starting again to make sure you get a clean environment.

Set up some chained catkin workspaces to modularise the builds and save some compile times.

For the messages you want to compile into rosjava_messages and their dependencies:

$ mkdir -p ~/messages
$ wstool init -j4 ~/messages/src https://raw.github.com/ros-java/rosjava_mvn_repo/hydro-devel/rosjava_msgs.rosinstall
$ cd ~/messages
$ rosdep install --from-paths ./src --ignore-src
$ ~/messages/src/catkin/bin/catkin_make_isolated --install

For the actual rosjava libraries:

$ mkdir -p ~/rosjava
$ wstool init -j4 ~/rosjava/src https://raw.github.com/ros-java/rosjava_tools/hydro-devel/rosjava.rosinstall
$ cd ~/rosjava
$ source ~/messages/install_isolated/setup.bash
$ catkin_make

Now the android workspace:

$ mkdir -p ~/android
$ wstool init -j4 ~/android/src https://raw.github.com/ros-java/rosjava_tools/hydro-devel/android_core.rosinstall
$ source ~/rosjava/devel/setup.bash
$ cd ~/android
$ catkin_make

At the time of writing this, the default branch is hydro-devel. It is possible that you will want to update the artifacts based on a non-default branch. In that case remember to switch to the appropriate branch either after cloning the repo.

Once you've used catkin_make to confirm that everything builds, you want to upload the artifacts.

Clone the artifacts repo to somewhere appropriate:

$ git clone https://github.com/ros-java/rosjava_mvn_repo.git

The easiest thing at this point is actually to remove all the existing artifacts. Since it's source controlled, we can always revert to a previous commit anyway if you need the old artifacts.

$ cd rosjava_mvn_repo
$ git rm -r ros
$ git rm -r com

Currently the libraries included in the maven repo are:

Currently you can add the following lines to the build.gradle file of each of these library folders to override the default uploadArchives task:

uploadArchives {
  repositories {
    mavenDeployer {
      repository(url: 'file://PATH_TO_rosjava_mvn_repo/')
      //example repository(url: 'file:///home/code/rosjava_mvn_repo/') 
    }
  }
}

There is a script, append_upload_script.py, in the rosjava_mvn_repo that will do this for you though. As the first argument it takes the location of where you cloned the rosjava_mvn_repo, so it can upload the archives there. And then the rest of the arguments are the locations of the folders listed above. Your command my look something like this (assuming you cloned rosjava_mvn_repo in your home directory, otherwise change the paths accordingly):

$ python ~/rosjava_mvn_repo/append_upload_script.py ~/rosjava_mvn_repo ~/rosjava/src/rosjava_core/apache_xmlrpc_client ~/rosjava/src/rosjava_core/apache_xmlrpc_common ~/rosjava/src/rosjava_core/apache_xmlrpc_server ~/rosjava/src/rosjava_core/rosjava ~/rosjava/src/rosjava_core/rosjava_bootstrap ~/rosjava/src/rosjava_core/rosjava_messages ~/rosjava/src/rosjava_core/rosjava_geometry ~/android/src/android_core/android_gingerbread_mr1 ~/android/src/android_core/android_honeycomb_mr2 ~/android/src/android_core/android_acm_serial ~/android/src/android_extras/gingerbread ~/android/src/android_extras/zxing ~/android/src/android_extras/ros_master_browser ~/rosjava/src/zeroconf_jmdns_suite/jmdns ~/rosjava/src/rosjava_extras/hokuyo

If you would like to add the archives for all folders to the rosjava_mvn_repo, then you can put that code block in the parent build.gradle for the whole repository. That's the different between changing the build.gradle in rosjava_core versus changing the build.gradle files in rosjava, rosjava_messages, etc.

Now, once those changes are made you can just run the following command in the parent directory (i.e. rosjava_core, android_core, android_extras, zeroconf_jmdns_suite):

$ ./gradlew UploadArchives

This will publish the archives you chose into wherever you cloned rosjava_mvn_repo.

Now commit and push your changes. Go to rosjava_mvn_repo. You most likely just want to commit all your changes and push them.

$ git add --all
$ git commit -m "YOUR COMMIT MESSAGE"
$ git push

Test your changes by checking out the android_apps repo and building it as described here.

If you want to add more libraries to this set you can fork rosjava_mvn_repo. You can follow these instructions and just add the library to one of the workspaces. Then make sure you add the UploadArchives task to the build.gradle and submit a pull request.


2018-12-08 12:18