diff --git a/gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosAndroid.groovy b/gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosAndroid.groovy new file mode 100644 index 0000000000000000000000000000000000000000..34c97042a0daab2b9d14237fb61e1cdc76017b2f --- /dev/null +++ b/gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosAndroid.groovy @@ -0,0 +1,26 @@ +package org.ros.gradle_plugins; + +import org.gradle.api.Project; +import org.gradle.api.Plugin; +import org.gradle.api.*; + +/* + * Configures java for the ros-android build environment. Pretty elementary right now, + * just applies the java plugin and defines the jdk compatibility level. + */ +class RosAndroidPlugin implements Plugin<Project> { + Project project + + def void apply(Project project) { + this.project = project + if (!project.plugins.findPlugin('ros')) { + project.apply(plugin: 'ros') + } + project.extensions.create("rosandroid", RosAndroidPluginExtension) + project.rosandroid.buildToolsVersion = "17" + } +} + +class RosAndroidPluginExtension { + String buildToolsVersion +} diff --git a/gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosPlugin.groovy b/gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosPlugin.groovy index 015dd02a25a2b9d46d5911800255802146b7c736..aa0e4d6cf9b142e131a0621ed86b4c398747ff9e 100644 --- a/gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosPlugin.groovy +++ b/gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosPlugin.groovy @@ -24,9 +24,9 @@ class RosPlugin implements Plugin<Project> { if (!project.plugins.findPlugin('maven')) { project.apply(plugin: org.gradle.api.plugins.MavenPlugin) } - /* Create project.ros.* property extensions */ - project.extensions.create("ros", RosPluginExtension) - project.ros.mavenPath = "$System.env.ROS_MAVEN_PATH".split(':') + /* Create project.ros.* property extensions */ + project.extensions.create("ros", RosPluginExtension) + project.ros.mavenPath = "$System.env.ROS_MAVEN_PATH".split(':') project.ros.mavenDeploymentPath = "$System.env.ROS_MAVEN_DEPLOYMENT_PATH" if ( project.ros.mavenDeploymentPath != 'null' && project.ros.mavenDeploymentPath != '' ) { project.uploadArchives { @@ -35,6 +35,10 @@ class RosPlugin implements Plugin<Project> { } } } + /* + * Could use some better handling for when this is not defined as it sets + * file://null, but it doesn't seem to hurt the process any + */ def repoURLs = project.ros.mavenPath.collect { 'file://' + it } project.repositories { repoURLs.each { p -> diff --git a/gradle_plugins/src/main/resources/META-INF/gradle-plugins/ros-android.properties b/gradle_plugins/src/main/resources/META-INF/gradle-plugins/ros-android.properties new file mode 100644 index 0000000000000000000000000000000000000000..b8c7cfa9a00e7a746dbf4da5e3dfd0f07f004cf4 --- /dev/null +++ b/gradle_plugins/src/main/resources/META-INF/gradle-plugins/ros-android.properties @@ -0,0 +1 @@ +implementation-class=org.ros.gradle_plugins.RosAndroidPlugin \ No newline at end of file