Skip to content

Commit 6c39cc2

Browse files
committed
upgrade catkin indigo create scripts for android
1 parent 263c53e commit 6c39cc2

File tree

5 files changed

+42
-19
lines changed

5 files changed

+42
-19
lines changed

cmake/rosjava.cmake.em

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,7 @@ macro(catkin_android_setup)
126126
_rosjava_env()
127127
find_gradle()
128128
if( ${ARGC} EQUAL 0 )
129-
if(CMAKE_BUILD_TYPE STREQUAL "Release")
130-
set(gradle_tasks "assembleRelase")
131-
else()
132-
set(gradle_tasks "assembleDebug")
133-
endif()
129+
return() # Nothing to do (typically no subprojects created yet)
134130
else()
135131
set(gradle_tasks ${ARGV})
136132
endif()

src/rosjava_build_tools/create_android_project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def create_gradle_package_files(args, author, is_library, sdk_version):
100100
'''
101101
This is almost a direct copy from catkin_create_pkg.
102102
'''
103-
plugin_name = "android-library" if is_library else "android"
103+
plugin_name = "com.android.library" if is_library else "com.android.application"
104104
try:
105105
package_name = args.name[0].lower()
106106
package_path = os.path.abspath(os.path.join(os.getcwd(), package_name))

src/rosjava_build_tools/templates/android_package/CMakeLists.txt.in

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ project(%(repo_name)s)
1111

1212
find_package(catkin REQUIRED rosjava_build_tools)
1313
# Set the gradle targets you want catkin's make to run by default
14+
# e.g. usually catkin_android_setup(assembleRelease uploadArchives)
1415
catkin_android_setup(assembleRelease uploadArchives)
1516
catkin_package()
1617

@@ -19,8 +20,6 @@ catkin_package()
1920
# Installation
2021
##############################################################################
2122

22-
# If you are deploying android libraries (.aar's) uncomment this and
23-
# change this to match the maven group name you have specified in the
24-
# allprojects closure the root build.gradle
25-
#install(DIRECTORY ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_MAVEN_DESTINATION}/com/github/rosjava/${PROJECT_NAME}/
26-
# DESTINATION ${CATKIN_GLOBAL_MAVEN_DESTINATION}/com/github/rosjava/${PROJECT_NAME})
23+
# Deploy android libraries (.aar's) and applications (.apk's)
24+
install(DIRECTORY ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_MAVEN_DESTINATION}/com/github/rosjava/${PROJECT_NAME}/
25+
DESTINATION ${CATKIN_GLOBAL_MAVEN_DESTINATION}/com/github/rosjava/${PROJECT_NAME}/)

src/rosjava_build_tools/templates/android_package/build.gradle.in

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,32 @@ allprojects {
3232
}
3333

3434
subprojects {
35-
/* See https://github.com/rosjava/rosjava_bootstrap (look for gradle_plugins)
36-
to see what is going on under the hood. */
35+
/*
36+
* The android plugin configures a few things:
37+
*
38+
* - local deployment repository : where it dumps the jars and packaged artifacts)
39+
* - local maven repositories : where it finds your locally installed/built artifacts)
40+
* - external maven repositories : where it goes looking if it can't find dependencies locally
41+
* - android build tools version : which version we use across the board
42+
*
43+
* To modify, or add repos to the default external maven repositories list, pull request against this code:
44+
*
45+
* https://github.com/rosjava/rosjava_bootstrap/blob/indigo/gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosPlugin.groovy#L31
46+
*
47+
* To modify the build tools version, pull request against this code:
48+
*
49+
* https://github.com/rosjava/rosjava_bootstrap/blob/indigo/gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosAndroid.groovy#L14
50+
*/
3751
apply plugin: 'ros-android'
52+
53+
afterEvaluate { project ->
54+
android {
55+
// Exclude a few files that are duplicated across our dependencies and
56+
// prevent packaging Android applications.
57+
packagingOptions {
58+
exclude "META-INF/LICENSE.txt"
59+
exclude "META-INF/NOTICE.txt"
60+
}
61+
}
62+
}
3863
}

src/rosjava_build_tools/templates/android_project/build.gradle.in

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,22 @@
2626
/*
2727
dependencies {
2828
compile project(':local_android_library_dependency')
29-
compile 'org.ros.android_core:android_gingerbread_mr1:[0.2,0.3)'
29+
compile 'org.ros.android_core:android_10:[0.2,0.3)'
30+
compile 'org.ros.android_core:android_15:[0.2,0.3)'
3031
compile 'com.github.rosjava.android_extras:gingerbread:[0.2,0.3)'
32+
compile 'org.ros.rosjava_messages:tf2_msgs:[0.5,0.6)'
3133
}
3234
*/
3335

3436
apply plugin: '%(plugin_name)s'
3537

3638
android {
37-
packagingOptions {
38-
/* https://github.com/rosjava/android_core/issues/194 */
39-
exclude 'META-INF/LICENSE.txt'
40-
exclude 'META-INF/NOTICE.txt'
41-
}
4239
compileSdkVersion %(sdk_version)s
40+
defaultConfig {
41+
minSdkVersion %(sdk_version)s
42+
targetSdkVersion %(sdk_version)s
43+
versionCode 1
44+
versionName "1.0"
45+
}
4346
}
4447

0 commit comments

Comments
 (0)