Triple-T / gradle-play-publisher

GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.
MIT License
4.13k stars 341 forks source link

create a task to retrieves channel names for a Google Play Store #878

Closed underwindfall closed 3 years ago

underwindfall commented 4 years ago

Problem description

Here it the context , when I try to publish a apk from plugin I want to input an existed channel name from my current playstore. However I don't know what list of channel names already existed in my project. I think it would be better to expose a new task to display all releases channel name for this feature.

Potential solutions/workarounds

  1. Add a new method in DefaultPlayPublisher to get list of tracks and expose it the
    override fun findListOfTrackName(): List<String> {
       return  publisher.tracks().map{ it }
    }
  2. expose this function to the gradle plugin task

Additional context

SUPERCILEX commented 4 years ago

I'm confused, do you want a task that prints out all the channel names? Or do you mean a programmatic API you'd use in the build script?

underwindfall commented 4 years ago

I want to have a that prints out all the channel names. Thx for the repsonse BTW.

SUPERCILEX commented 4 years ago

Gotya, thanks for clarifying. I'll have to think about it, but I'm not sure that makes sense for this project. The goal is to enable automation, not provide a CLI for the play console.

SUPERCILEX commented 3 years ago

For now, I've decided to forgo an official implementation. That said, if more people want one, I might reconsider.

In the meantime, with GPP v3.1.0 you can use this hack (as a KTS script):


tasks.register("printPlayTracks") {
    val apiService = gradle.sharedServices.registrations
            .named("playApi-com.supercilex.test")
            .get().service.get()

    doLast {
        val publisher = apiService.withGroovyBuilder { "getPublisher"() }!!
        val editId = publisher.withGroovyBuilder { "insertEdit"() }!!
                .withGroovyBuilder { "getId"() }
        val tracks = publisher.withGroovyBuilder { "listTracks"(editId) } as List<Any>

        println(tracks.joinToString(",\n") {
            it.withGroovyBuilder { "toPrettyString"() } as String
        })
    }
}
underwindfall commented 3 years ago

thx agagin, very greatful you deal with it.