From 4f68a67353198fc35c4e9d2d3ed00dcc6e5b1b39 Mon Sep 17 00:00:00 2001
From: Daniel Stonier <d.stonier@gmail.com>
Date: Tue, 17 Sep 2013 09:32:12 +0900
Subject: [PATCH] first iteration on android plugin

---
 .../org/ros/gradle_plugins/RosAndroid.groovy  | 26 +++++++++++++++++++
 .../org/ros/gradle_plugins/RosPlugin.groovy   | 10 ++++---
 .../gradle-plugins/ros-android.properties     |  1 +
 3 files changed, 34 insertions(+), 3 deletions(-)
 create mode 100644 gradle_plugins/src/main/groovy/org/ros/gradle_plugins/RosAndroid.groovy
 create mode 100644 gradle_plugins/src/main/resources/META-INF/gradle-plugins/ros-android.properties

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 0000000..34c9704
--- /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 015dd02..aa0e4d6 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 0000000..b8c7cfa
--- /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
-- 
GitLab