Is it possible to debug a gradle build file that is written using Kotlin DSL? A google search doesn't really show anything. By debugging, I'm really talking about using breakpoints that let you step into the gradle file and execute each line and inspect variables.
Related
I'm trying to resolve some dependency issues when using an externally installed Gradle, rather than the one that come with Android Studio (AS). I then came across the particular AS setting under
File > Settings > Build,Execution,Deployment > Build Tools > Gradle > Runner.
[x] Delegate IDE build/run actions to Gradle
This is apparently also available as the Gradle config delegateBuildRunToGradle. But I can't find any sane explanation as to what it does. I thought all AS builds used Gradle...
While the Gradle doc page say it's on by default. This was not the case for my AS 3.2.2.
What does this option do?
(When should it be used?)
I was hoping to have a more precise answer, but since nothing has come forward here, I guess the only answer is that (what is written in the screenshot above) the IntelliJ IDEA has it's own way to make the builds. For many practical purposes it is probably better to have a more updated and working Gradle installation and enable the above option, to let it do its job.
I am trying to learn about how a gradle build works. When I do a build, I see a bunch of tasks executed, e.g.:
app:assembleDebug
app:preBuild
app:packageDebug
I would like to see exactly what these tasks are doing. I assume these are Gradle / Groovy scripts. I tried unzipping all the jars under Android Studio. Lots of stuff there, but I don't see anything relevant (I may have missed something in the voluminous listing). Are these tasks hidden within a class file? Am I looking in the wrong place?
All these tasks are created by the Gradle Android plugin, either the library version (com.android.library) or the application version (com.android.application). You can find the source code of these plugins in this repository.
However, it may be difficult to get insight on each task as some of them may be implemented by custom task types of the Android plugin, others may only be regular configured Gradle tasks. Also, the configuration of the tasks may be spreaded across multiple files, as many of them may be created dynamically.
But, in my opinion, it is unnecessary to know the exact functionality of each task, instead you should focus on the basic concepts of Android development and the Gradle plugin, e.g. build types and variants. The Android plugin provides a specific DSL and depending on the specified configuration, it will create the tasks automatically.
Using Android Studio 2.1.2, Gradle 2.10 and Android Gradle plugin 2.1.0, in a project and modules to build a library AAR.
I'm looking to insert my own behaviors by way of Android Studio module custom tasks. I'm in the IDE, flipping between debug and release variants and executing Build/Rebuild Project watching the Gradle console.
My questions:
I understand why "configure by convention" tasks flip between running canned "debug" versus "release" tasks, but I don't understand why the canned sequences of tasks are functionally different between the two variants. For example, when rebuilding debug, I see these core tasks executed:
...
:LibraryModule:bundleDebug
:LibraryModule:compileDebugSources
:LibraryModule:assembleDebug
...
When rebuilding release, I see these core tasks executed:
...
:LibraryModule:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:LibraryModule:compileReleaseNdk UP-TO-DATE
:LibraryModule:compileReleaseSources
...
What? Where are the bundleRelease and assembleRelease tasks? Where in the release build do I hook in my custom task (since assembleRelease or bundleRelease aren't called)?
Can I use the Android Studio "Edit Configurations..." IDE feature to setup custom build configurations to execute "Make Project (F7)" for AAR targets. And if yes, how? Specifically, what do I put in a "Gradle project:" field to target a specific module's build and what exactly, semantic and syntax wise, do I put in the "Tasks:" field?
Last question. After doing a full rebuild of a library module (to produce a .AAR file) with the build variant set to debug, I see the following task executions:
...
:LibraryModule:bundleDebug
:LibraryModule:compileDebugSources
:LibraryModule:assembleDebug
...
The order of execution doesn't seem right. I would think the order would be:
...
:LibraryModule:assembleDebug
:LibraryModule:compileDebugSources
:LibraryModule:bundleDebug
...
Am I being faked out by dependency chain output or what?
Is there any documentation on converting a application.mk/android.mk file to a gradle based build.gradle file?
good links, QArea. Thanks a lot!
At this moment NDK support in Gradle are very limited. If you need to assemble something that gradle not provides that function
I do like this.
I collect the old-fashioned, but to .so-patches automatically picks up the Gradle-plugin:
ndk-build -j4 NDK_LIBS_OUT=src/main/jniLibs
Otherwise, you must wait for next version of gradle 0.13. Devs promise that NDK will fix integration with NDK.
I made a script tool to convert android.mk building system to gradle building system, because I wanted to test the demo source codes in:
https://android.googlesource.com/platform/development/+/05523fb0b48280a5364908b00768ec71edb847a2/samples
But after searching whole internet, I found no one did it yet. So I created this tool by myself. But even with this tool, we couldn't ensure all projects in AndroidSamples could be built and executed successfully because of the API versions and features mismatch. So I created my own projects for https://android.googlesource.com/platform/development/+/05523fb0b48280a5364908b00768ec71edb847a2/samples
And I want to convert those demo projects one by one.
Now the whole source codes are here:
https://github.com/clockzhong/AndroidSamples
I already successfully converted some samples into gradle building system and executed them correctly on my android phones. But I still have some version mismatch issues, anyway, I'll mentioned it in the project check-in comments.
I've written a native unit test dll that uses VS2012's CppUnitTestFramework. I can run these tests in the VS2012's IDE in the Test Explorer window.
But, I'd like to also run these tests from our MsBuild script. I guess I need to launch some test runner exe with appropriate command line, but am struggling to find information on this.
Can you help point me in the right direction. Thanks.
The Visual Studio Test Runner is a simple command line tool which needs to be called in order to find and execute the tests. Creating a small msbuild task or using the standard exec task would be enough to invoke the tests after the build.
As long as the test runner is installed properly, it should just pick up these tests and execute them.
See this blog post explaining all the command line intricacies of the new vstest.console.exe.