Skip to content
This repository has been archived by the owner on Jun 5, 2018. It is now read-only.

Commit

Permalink
Throw an exception for a missing app id if only one variant is uploaded
Browse files Browse the repository at this point in the history
  • Loading branch information
Janusz Leidgens committed Aug 28, 2015
1 parent 68c1793 commit 9f92b20
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/groovy/de/felixschulze/gradle/HockeyAppPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class HockeyAppPlugin implements Plugin<Project> {
uploadAllTask.group = GROUP_NAME
uploadAllTask.description = "Uploads all variants to HockeyApp"
uploadAllTask.outputs.upToDateWhen { false }
String uploadAllPath = uploadAllTask.getPath();

android.applicationVariants.all { ApplicationVariant variant ->
HockeyAppUploadTask task = project.tasks.create("upload${variant.name.capitalize()}ToHockeyApp", HockeyAppUploadTask)
Expand All @@ -64,6 +65,7 @@ class HockeyAppPlugin implements Plugin<Project> {
task.variantName = variant.name
task.outputs.upToDateWhen { false }
task.dependsOn variant.assemble
task.uploadAllPath = uploadAllPath

uploadAllTask.dependsOn(task)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class HockeyAppUploadTask extends DefaultTask {
ApplicationVariant applicationVariant
boolean mappingFileCouldBePresent = true
HockeyAppPluginExtension hockeyApp
String uploadAllPath


HockeyAppUploadTask() {
Expand Down Expand Up @@ -138,7 +139,11 @@ class HockeyAppUploadTask extends DefaultTask {
if (hockeyApp.variantToApplicationId) {
appId = hockeyApp.variantToApplicationId[variantName]
if (!appId) {
logger.error("Could not resolve app ID for variant: ${variantName} in the variantToApplicationId map.")
if(project.getGradle().getTaskGraph().hasTask(uploadAllPath)) {
logger.error("Could not resolve app ID for variant: ${variantName} in the variantToApplicationId map.")
} else {
throw new IllegalArgumentException("Could not resolve app ID for variant: ${variantName} in the variantToApplicationId map.")
}
}
}
if(appId) {
Expand Down

0 comments on commit 9f92b20

Please sign in to comment.