User avatar
pathetic piss kitten @kitten@elizabeth.cat
1mo
not sure if any of my followers knows about Android or Gradle, but I want to use the output of one task as an android sourceSet. right now I have the following in my build.gradle, because I know those are the sourceSets I have and that that's the directory where the files are generated:
android {
	sourceSets {
		getByName("debug").kotlin.directories.add("build/generated/sqldelight/code/AppDatabase/debug")
		getByName("release").kotlin.directories.add("build/generated/sqldelight/code/AppDatabase/release")
	}
}


but if I try to make it programatic:
androidComponents {
	onVariants { variant ->
		afterEvaluate {
			val capName = variant.name.replaceFirstChar { it.uppercase() }
			val task = tasks.getByName<SqlDelightTask>("generate${capName}AppDatabaseInterface")

			android.sourceSets.getByName<AndroidSourceSet>(variant.name).kotlin.directories.add(task.outputs.toString())
		}
	}
}


it fails, saying it doesn't find the generated classes