This message was deleted.
# community-support
s
This message was deleted.
c
why not run
./gradlew tasks
directly?
a
it does not list all the tasks exactly
c
what is your specific goal?
a
I want to find the apks of all variants
also, running ./gradlew tasks and then parsing the output -> is this the right way to go?
c
unclear what your goal is. Why is this a separate app using Tooling API and not a plugin?
i.e. what do you plan to do with the results after finding them?
a
Okay so I'm trying to write an interface to build using gradle. Something like an IDE
So I want to shows users all the options, build variants, and output apks available
And I'm trying to do that programatically if that is possible
c
I see. Using the IDE or command line is not sufficient for developers?
a
like using cli would be the last resort
So, I was trying to build this app: https://github.com/mozilla-mobile/fenix
When I run assembleDebug it generates a number of apks which are different architectures
can I run some gradle command to know which apks are going to be generated?
c
to what end? the build script generates what it generates. There may or may not be tasks available for a more-focused build, if that is what is desired.
a
yes that is what is desired
so if a user wants to rebuild only a specific version, there's no way to do that?
c
depends on the build script. Not familiar with Android/APK specifics. Perhaps there are focused tasks to build for say a given architecture.
a
like for this app: https://github.com/signalapp/Signal-Android the following apks are generated:
Copy code
"/workspace/app/build/outputs/apk/playProd/debug/Signal-Android-play-prod-arm64-v8a-debug-6.25.4.apk",
        "/workspace/app/build/outputs/apk/playProd/debug/Signal-Android-play-prod-armeabi-v7a-debug-6.25.4.apk",
        "/workspace/app/build/outputs/apk/playProd/debug/Signal-Android-play-prod-universal-debug-6.25.4.apk",
        "/workspace/app/build/outputs/apk/playProd/debug/Signal-Android-play-prod-x86-debug-6.25.4.apk",
        "/workspace/app/build/outputs/apk/playProd/debug/Signal-Android-play-prod-x86_64-debug-6.25.4.apk"
now I just want to test one of the versions, so can I save time by rebuilding only one version, something like that
c
ok. perhaps see what Gradle tasks are available for that in the project and/or research how to do that for an Android project. Your Tooling API solution won’t work if there aren’t Gradle tasks available in the first place (if there are, just run them directly).
a
right
but is there some way to parse the build.gradle files and read through gradle?
like what is it actually going to build?
and query the build.gradle file for this information?
Android studio is able to achieve it no?
c
like what is it actually going to build?
Gradle will build the tasks you ask it to (and any dependent tasks). You can, of course, use the Tooling API for this - but it doesn’t have access to any magic that
./gradlew tasks
has if the tasks aren’t there to run in the first place. Suggest stepping back to understanding how to selectively run your build first before building automation/tooling around that.
a
right, thanks so much
actually I tried to use toolkit. it lists down more number of tasks compared to `./gradlew tasks`command
I can navigate through the entire tree of projects inside my main project and get tasks for each project as well. So was wondering whether I can achieve it through the cli as well
c
./gradlew tasks --all
a
ohhhh
c
but, again, that’s not helpful if there aren’t tasks to selectively run your build.
a
right right, I just wanted to test and list all the tasks
👍 1
and see how much information i can get
Also, are you familiar with integrating the toolkit?
I'm able to run it on some projects, but some other projects fail
c
I have limited experience with the Tooling API (that’s the name of it).
a
i see
have you experienced the error I posted here?
c
it’s perhaps an incompatibility in Gradle versions.
a
I think it is because of the java version mp. But i tried switching java sdks to 8,11,17
it’s perhaps an incompatibility in Gradle versions.
I see. I actually can't change the gradle files of the project, I'm using toolkit on
any idea how I can go about it?
c
no idea. Perhaps look at IntelliJ or other IDE source to see how they’ve compensated for version differences. Seems awfully complicated / heavyweight…
a
I could only find one version of Tooling API on maven, so not sure how to fix the version issue
no idea. Perhaps look at IntelliJ or other IDE source to see how they’ve compensated for version differences.
Seems awfully complicated / heavyweight…
right it is, tried doing that
Also, is there some detailed information/documentation on using tooling api?