Sample Build: Consolidate src output in emitGradle
Hide main/common/template directories in emitGradle output
by consolidating all of the output into a single src/main directory.
Change-Id: Id6e5d28c7826d294008243eab3a22e9f5c415ee1
diff --git a/build.gradle b/build.gradle
index cea4d18..840a787 100644
--- a/build.gradle
+++ b/build.gradle
@@ -119,7 +119,7 @@
task emitGradle(type:Copy) {
dependsOn(preflight)
- def outputPath = outPath("gradle");
+ def outputPath = outPath("gradle")
def inputPath = "${project.projectDir}"
// Copy entire sample into output -- since it's already in Gradle format, we'll explicitly exclude content that
// doesn't belong here.
@@ -130,9 +130,30 @@
exclude ".gradle"
exclude "_index.jd"
exclude "buildSrc"
+ exclude "local.properties"
exclude "template-params.xml"
exclude "**/proguard-project.txt"
+
+ // src directory needs to be consolidated, will be done in next section
+ exclude "${samplegen.targetSampleModule()}/src/"
+ include "${samplegen.targetSampleModule()}/src/main/AndroidManifest.xml"
}
+
+ // Consolidate source directories
+ ["main", "common", "template"].each { input ->
+ ["java", "res", "assets"].each { filetype ->
+ def srcPath = "${inputPath}/${samplegen.targetSampleModule()}/src/${input}/${filetype}"
+ into("${samplegen.targetSampleModule()}/src/main/${filetype}") {
+ from(srcPath)
+ }
+ }
+ }
+
+ // Copy AndroidManifest.xml
+ into ("${samplegen.targetSampleModule()}/src/main") {
+ from("${inputPath}/${samplegen.targetSampleModule()}/src/main/AndroidManifest.xml")
+ }
+
// Remove BEGIN_EXCLUDE/END_EXCLUDE blocks from source files
eachFile { file ->
if (file.name.endsWith(".gradle") || file.name.endsWith(".java")) {