While I read Android NDK document, there is the "DSL". I don't know what it means exactly. Would you please tell me full name of the "DSL"?
document here: http://tools.android.com/tech-docs/new-build-system/gradle-experimental#TOC-Samples
Gradle is a new and revolutionary build tool, based on the Groovy programming language. It is very different from existing tools like Ant and Maven in that it provides an extremely powerful capability to develop build applications using Groovy code and a compelling Groovy DSL.
The plugins DSL provides a succinct and convenient way to declare plugin dependencies. It works with the Gradle plugin portal to provide easy access to both core and community plugins. The plugins DSL block configures an instance of PluginDependenciesSpec. To apply a core plugin, the short name can be used: Example 1.
The Gradle Kotlin DSL provides support for writing Gradle build scripts using JetBrains' Kotlin language.
Kotlin script is Kotlin code that can be run from the command line. Kotlin DSL: Refers primarily to the Android Gradle plugin Kotlin DSL or, occasionally, to the underlying Gradle Kotlin DSL. In the context of migrating from Groovy, the terms “KTS” and “Kotlin DSL” may be used interchangeably.
Simply, it stands for 'Domain Specific Language'. IMO, in gradle context, DSL gives you a gradle specific way to form your build scripts. More precisely, it's a plugin-based build system that defines a way of setting up your build script using (mainly) building blocks defined in various plugins.
For example, gradle scripts usually relies on using methods (also known as building blocks) taking a closure as the only parameter. And you write it down like this;
apply plugin: 'com.android.library' android { compileSdkVersion 25 buildToolsVersion "25.0.3" ... defaultConfig { minSdkVersion 19 targetSdkVersion 25
So in above, we wanted to use the 'android{ ...}' building block (or pre-defined task - please see Example.89 here) to set some android properties for our build. But I don't know which building blocks I can put in it at the beginning. So, I need a way to look up those from somewhere. This is where gradle DSL and plugins come into play together. I can go to that specific plugin's page to figure out what kind of building blocks are defined in it, or what makes this plugin special. Those would be the things that defines the capabilities of the plugin in the form of a high-level language called (gradle) DSL.
Understanding how DSL works may require you to know about how 'delegates' work in groovy. This might help quite a lot.
One last thing you might be wondering is about how a gradle.script gets evaluated. You can find some useful information over here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With