Flatfoot repo builder

This CL configures flatfoot build to export to a repo next to
support library.

This is just a temporary script until we figure how these
will be shipped.

Bug: 32342709
Bug: 32342385
Test: n/a
Change-Id: I19bd32330de8999dff7443a519888c5cdd027ffd
diff --git a/flatfoot-common/init.gradle b/flatfoot-common/init.gradle
index 7de382c..7fad00b 100644
--- a/flatfoot-common/init.gradle
+++ b/flatfoot-common/init.gradle
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-def root = ext.lifecyclesRootFolder
+def root = ext.projectRootFolder
 ext.prebuiltsRoot = "file://${root}/../../../prebuilts"
 ext.repoNames = ["$prebuiltsRoot/maven_repo",
                  "$prebuiltsRoot/gradle-plugin",
@@ -55,14 +55,14 @@
 
 def createKotlinCheckstyle(Project project) {
     def kotlinCheckstyle = project.tasks.create(name : 'checkstyleKotlin', type: Checkstyle) {
-        configFile file("$lifecyclesRootFolder/../flatfoot-common/kotlin-checkstyle.xml")
+        configFile file("$projectRootFolder/../flatfoot-common/kotlin-checkstyle.xml")
         source project.sourceSets.main.allJava
         source project.sourceSets.test.allJava
         ignoreFailures false
         showViolations true
         include '**/*.kt'
         classpath = project.files()
-        checkstyleClasspath = files(file("$lifecyclesRootFolder../../../development/tools/checkstyle/checkstyle.jar").path)
+        checkstyleClasspath = files(file("$projectRootFolder../../../development/tools/checkstyle/checkstyle.jar").path)
    }
     project.tasks.findByName("check").dependsOn(kotlinCheckstyle)
     // poor man's line length check
@@ -83,7 +83,7 @@
 
 def createAndroidCheckstyle(Project project) {
     def androidCheckstyle = project.tasks.create(name : 'checkstyleAndroid', type: Checkstyle) {
-        configFile file("$lifecyclesRootFolder/../../../development/tools/checkstyle/android-style.xml")
+        configFile file("$projectRootFolder/../../../development/tools/checkstyle/android-style.xml")
         if (project.hasProperty('android')) {
             source project.android.sourceSets.main.java.getSrcDirs()
         }
@@ -94,12 +94,18 @@
         showViolations true
         include '**/*.java'
         classpath = project.files()
-        checkstyleClasspath = files(file("$lifecyclesRootFolder/../../../development/tools/checkstyle/checkstyle.jar").path)
+        checkstyleClasspath = files(file("$projectRootFolder/../../../development/tools/checkstyle/checkstyle.jar").path)
     }
     project.tasks.findByName("check").dependsOn(androidCheckstyle)
 }
 
-ext.localMavenRepo = "file://${new File(root, "maven-repo").absolutePath}"
+def buildDir
+if (System.env.DIST_DIR != null && System.env.OUT_DIR != null) {
+    buildDir = new File(System.env.OUT_DIR + '/gradle/frameworks/support/build').getCanonicalFile()
+} else {
+    buildDir = file("${ext.prebuiltsRoot}/../out/host/gradle/frameworks/support/build")
+}
+ext.localMavenRepo = "file://${new File(buildDir, "flatfoot_repo").absolutePath}"
 ext.addRepos = this.&addRepos
 ext.createKotlinCheckstyle = this.&createKotlinCheckstyle
 ext.createAndroidCheckstyle = this.&createAndroidCheckstyle
\ No newline at end of file
diff --git a/lifecycle/build.gradle b/lifecycle/build.gradle
index 597e698..92152ed 100644
--- a/lifecycle/build.gradle
+++ b/lifecycle/build.gradle
@@ -1,5 +1,5 @@
 buildscript {
-    ext.lifecyclesRootFolder = project.rootProject.rootDir
+    ext.projectRootFolder = project.rootProject.rootDir
     apply from: '../flatfoot-common/init.gradle'
     ext.addRepos(repositories)
     dependencies {
diff --git a/lifecycle/compiler/build.gradle b/lifecycle/compiler/build.gradle
index 999f786..5ae79d5 100644
--- a/lifecycle/compiler/build.gradle
+++ b/lifecycle/compiler/build.gradle
@@ -26,7 +26,7 @@
     repositories {
         mavenDeployer {
             repository(url: rootProject.ext.localMavenRepo)
-            pom.artifactId = 'lifecycle-compiler'
+            pom.artifactId = 'compiler'
         }
     }
 }
diff --git a/makeFlatfootRepo.sh b/makeFlatfootRepo.sh
new file mode 100755
index 0000000..1e5e817
--- /dev/null
+++ b/makeFlatfootRepo.sh
@@ -0,0 +1,3 @@
+# temporary script to make flatfoot repo, next to the support repo
+cd lifecycle && ./gradlew uploadArchives --info
+cd ../room && ./gradlew uploadArchives --info
diff --git a/room/build.gradle b/room/build.gradle
index 1936615..d2b1c5d 100644
--- a/room/build.gradle
+++ b/room/build.gradle
@@ -14,11 +14,8 @@
  * limitations under the License.
  */
 
-group 'com.android.support.room'
-version '1.0-SNAPSHOT'
-
 buildscript {
-    ext.lifecyclesRootFolder = project.rootProject.rootDir
+    ext.projectRootFolder = project.rootProject.rootDir
     apply from: '../flatfoot-common/init.gradle'
     ext.addRepos(repositories)
     dependencies {
@@ -35,6 +32,8 @@
             force "com.google.guava:guava-jdk5:17.0"
         }
     }
+    project.group = 'com.android.support.room'
+    project.version = release_version
     addRepos(project.repositories)
     if (enablePublicRepos) {
         apply plugin: 'com.android.databinding.localizemaven'
diff --git a/room/common/build.gradle b/room/common/build.gradle
index 00406d3..0e605c5 100644
--- a/room/common/build.gradle
+++ b/room/common/build.gradle
@@ -23,7 +23,6 @@
     compile "com.android.support:support-annotations:$support_lib_version"
     testCompile "junit:junit:$junit_version"
     testCompile "org.mockito:mockito-core:$mockito_version"
-
 }
 
 uploadArchives {
diff --git a/room/compiler/build.gradle b/room/compiler/build.gradle
index f23951a..bfccb98 100644
--- a/room/compiler/build.gradle
+++ b/room/compiler/build.gradle
@@ -56,7 +56,7 @@
     repositories {
         mavenDeployer {
             repository(url: rootProject.ext.localMavenRepo)
-            pom.artifactId = 'lifecycle-compiler'
+            pom.artifactId = 'compiler'
         }
     }
 }
diff --git a/room/integration-tests/testapp/build.gradle b/room/integration-tests/testapp/build.gradle
index b038b23..96930e3 100644
--- a/room/integration-tests/testapp/build.gradle
+++ b/room/integration-tests/testapp/build.gradle
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import com.android.builder.core.BuilderConstants
 apply plugin: 'com.android.library'
 apply plugin: 'maven'
 
@@ -55,15 +54,6 @@
     compile project(path: ':runtime')
 }
 
-uploadArchives {
-    repositories {
-        mavenDeployer {
-            repository(url: rootProject.ext.localMavenRepo)
-            pom.artifactId = "runtime"
-        }
-    }
-}
-
 createAndroidCheckstyle(project)
 
 android.libraryVariants.all { variant ->