Skip to content

Commit

Permalink
Merge pull request #131 from gradle/sg/init-docs
Browse files Browse the repository at this point in the history
Add some content for build init
  • Loading branch information
big-guy authored Oct 31, 2024
2 parents 78cc066 + d6feef7 commit c7c0a48
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 12 deletions.
15 changes: 7 additions & 8 deletions docs/getting-started/samples.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

All samples in this page can be used to demonstrate features made possible by Declarative Gradle.

- [Generate a new build with `gradle init`](../reference/build-init.md)
- [Java Application](#java-application)
- [Kotlin Application](#kotlin-application)
- [Android Application](#android-application)
Expand All @@ -19,33 +20,31 @@ After picking a sample, read about new [Declarative Gradle features](./features.

A sample Java application written in the Declarative Gradle DSL, using the prototype Declarative Gradle `javaApplication` Software Type defined in the `org.gradle.experimental.jvm-ecosystem` ecosystem plugin.

Please follow the README available at [github.com/gradle/declarative-samples-java-app](https://github.com/gradle/declarative-samples-java-app) to try this sample.
Please follow the README available at [gradle/declarative-samples-java-app](https://github.com/gradle/declarative-samples-java-app) to try this sample.

## Kotlin Application

A sample Kotlin application written in the Declarative Gradle DSL, using the prototype Declarative Gradle `kotlinJvmApplication` Software Type defined in the `org.gradle.experimental.kmp-ecosystem` ecosystem plugin.

Please follow the README available at [github.com/gradle/declarative-samples-kotlin-app](https://github.com/gradle/declarative-samples-kotlin-app) to try this sample.
Please follow the README available at [gradle/declarative-samples-kotlin-app](https://github.com/gradle/declarative-samples-kotlin-app) to try this sample.

## Android Application

A sample Android application written in the Declarative Gradle DSL, using the prototype Declarative Gradle `androidApplication` Software Type defined in the `org.gradle.experimental.android-ecosystem` ecosystem plugin.

Please follow the README available at [github.com/gradle/declarative-samples-android-app](https://github.com/gradle/declarative-samples-android-app) to try this sample.
Please follow the README available at [gradle/declarative-samples-android-app](https://github.com/gradle/declarative-samples-android-app) to try this sample.

## Now In Android

[Now in Android](https://github.com/android/nowinandroid) is a fully functional Android app built entirely with Kotlin and Jetpack Compose from the Android team.
We forked _Now in Android_ and updated the build to work with Declarative Gradle.
The prototype repository can be found in [github.com/gradle/nowinandroid](https://github.com/gradle/nowinandroid).
The prototype repository can be found in [gradle/nowinandroid](https://github.com/gradle/nowinandroid).

Please follow the README available at [github.com/gradle/nowinandroid/DECLARATIVE-README.md](https://github.com/gradle/nowinandroid/blob/main-declarative/DECLARATIVE-README.md) to try this sample.
Please follow the [README](https://github.com/gradle/nowinandroid/blob/main-declarative/DECLARATIVE-README.md) to try this sample.

## Bleeding edge prototypes

If you want to go further you can take a look at some more projects for JVM, Android, KMP, Swift and C++ projects. These projects may use newer versions of Gradle or require additional manual setup, so you should try the other samples first.

They are available at [github.com/gradle/declarative-gradle/tree/main/unified-prototype](https://github.com/gradle/declarative-gradle/tree/main/unified-prototype).
If you want to go further you can take a look at some more projects for JVM, Android, KMP, Swift and C++ projects. [These projects](https://github.com/gradle/declarative-gradle/tree/main/unified-prototype) may use newer versions of Gradle or require additional manual setup, so you should try the other samples first.

Please follow the README available in each directory linked below to try these samples.

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Declarative Gradle - Documentation

* [`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
* [`gradle init`](./build-init.md) - generate new projects using software types and DCL files
43 changes: 41 additions & 2 deletions docs/reference/build-init.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
# `gradle init`
# Generating new builds with `gradle init`

TODO
Gradle supports generating new builds using [`gradle init`](https://docs.gradle.org/current/userguide/build_init_plugin.html).

To make it easier to try Declarative Gradle with new samples, our prototypes have changed `gradle init` to generate samples that use declarative configuration language (DCL) files and software types.

An experimental system property has been added to Gradle to add new things that `gradle init` can generate. The value of the system property is a comma-separated list of plugins published to the [Gradle Plugin Portal](https://plugins.gradle.org/).

Example: `gradle init -Dorg.gradle.buildinit.specs=<plugin-id-1:version>,<plugin-id-2:version>`

!!! tip
This feature is only supported with nightlies of Gradle 8.12 created after October 24, 2024.

If you have the correct version of Gradle, you'll be asked a new question:

Additional project types were loaded. Do you want to generate a project using a contributed project specification?

Answer 'yes' (the default) to generate new Declarative Gradle builds.

# Supported project types

## Android

`gradle init -Dorg.gradle.buildinit.specs=org.gradle.experimental.android-ecosystem-init:0.1.23`

There are three build samples you can choose from.

By default, this generates a project like [gradle/declarative-samples-android-app](https://github.com/gradle/declarative-samples-android-app).

You can also generate a single Android application build with an empty Activity or basic Activity.

## Java

`gradle init -Dorg.gradle.buildinit.specs=org.gradle.experimental.jvm-ecosystem-init:0.1.23`

This init sample asks no questions and generates a project using Java like [gradle/declarative-samples-java-app](https://github.com/gradle/declarative-samples-java-app).

## Kotlin

`gradle init -Dorg.gradle.buildinit.specs=org.gradle.experimental.kmp-ecosystem-init:0.1.23`

This init sample asks no questions and generates a project using Kotlin like [gradle/declarative-samples-kotlin-app](https://github.com/gradle/declarative-samples-kotlin-app).
3 changes: 2 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ nav:
- Features: docs/getting-started/features.md
- Documentation:
- Overview: docs/reference/README.md
- Roadmap: docs/ROADMAP.md
- Generate new builds: docs/reference/build-init.md
- Software Features: docs/reference/software-features.md
- Roadmap: docs/ROADMAP.md
- Resources:
- Publications: docs/publications/README.md
- Contributing: docs/CONTRIBUTING.md
Expand Down

0 comments on commit c7c0a48

Please sign in to comment.