Move build tools into their own project.

This CL also fixes a number of path bugs that were exposed
by the change in project.

Change-Id: I11546d8c68d51cc53deb29267c78d2b7ffaef650
diff --git a/templates/base/_MODULE_/build.gradle.ftl b/templates/base/_MODULE_/build.gradle.ftl
new file mode 100644
index 0000000..e56edbe
--- /dev/null
+++ b/templates/base/_MODULE_/build.gradle.ftl
@@ -0,0 +1,81 @@
+<#--
+ 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.
+-->
+buildscript {
+    repositories {
+        mavenCentral()
+    }
+
+    dependencies {
+        classpath 'com.android.tools.build:gradle:0.5.+'
+    }
+}
+
+apply plugin: 'android'
+
+dependencies {
+    // Add the support lib that is appropriate for SDK ${sample.minSdk}
+<#if sample.minSdk?number < 7>
+    compile "com.android.support:support-v4:18.0.+"
+<#elseif sample.minSdk?number < 13>
+    compile "com.android.support:support-v4:18.0.+"
+    compile "com.android.support:gridlayout-v7:18.0.+"
+<#else>
+    compile "com.android.support:support-v13:18.0.+"
+</#if>
+}
+
+// The sample build uses multiple directories to
+// keep boilerplate and common code separate from
+// the main sample code.
+List<String> dirs = [
+    'main',     // main sample code; look here for the interesting stuff.
+    'common',   // components that are reused by multiple samples
+    'template'] // boilerplate code that is generated by the sample template process
+
+android {
+     <#-- Note that target SDK is hardcoded in this template. We expect all samples
+          to always use the most current SDK as their target. -->
+    compileSdkVersion 18
+    buildToolsVersion "18.0.1"
+
+
+    sourceSets {
+        main {
+            dirs.each { dir ->
+<#noparse>
+                java.srcDirs "src/${dir}/java"
+                res.srcDirs "src/${dir}/res"
+</#noparse>
+            }
+        }
+    }
+}
+
+task preflight (dependsOn: parent.preflight) {
+    project.afterEvaluate {
+        // Inject a preflight task into each variant so we have a place to hook tasks
+        // that need to run before any of the android build tasks.
+        //
+        android.applicationVariants.each { variant ->
+        <#noparse>
+            tasks.getByPath("prepare${variant.name.capitalize()}Dependencies").dependsOn preflight
+        </#noparse>
+        }
+    }
+}
+
+
+
diff --git a/templates/base/_MODULE_/src/template/res/drawable-hdpi/ic_launcher.png b/templates/base/_MODULE_/src/template/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..b1efaf4
--- /dev/null
+++ b/templates/base/_MODULE_/src/template/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/templates/base/_MODULE_/src/template/res/drawable-hdpi/tile.9.png b/templates/base/_MODULE_/src/template/res/drawable-hdpi/tile.9.png
new file mode 100644
index 0000000..1358628
--- /dev/null
+++ b/templates/base/_MODULE_/src/template/res/drawable-hdpi/tile.9.png
Binary files differ
diff --git a/templates/base/_MODULE_/src/template/res/drawable-mdpi/ic_launcher.png b/templates/base/_MODULE_/src/template/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..f5f9244
--- /dev/null
+++ b/templates/base/_MODULE_/src/template/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/templates/base/_MODULE_/src/template/res/drawable-xhdpi/ic_launcher.png b/templates/base/_MODULE_/src/template/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..5d07b3f
--- /dev/null
+++ b/templates/base/_MODULE_/src/template/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/templates/base/_MODULE_/src/template/res/drawable-xxhdpi/ic_launcher.png b/templates/base/_MODULE_/src/template/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..6ef21e1
--- /dev/null
+++ b/templates/base/_MODULE_/src/template/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/templates/base/_MODULE_/src/template/res/layout/activity_main.xml b/templates/base/_MODULE_/src/template/res/layout/activity_main.xml
new file mode 100755
index 0000000..be1aa49
--- /dev/null
+++ b/templates/base/_MODULE_/src/template/res/layout/activity_main.xml
@@ -0,0 +1,36 @@
+<!--
+  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.
+  -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <LinearLayout style="@style/Widget.SampleMessageTile"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:orientation="vertical">
+
+        <TextView style="@style/Widget.SampleMessage"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/horizontal_page_margin"
+            android:layout_marginRight="@dimen/horizontal_page_margin"
+            android:layout_marginTop="@dimen/vertical_page_margin"
+            android:layout_marginBottom="@dimen/vertical_page_margin"
+            android:text="@string/intro_message" />
+    </LinearLayout>
+</LinearLayout>
diff --git a/templates/base/_MODULE_/src/template/res/values-sw600dp/dimens.xml b/templates/base/_MODULE_/src/template/res/values-sw600dp/dimens.xml
new file mode 100644
index 0000000..22074a2
--- /dev/null
+++ b/templates/base/_MODULE_/src/template/res/values-sw600dp/dimens.xml
@@ -0,0 +1,24 @@
+<!--
+  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.
+  -->
+
+<resources>
+
+    <!-- Semantic definitions -->
+
+    <dimen name="horizontal_page_margin">@dimen/margin_huge</dimen>
+    <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/templates/base/_MODULE_/src/template/res/values-sw600dp/styles.xml b/templates/base/_MODULE_/src/template/res/values-sw600dp/styles.xml
new file mode 100644
index 0000000..03d1974
--- /dev/null
+++ b/templates/base/_MODULE_/src/template/res/values-sw600dp/styles.xml
@@ -0,0 +1,25 @@
+<!--
+  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.
+  -->
+
+<resources>
+
+    <style name="Widget.SampleMessage">
+        <item name="android:textAppearance">?android:textAppearanceLarge</item>
+        <item name="android:lineSpacingMultiplier">1.2</item>
+        <item name="android:shadowDy">-6.5</item>
+    </style>
+
+</resources>
diff --git a/templates/base/_MODULE_/src/template/res/values/base-strings.xml.ftl b/templates/base/_MODULE_/src/template/res/values/base-strings.xml.ftl
new file mode 100755
index 0000000..002e329
--- /dev/null
+++ b/templates/base/_MODULE_/src/template/res/values/base-strings.xml.ftl
@@ -0,0 +1,24 @@
+<#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.
+-->
+<resources>
+    <string name="app_name">${sample.name}</string>
+    <string name="intro_message">
+        <![CDATA[
+        ${sample.strings.intro}
+        ]]>
+    </string>
+</resources>
diff --git a/templates/base/_MODULE_/src/template/res/values/dimens.xml b/templates/base/_MODULE_/src/template/res/values/dimens.xml
new file mode 100644
index 0000000..39e710b
--- /dev/null
+++ b/templates/base/_MODULE_/src/template/res/values/dimens.xml
@@ -0,0 +1,32 @@
+<!--
+  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.
+  -->
+
+<resources>
+
+    <!-- Define standard dimensions to comply with Holo-style grids and rhythm. -->
+
+    <dimen name="margin_tiny">4dp</dimen>
+    <dimen name="margin_small">8dp</dimen>
+    <dimen name="margin_medium">16dp</dimen>
+    <dimen name="margin_large">32dp</dimen>
+    <dimen name="margin_huge">64dp</dimen>
+
+    <!-- Semantic definitions -->
+
+    <dimen name="horizontal_page_margin">@dimen/margin_medium</dimen>
+    <dimen name="vertical_page_margin">@dimen/margin_medium</dimen>
+
+</resources>
diff --git a/templates/base/_MODULE_/src/template/res/values/styles.xml b/templates/base/_MODULE_/src/template/res/values/styles.xml
new file mode 100644
index 0000000..404623e
--- /dev/null
+++ b/templates/base/_MODULE_/src/template/res/values/styles.xml
@@ -0,0 +1,42 @@
+<!--
+  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.
+  -->
+
+<resources>
+
+    <!-- Activity themes -->
+
+    <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+
+    <style name="Theme.Sample" parent="Theme.Base" />
+
+    <style name="AppTheme" parent="Theme.Sample" />
+    <!-- Widget styling -->
+
+    <style name="Widget" />
+
+    <style name="Widget.SampleMessage">
+        <item name="android:textAppearance">?android:textAppearanceMedium</item>
+        <item name="android:lineSpacingMultiplier">1.1</item>
+    </style>
+
+    <style name="Widget.SampleMessageTile">
+        <item name="android:background">@drawable/tile</item>
+        <item name="android:shadowColor">#7F000000</item>
+        <item name="android:shadowDy">-3.5</item>
+        <item name="android:shadowRadius">2</item>
+    </style>
+
+</resources>