diff --git a/DECLARATIVE_GRADLE.md b/DECLARATIVE_GRADLE.md index 0a54aac24f..c5081cf41c 100644 --- a/DECLARATIVE_GRADLE.md +++ b/DECLARATIVE_GRADLE.md @@ -15,9 +15,9 @@ You can simply build from the command line or import in Studio. or import in Studio and use the `app` run configuration to run the app in an emulator. -You can then edit the [declarative settings file](./settings.gradle.something). +You can then edit the [declarative settings file](./settings.gradle.something) and [declarative build files](./feature/search/build.gradle.something). -## Restricted DSL +## Declarative DSL * The `.gradle.something` extension name is temporary. @@ -25,7 +25,7 @@ You can then edit the [declarative settings file](./settings.gradle.something). This demonstration includes [declarative settings files](#declarative-settings) and [declarative build files](#declarative-build-files). -The Gradle distribution also exports the [restricted DSL schemas](#restricted-dsl-schemas) that +The Gradle distribution also exports the [declarative DSL schemas](#declarative-dsl-schemas) that it uses to evaluate the files. * The available models are currently taken from the current Gradle API. @@ -46,6 +46,17 @@ Supported APIs in `settings.gradle.something`: * (+ `val dependencyResolutionManagement`) * `enableFeaturePreview(name: String)` + * `fun plugins(configure: PluginDependenciesSpec.() -> Unit)` + +* `PluginDependenciesSpec`: + * `fun id(id: String): PluginDependencySpec` + * `fun kotlin(id: String): PluginDependencySpec` (this function is not in the Java API) + * The `alias` functions are not supported yet. + +* `PluginDependencySpec`: + * `fun version(version: String?): PluginDependencySpec` (a builder function) + * `fun apply(apply: Boolean): PluginDependencySpec` (a builder function) + * `ProjectDescriptor`: * `var name: String` @@ -73,9 +84,6 @@ In command line builds, check the result with: ./gradlew :feature:search:dependencyInsight --configuration prodDebugCompileClasspath --dependency feature ``` -Currently, only plugins and project dependencies are supported. Everything else has been -moved to convention plugins for now. - The plugins and the rest of a build file are interpreted in two separate steps, similar to the other DSLs. @@ -101,14 +109,12 @@ Supported APIs for project evaluation: * `fun project(path: String): ProjectDependency` * `DependencyHandler`: - * `fun api(dependency: ProjectDependency)` - * `fun compileOnly(dependency: ProjectDependency)` - * `fun implementation(dependency: ProjectDependency)` - * `fun testImplementation(dependency: ProjectDependency)` - * `fun androidTestImplementation(dependency: ProjectDependency)` - * These configurations are hardcoded for now. + * `fun (dependency: ProjectDependency)` where `` is any + of the names of the configurations registered in the project + +* Extensions registered by the plugins, see https://github.com/h0tk3y/restricted-dsl-plugin-schema-demo -### Restricted DSL schemas +### Declarative DSL schemas When the prototype evaluates declarative settings and build files, it constructs a schema used for resolution and validation. @@ -120,7 +126,11 @@ any dependency on their original types. The schemas are serializable, and the current prototype always writes them to `.gradle/restricted-schema` during the build. -There are three different schemas that you can find in those directories after a build: -* `settings.something.schema` for the `settings.gradle.something` file, -* `plugins.something.schema` for the plugins DSL in `build.gradle.something`, and -* `project.something.schema` for the rest of `build.gradle.something`. \ No newline at end of file +There schemas that you can find in those directories after a build are: +* for `settings.gradle.something`: + * `settingsPluginManagement.something.schema` for `pluginManagement { ... }` + * `settingsPlugins.something.schema` for the plugins DSL, and + * `settings.something.schema` for the settings file content, +* for `build.gradle.something`: + * `plugins.something.schema` for the plugins DSL in `build.gradle.something`, and + * `project.something.schema` for the rest of `build.gradle.something`. \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9c913aa92c..f65a3ce040 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-8.8-20240303001623+0000-bin.zip +distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-8.8-20240307004408+0000-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME