Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README to show how to run this task automatically #170

Open
jaredsburrows opened this issue Jan 23, 2022 · 3 comments
Open

Update README to show how to run this task automatically #170

jaredsburrows opened this issue Jan 23, 2022 · 3 comments

Comments

@jaredsburrows
Copy link
Owner

tasks.whenTaskAdded {
  if (name == "assembleDebug") {
    dependsOn("licenseDebugReport")
  }
}

tasks.whenTaskAdded {
  if (name == "assembleRelease") {
    dependsOn("licenseReleaseReport")
  }
}
@nisrulz
Copy link
Contributor

nisrulz commented Apr 24, 2022

In order to accommodate Product variants in Android, something like this should also work:

tasks.whenTaskAdded {
    if (name.contains("assemble") && name.contains("Release")) {
        dependsOn("licenseReleaseReport")
    }
}

tasks.whenTaskAdded {
    if (name.contains("assemble") && name.contains("Debug")) {
        dependsOn("licenseDebugReport")
    }
}

This because the tasks are named: assembleProductVariantNameRelease.

Although your example would work too, in a very specific case where the exact task is run for generating all variants. The one suggested in this comment, could avoid extra processing of all variants to get the output.

@jaredsburrows
Copy link
Owner Author

I might add automatic support for this, similar to https://github.com/jaredsburrows/gradle-spoon-plugin/blob/master/gradle-spoon-plugin/src/main/kotlin/com/jaredsburrows/spoon/projectAndroid.kt#L63.

@nisrulz
Copy link
Contributor

nisrulz commented Apr 24, 2022

That looks much better. TIL 😸

Looking forward that being implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants