Include source folders from registered source-generating tasks.

This includes the output directories from tasks which generate Java code which were registered with registerJavaGeneratingTask().
This commit is contained in:
Jake Wharton
2016-02-11 11:56:53 -05:00
parent faba229b11
commit 0d6ec35f7f
@@ -105,13 +105,13 @@ class AndroidGradleWrapper {
}
static def List<File> getGeneratedSourceDirs(BaseVariantData variantData) {
def result = new ArrayList<File>()
def getJavaSourcesMethod = variantData.getMetaClass().getMetaMethod("getJavaSources")
if (getJavaSourcesMethod.returnType.metaClass == Object[].metaClass) {
return variantData.getJavaSources().findAll { it instanceof File }
result.addAll(variantData.getJavaSources().findAll { it instanceof File })
}
else {
def result = new ArrayList<File>()
if (variantData.scope.getGenerateRClassTask() != null) {
result.add(variantData.scope.getRClassSourceOutputDir());
}
@@ -132,8 +132,16 @@ class AndroidGradleWrapper {
&& variantData.scope.getRenderscriptCompileTask() != null) {
result.add(variantData.scope.getRenderscriptSourceOutputDir());
}
return result
}
def getExtraSourcesMethod = variantData.getMetaClass().getMetaMethod("getExtraGeneratedSourceFolders")
if (getExtraSourcesMethod.returnType.metaClass == List.metaClass) {
def folders = variantData.getExtraGeneratedSourceFolders()
if (folders != null) {
result.addAll(folders)
}
}
return result
}
}