diff --git a/cmake/rosjava.cmake.em b/cmake/rosjava.cmake.em index 87cf7cd..2a90eda 100644 --- a/cmake/rosjava.cmake.em +++ b/cmake/rosjava.cmake.em @@ -86,8 +86,8 @@ macro(catkin_rosjava_setup) ################################### add_custom_target(gradle-${PROJECT_NAME} ALL #COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} "env" "|" "grep" "ROS" - COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} ${gradle_options} ${gradle_tasks} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} ${gradle_options} --project-dir ${CMAKE_CURRENT_SOURCE_DIR} --project-cache-dir ${PROJECT_BINARY_DIR}/.gradle -PbuildDir=${PROJECT_BINARY_DIR} ${gradle_tasks} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} VERBATIM COMMENT "Gradling tasks for ${PROJECT_NAME}" ) @@ -110,7 +110,7 @@ macro(catkin_rosjava_setup) endif() add_custom_target(gradle-clean-${PROJECT_NAME} COMMAND ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} clean - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} COMMENT "Cleaning gradle project for ${PROJECT_NAME}" ) add_dependencies(gradle-clean gradle-clean-${PROJECT_NAME}) @@ -132,8 +132,8 @@ macro(catkin_android_setup) endif() add_custom_target(gradle-${PROJECT_NAME} ALL - COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} ${gradle_tasks} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} --project-dir ${CMAKE_CURRENT_SOURCE_DIR} --project-cache-dir ${PROJECT_BINARY_DIR}/.gradle -PbuildDir=${PROJECT_BINARY_DIR} ${gradle_tasks} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} VERBATIM ) catkin_package_xml() @@ -148,7 +148,7 @@ macro(catkin_android_setup) endif() add_custom_target(gradle-clean-${PROJECT_NAME} COMMAND ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} clean - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) add_dependencies(gradle-clean gradle-clean-${PROJECT_NAME}) endmacro() diff --git a/generate_environment_variables.py b/generate_environment_variables.py index 5d8f4ce..59c11f3 100755 --- a/generate_environment_variables.py +++ b/generate_environment_variables.py @@ -45,8 +45,12 @@ def get_environment_variable(environ, key): repo = get_environment_variable(environment_variables, 'ROS_MAVEN_DEPLOYMENT_REPOSITORY') if repo is None: repo = os.path.join(workspaces[0], 'share', 'maven') - else: + else: #ROS_MAVEN_DEPLOYMENT_REPOSITORY is already set if repo in [os.path.join(w, 'share', 'maven') for w in workspaces]: + # ROS_MAVEN_DEPLOYMENT_REPOSITORY is part of workspace chain + pass + else: + # ROS_MAVEN_DEPLOYMENT_REPOSITORY is NOT part of workspace chain, set to top-most workspace repo = os.path.join(workspaces[0], 'share', 'maven') print(repo) elif args.maven_repository: