Change output, add more metadata

Samples have emitXX tasks that emit sanitized versions of the
samples for various build environment (e.g. emitAnt). This change
makes the emit tasks put their output in platform/developers/build/out
rather than in each individual sample's build directory.

Also included: _index.jd creation.

Change-Id: Id1ec3588f682202fc82b7ba868cdaae8e7c579fc
diff --git a/build.gradle b/build.gradle
index 220840c..0942511 100644
--- a/build.gradle
+++ b/build.gradle
@@ -25,11 +25,20 @@
 }
 
 task wrapper(type: Wrapper) {
-    gradleVersion = '1.6'
+    gradleVersion = '1.8'
 }
 
+
+String outPath(String buildType) {
+    def repoInfo = "repo info platform/developers/build".execute().text
+    def buildPath = (repoInfo =~ /Mount path: (.*)/)[0][1]
+    return "${buildPath}/out/${buildType}/${samplegen.targetSampleName()}";
+}
+
+
+
 task emitAnt(type:Copy) {
-    def outputPath = "${samplegen.pathToBuild}/ant"
+    def outputPath = outPath("ant");
     def inputPath = "${project.projectDir}/${samplegen.targetSampleModule()}"
     mkdir outputPath
     into outputPath
@@ -47,11 +56,13 @@
 }
 
 task emitBrowseable(type:Copy) {
-    def outputPath = "${samplegen.pathToBuild}/browsable"
+    def outputPath =outPath("browseable");
     def inputPath = "${project.projectDir}/${samplegen.targetSampleModule()}"
     mkdir outputPath
     into outputPath
 
+    from("${project.projectDir}/_index.jd")
+
     ["main", "common", "template"].each { input ->
         def srcPath = "${inputPath}/src/${input}"
         into("src") {
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 2db904e..ba5f04a 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -15,4 +15,4 @@
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
diff --git a/templates/base/_MODULE_/build.gradle.ftl b/templates/base/_MODULE_/build.gradle.ftl
index 32c65ca..2450ee9 100644
--- a/templates/base/_MODULE_/build.gradle.ftl
+++ b/templates/base/_MODULE_/build.gradle.ftl
@@ -19,7 +19,7 @@
     }
 
     dependencies {
-        classpath 'com.android.tools.build:gradle:0.5.+'
+        classpath 'com.android.tools.build:gradle:0.6.+'
     }
 }
 
diff --git a/templates/base/_index.jd.ftl b/templates/base/_index.jd.ftl
new file mode 100644
index 0000000..c25f998
--- /dev/null
+++ b/templates/base/_index.jd.ftl
@@ -0,0 +1,6 @@
+<#ftl>
+page.tags=<#list sample.tag as tag>"${tag}",</#list>"${sample.name}"
+sample.group=${sample.group}
+@jd:body
+
+<p>${sample.strings.intro}</p>
diff --git a/templates/create/._IDE_/.name.ftl b/templates/create/._IDE_/.name.ftl
deleted file mode 100644
index 52f9788..0000000
--- a/templates/create/._IDE_/.name.ftl
+++ /dev/null
@@ -1,2 +0,0 @@
-<#ftl>
-${sample.name}
diff --git a/templates/create/._IDE_/gradle.xml b/templates/create/._IDE_/gradle.xml
deleted file mode 100644
index a9986e4..0000000
--- a/templates/create/._IDE_/gradle.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="GradleSettings">
-    <option name="linkedExternalProjectsSettings">
-      <GradleProjectSettings>
-        <option name="externalProjectPath" value="$PROJECT_DIR$/build.gradle" />
-        <option name="useAutoImport" value="true" />
-      </GradleProjectSettings>
-    </option>
-  </component>
-</project>
-
diff --git a/templates/create/._IDE_/modules.xml.ftl b/templates/create/._IDE_/modules.xml.ftl
deleted file mode 100644
index 4108150..0000000
--- a/templates/create/._IDE_/modules.xml.ftl
+++ /dev/null
@@ -1,10 +0,0 @@
-<#ftl>
-<project version="4">
-  <component name="ProjectModuleManager">
-    <modules>
-        <module fileurl="file://$PROJECT_DIR$/${sample.name}.iml" filepath="$PROJECT_DIR$/${sample.name}.iml" />
-        <module fileurl="file://$PROJECT_DIR$/${meta.module}/${meta.module}.iml" filepath="$PROJECT_DIR$/${meta.module}/${meta.module}.iml" />
-    </modules>
-  </component>
-</project>
-
diff --git a/templates/create/_MODULE_/_MODULE_.iml.ftl b/templates/create/_MODULE_/_MODULE_.iml.ftl
deleted file mode 100644
index 38d021b..0000000
--- a/templates/create/_MODULE_/_MODULE_.iml.ftl
+++ /dev/null
@@ -1,85 +0,0 @@
-<#ftl>
-<#--
- Copyright 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
-     http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<?xml version="1.0" encoding="UTF-8"?>
-<module external.system.id="GRADLE" type="JAVA_MODULE" version="4">
-  <component name="FacetManager">
-    <facet type="android" name="Android">
-      <configuration>
-        <option name="ALLOW_USER_CONFIGURATION" value="false" />
-        <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
-        <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
-        <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
-      </configuration>
-    </facet>
-    <facet type="android-gradle" name="Android-Gradle">
-      <configuration>
-        <option name="GRADLE_PROJECT_PATH" value=":${sample.name}" />
-      </configuration>
-    </facet>
-  </component>
-  <component name="NewModuleRootManager" inherit-compiler-output="true">
-    <exclude-output />
-    <content url="file://$MODULE_DIR$">
-      <sourceFolder url="file://$MODULE_DIR$/build/source/r/debug" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/build/source/aidl/debug" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/build/source/rs/debug" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/debug" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/build/res/rs/debug" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/build/source/r/test" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/source/aidl/test" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/source/rs/test" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/source/buildConfig/test" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/res/rs/test" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/res" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/assets" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/res" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/aidl" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/assets" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/java" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/jni" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/rs" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/res" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/instrumentTest/resources" isTestSource="true" />
-      <excludeFolder url="file://$MODULE_DIR$/build/apk" />
-      <excludeFolder url="file://$MODULE_DIR$/build/assets" />
-      <excludeFolder url="file://$MODULE_DIR$/build/bundles" />
-      <excludeFolder url="file://$MODULE_DIR$/build/classes" />
-      <excludeFolder url="file://$MODULE_DIR$/build/dependency-cache" />
-      <excludeFolder url="file://$MODULE_DIR$/build/exploded-bundles" />
-      <excludeFolder url="file://$MODULE_DIR$/build/incremental" />
-      <excludeFolder url="file://$MODULE_DIR$/build/libs" />
-      <excludeFolder url="file://$MODULE_DIR$/build/manifests" />
-      <excludeFolder url="file://$MODULE_DIR$/build/symbols" />
-      <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
-    </content>
-    <orderEntry type="jdk" jdkName="Android 4.2 Platform" jdkType="Android SDK" />
-    <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="library" name="android-support-v4" level="project" />
-  </component>
-</module>
-
diff --git a/templates/create/_PROJECT_.iml.ftl b/templates/create/_PROJECT_.iml.ftl
deleted file mode 100644
index df87e69..0000000
--- a/templates/create/_PROJECT_.iml.ftl
+++ /dev/null
@@ -1,29 +0,0 @@
-<#--
-        Copyright 2013 The Android Open Source Project
-
-        Licensed under the Apache License, Version 2.0 (the "License");
-        you may not use this file except in compliance with the License.
-        You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-        Unless required by applicable law or agreed to in writing, software
-        distributed under the License is distributed on an "AS IS" BASIS,
-        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-        See the License for the specific language governing permissions and
-        limitations under the License.
--->
-<module external.system.id="GRADLE" type="JAVA_MODULE" version="4">
-<component name="NewModuleRootManager" inherit-compiler-output="true">
-<exclude-output />
-<content url="file://$MODULE_DIR$">
-    <excludeFolder url="file://$MODULE_DIR$/.gradle" />
-    <excludeFolder url="file://$MODULE_DIR$/gradle" />
-    <excludeFolder url="file://$MODULE_DIR$/.idea" />
-    <excludeFolder url="file://$MODULE_DIR$/buildSrc" />
-    <excludeFolder url="file://$MODULE_DIR$/build" />
-</content>
-<orderEntry type="inheritedJdk" />
-<orderEntry type="sourceFolder" forTests="false" />
-</component>
-</module>
diff --git a/templates/create/gradle/wrapper/gradle-wrapper.properties b/templates/create/gradle/wrapper/gradle-wrapper.properties
index 5c22dec..861eddc 100644
--- a/templates/create/gradle/wrapper/gradle-wrapper.properties
+++ b/templates/create/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
diff --git a/templates/create/template-params.xml.ftl b/templates/create/template-params.xml.ftl
index 8efbc61..dd729a7 100644
--- a/templates/create/template-params.xml.ftl
+++ b/templates/create/template-params.xml.ftl
@@ -16,9 +16,11 @@
 -->
 <sample>
     <name>${sample.name}</name>
+    <group>NoGroup</group>
     <package>${sample.package}</package>
 
 
+
     <!-- change minSdk if needed-->
     <minSdk>${sample.minSdk}</minSdk>