Skip to content

Commit

Permalink
Fix missing task dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
mikolak committed Apr 11, 2019
1 parent dc271fb commit 052f66c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ internal class CockpitPlugin : Plugin<Project> {
val android = project.extensions.getByType(AppExtension::class.java)
android.applicationVariants.all { variant: BaseVariant ->


print(project.tasks)
val task = project.tasks.create("generate${variant.name.capitalize()}Cockpit", CockpitTask::class.java) {
it.variantName = variant.name
it.variantDirName = variant.dirName
Expand All @@ -21,6 +23,10 @@ internal class CockpitPlugin : Plugin<Project> {
it.buildTypeList = android.buildTypes.map { it.name } ?: emptyList()
}

val assembleTask = project.tasks.find { it.name.contains("assemble") && it.name.contains(variant.buildType.name) }
assembleTask?.dependsOn(task)


variant.registerJavaGeneratingTask(task, task.getCockpitOutputDirectory())
android.sourceSets.first { variant.name == it.name }
.apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ internal open class CockpitTask : DefaultTask() {

yamlReaderAndWriter.saveParamsToYaml(mergedParametersList, mergedCockpitFile)

if (!mergedCockpitFile.exists()) throw IllegalStateException("mergedCockpit.yml has not been created")

val generator = if (buildTypeName.isRelease()) ReleaseCockpitGenerator() else DebugCockpitGenerator()
generator.generate(mergedParametersList, getCockpitOutputDirectory())
} else {
Expand Down

0 comments on commit 052f66c

Please sign in to comment.