Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add Migration Example Docs #178

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Add Migration Example Docs #178

wants to merge 4 commits into from

Conversation

tresat
Copy link
Member

@tresat tresat commented Mar 6, 2025

No description provided.

@tresat tresat self-assigned this Mar 6, 2025
@@ -11,7 +11,7 @@ Below, you can see the key milestones we anticipate.
| ----------------------------------- |:-:| ------------: |
| First Early Access Preview (EAP) | ✅ | July 2024 |
| Second Early Access Preview (EAP 2) | ✅ | November 2024 |
| Third Early Access Preview (EAP 3) | 🏗️ | February 2025 |
| Third Early Access Preview (EAP 3) | 🏗️ | March 2025 |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

```
pluginManagement {
repositories {
gradlePluginPortal()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean? Removing this from the included declarative-logic build in the Gradle Client breaks that build.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this place it is the settings file for the outer build, me thinks. Then it's not necessary here,

💭 It would be good to have the path of the file for each snippet to make navigating the snippets easier.

```

And we _removed_ these dependencies from the `jvmMain.dependencies` block where they were previously declared.
Set the org.gradle.kotlin.dsl.dcl flag in the project's properties file.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks out of place?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll edit to make it stand out more. It is needed as part of this step, else Software Types won't work in KTS files.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be part of the "initial setup"

}
```

And we _removed_ these dependencies from the `jvmMain.dependencies` block where they were previously declared.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's unclear here is if this is equivalent or if we've changed the meaning of these dependencies.

I think because Gradle Client was only targeting the JVM and the kotlinApplication software type only works with JVM, this is the same.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I'll go into more detail here.


This represents the minimal configuration needed to make use of this `kotlinApplication` Software Type - which is why this snippet also declares the required JDK version information.

Continue to do this for each of your dependencies.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To do what?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will expand.

@@ -2,4 +2,5 @@

* [`gradle init`](./build-init.md) - generate new builds using software types and DCL files
* [Software Features](./software-features.md) - configuration model used by software developers
* [Example Project Migration](./migrating-example.md) - notes on the migration of an actual Gradle KMP build to DCL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ I would not call it KMP, it is not multiplatform, it only targets the JVM.

Suggested change
* [Example Project Migration](./migrating-example.md) - notes on the migration of an actual Gradle KMP build to DCL
* [Example Project Migration](./migrating-example.md) - notes on the migration of an existing Gradle build for a Kotlin Compose for Desktop Application to DCL

@@ -0,0 +1,171 @@
# Example Migration

In Feb/March 2025, using the version of Declarative Gradle that would be made available as EAP 3, we migrated the [`gradle client`](https://github.com/gradle/gradle-client) to using DCL build files and a custom Software Type that described the tools and features used by this particular build.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💭 It might be good to quickly explain what the "gradle-client" is here. A single sentence should be enough.

Gradle has always supported mixing build script DSLs between projects in a multi-project build using Groovy and Kotlin DSLs.
It continues to support doing the same with DCL buildscripts, which allows us to migrate project by project.

# Migration Process for Gradle-Client
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 I would make this two parts. First a short section about the overall migration process and then a more detailed one about how it was applied to gradle-client. My thinking is that the former section would help readers get an idea of the overall process and refer to it as a kind of reference after having read the rest.


Features are constantly being added to the Declarative Gradle support.
Any project interested in experimenting with DCL files should ensure they are using at least the latest stable Gradle release.
For the migration of the Gradle-Client project, we upgraded the wrapper to use a nightly Gradle build [gradle-8.14-20250222002553+0000](https\://services.gradle.org/distributions-snapshots/gradle-8.14-20250222002553+0000-bin.zip) in order to get support for the very latest Declarative Gradle features.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ We should use a published version here, a milestone would be good.

Comment on lines +29 to +32
We decided to start with the [`gradle-client` subproject](https://github.com/gradle/gradle-client/tree/main/gradle-client), as this was the most important and fully featured project contained in the Gradle Client build, which would be the most interesting to investigate.
For your own migrations, you should probably consider which projects would be _simplest_ to migrate.
Projects that are simpler and most similar to our declarative samples are good candidates.
If your project _doesn't_ already use Gradle's Kotlin DSL, you'll want to migrate to this first from your Groovy build using the existing [migration guide](https://docs.gradle.org/current/userguide/migrating_from_groovy_to_kotlin_dsl.html) in the Gradle documentation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ I would explain this in the reverse order. I think we should explain the simplest first. Identify the projects for which an existing prototype software type already exists, vs. the ones for which they will have to write a custom one. This is a good opportunity to explain the current lack of composability and teach users how to navigate this current limitation. Then migrate the easy ones first in order to make progress quickly and get accustomed to DCL idioms before diving. Later one come back to the complex projects and introduce custom software type(s).

```
pluginManagement {
repositories {
gradlePluginPortal()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this place it is the settings file for the outer build, me thinks. Then it's not necessary here,

💭 It would be good to have the path of the file for each snippet to make navigating the snippets easier.

```

And we _removed_ these dependencies from the `jvmMain.dependencies` block where they were previously declared.
Set the org.gradle.kotlin.dsl.dcl flag in the project's properties file.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be part of the "initial setup"

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants