0

In Android gradle, I'm thinking of logging what I'm signed on with, by adding the println as below

signingConfigs {
    debug {
        storeFile file("./debug.keystore")
        println('Sign with Debug')
    }
    release {
        storeFile file("./release.keystore")
        storePassword "XXX"
        keyAlias "YYY"
        keyPassword "ZZZ"
        println('Sign with Release')
    }
}

In the gradle console, it shows both

Sign with Debug
Sign with Release

I also tried project.logger.lifecycle as per https://stackoverflow.com/a/40895807/3286489. Same thing happen.

What I want is to only show the one that I'm actually sign with instead of both. How could I achieve that?

Elye
  • 53,639
  • 54
  • 212
  • 474
  • A Gradle build script does not build software. A Gradle build script builds *an object model* describing *how* to build software. Hence, every line of a Gradle build script is always executed, when the script is read in. In the case of command-line builds, that's when you do the build. In the cast of Android Studio and other software using the Gradle tooling API, that will be when you open the project or change the contents of the Gradle build script. – CommonsWare Nov 29 '17 at 22:31
  • Thanks @CommonsWare. I accept that. Hence I'm asking if there's a way to make the logging conditional. Hopes there are some workaround. The reason is, we want to ensure some script is trigger for some build and not the other. – Elye Nov 29 '17 at 22:33
  • Define that script in the form of a Gradle task that depends upon a variant-specific Gradle task (e.g., `assembleDebug`). – CommonsWare Nov 29 '17 at 22:50

0 Answers0