Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions test-app/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -966,21 +966,36 @@ task buildMetadata(type: BuildToolTask) {

description = "builds metadata with provided jar dependencies"

inputs.files("$MDG_JAVA_DEPENDENCIES")
// collectAllJars rewrites this list on every build and doFirst then appends the class
// directories to it, so fingerprint the jars it names rather than the file itself. Must
// stay a provider: the list is only current once collectAllJars has run.
def mdgJavaDependenciesFile = file("$BUILD_TOOLS_PATH/$MDG_JAVA_DEPENDENCIES")
inputs.files(provider {
mdgJavaDependenciesFile.exists() ? mdgJavaDependenciesFile.readLines().findAll { it.endsWith(".jar") } : []
}).withPropertyName("dependencyJars")

// make MDG aware of whitelist.mdg and blacklist.mdg files
// inputs.files(project.fileTree(dir: "$rootDir", include: "**/*.mdg"))
// use explicit inputs as the above makes the whole build-tools directory an input!
inputs.files("$BUILD_TOOLS_PATH/whitelist.mdg", "$BUILD_TOOLS_PATH/blacklist.mdg")

def classesDir = layout.buildDirectory.dir("intermediates/javac").get().asFile
if (classesDir.exists()) {
inputs.dir(classesDir)
}

def kotlinClassesDir = layout.buildDirectory.dir("tmp/kotlin-classes").get().asFile
if (kotlinClassesDir.exists()) {
inputs.dir(kotlinClassesDir)
// Must mirror the directories doFirst scans. Declared lazily because they don't exist
// yet at configuration time on a clean build, and limited to the selected build type
// so the other variant's compile outputs never overlap this task's inputs.
def compiledClassesBuildType = project.ext.selectedBuildType
inputs.files(rootProject.subprojects.collectMany { sub ->
[sub.layout.buildDirectory.dir("intermediates/javac/$compiledClassesBuildType"),
sub.layout.buildDirectory.dir("tmp/kotlin-classes/$compiledClassesBuildType")]
}).withPropertyName("compiledClasses")

// This project's compile tasks are dependencies (see applicationVariants above). For
// other subprojects only order after them: ones the app depends on are already reached
// transitively, and a hard dependency would drag unrelated modules into the build.
def compiledClassesTaskNames = ["JavaWithJavac", "Kotlin"].collect { "compile${compiledClassesBuildType.capitalize()}$it" }
rootProject.subprojects.each { sub ->
if (sub != project) {
mustRunAfter { compiledClassesTaskNames.collect { sub.tasks.findByName(it) }.findAll { it != null } }
}
}

outputs.files("$METADATA_OUT_PATH/treeNodeStream.dat", "$METADATA_OUT_PATH/treeStringsStream.dat", "$METADATA_OUT_PATH/treeValueStream.dat")
Expand Down
Loading