docs(gradle): add gradle overview page (#22552)
This commit is contained in:
parent
56f16d8077
commit
07ef435127
@ -8001,6 +8001,23 @@
|
||||
"path": "/nx-api/gradle",
|
||||
"name": "gradle",
|
||||
"children": [
|
||||
{
|
||||
"id": "documents",
|
||||
"path": "/nx-api/gradle/documents",
|
||||
"name": "documents",
|
||||
"children": [
|
||||
{
|
||||
"name": "Overview",
|
||||
"path": "/nx-api/gradle/documents/overview",
|
||||
"id": "overview",
|
||||
"isExternal": false,
|
||||
"children": [],
|
||||
"disableCollapsible": false
|
||||
}
|
||||
],
|
||||
"isExternal": false,
|
||||
"disableCollapsible": false
|
||||
},
|
||||
{
|
||||
"id": "generators",
|
||||
"path": "/nx-api/gradle/generators",
|
||||
|
||||
@ -1012,7 +1012,19 @@
|
||||
"name": "gradle",
|
||||
"packageName": "@nx/gradle",
|
||||
"description": "The Nx Plugin for Gradle allows Gradle tasks to be run through Nx",
|
||||
"documents": {},
|
||||
"documents": {
|
||||
"/nx-api/gradle/documents/overview": {
|
||||
"id": "overview",
|
||||
"name": "Overview",
|
||||
"description": "The Nx Plugin for Gradle allows Gradle tasks to be run through Nx",
|
||||
"file": "generated/packages/gradle/documents/overview",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "/nx-api/gradle/documents/overview",
|
||||
"tags": [],
|
||||
"originalFilePath": "shared/packages/gradle/gradle-plugin"
|
||||
}
|
||||
},
|
||||
"root": "/packages/gradle",
|
||||
"source": "/packages/gradle/src",
|
||||
"executors": {},
|
||||
|
||||
@ -998,7 +998,19 @@
|
||||
},
|
||||
{
|
||||
"description": "The Nx Plugin for Gradle allows Gradle tasks to be run through Nx",
|
||||
"documents": [],
|
||||
"documents": [
|
||||
{
|
||||
"id": "overview",
|
||||
"name": "Overview",
|
||||
"description": "The Nx Plugin for Gradle allows Gradle tasks to be run through Nx",
|
||||
"file": "generated/packages/gradle/documents/overview",
|
||||
"itemList": [],
|
||||
"isExternal": false,
|
||||
"path": "gradle/documents/overview",
|
||||
"tags": [],
|
||||
"originalFilePath": "shared/packages/gradle/gradle-plugin"
|
||||
}
|
||||
],
|
||||
"executors": [],
|
||||
"generators": [
|
||||
{
|
||||
|
||||
82
docs/generated/packages/gradle/documents/overview.md
Normal file
82
docs/generated/packages/gradle/documents/overview.md
Normal file
@ -0,0 +1,82 @@
|
||||
---
|
||||
title: Overview of the Nx Gradle Plugin
|
||||
description: The Nx Plugin for Gradle allows Gradle tasks to be run through Nx.
|
||||
---
|
||||
|
||||
[Gradle](https://gradle.org/) is a fast, dependable, and adaptable open-source build automation tool with an elegant and extensible declarative build language. Gradle supports Android, Java, Kotlin Multiplatform, Groovy, Scala, Javascript, and C/C++.
|
||||
|
||||
The Nx Gradle plugin registers Gradle projects in your Nx workspace. It allows Gradle tasks to be run through Nx. Nx effortlessly makes your [CI faster](/ci/intro/ci-with-nx).
|
||||
|
||||
Nx adds the following features to your workspace:
|
||||
|
||||
- [Cache task results](/features/cache-task-results)
|
||||
- [Distribute task execution](/ci/features/distribute-task-execution)
|
||||
- [Run only tasks affected by a PR](/ci/features/affected)
|
||||
- [Interactively explore your workspace](/features/explore-graph)
|
||||
|
||||
## Add Nx to a Gradle Workspace
|
||||
|
||||
In any Gradle workspace, run the following command to add Nx and select @nx/gradle:
|
||||
|
||||
```shell {% skipRescope=true %}
|
||||
npx nx@latest init
|
||||
```
|
||||
|
||||
Then, you can run Gradle tasks using Nx. For example:
|
||||
|
||||
{% tabs %}
|
||||
{% tab label="Mac/Linux" %}
|
||||
|
||||
```shell {% skipRescope=true %}
|
||||
./nx build <your gradle library>
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% tab label="Windows" %}
|
||||
|
||||
```shell {% skipRescope=true %}
|
||||
nx.bat build <your gradle library>
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% /tabs %}
|
||||
|
||||
## Setting Up @nx/gradle in a Nx Workspace
|
||||
|
||||
In any Nx workspace, you can install `@nx/gradle` by running the following command:
|
||||
|
||||
```shell {% skipRescope=true %}
|
||||
nx add @nx/gradle
|
||||
```
|
||||
|
||||
## How @nx/gradle Infers Tasks
|
||||
|
||||
The `@nx/gradle` plugin will create an Nx project for each Gradle configuration file present. Any of the following files will be recognized as a Gradle configuration file:
|
||||
|
||||
- `gradle.build`
|
||||
- `gradle.build.kts`
|
||||
|
||||
### @nx/gradle Configuration
|
||||
|
||||
The `@nx/gradle` is configured in the `plugins` array in `nx.json`.
|
||||
|
||||
```json {% fileName="nx.json" %}
|
||||
{
|
||||
"plugins": [
|
||||
{
|
||||
"plugin": "@nx/gradle",
|
||||
"options": {
|
||||
"testTargetName": "test",
|
||||
"classesTargetName": "classes",
|
||||
"buildTargetName": "build"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Once a Gradle configuration file has been identified, the targets are created with the name you specify under `testTargetName`, `classesTargetName` or `buildTargetName` in the `nx.json` `plugins` array. The default names for the inferred targets are `test`, `classes` and `build`.
|
||||
|
||||
## View Inferred Tasks
|
||||
|
||||
To view inferred tasks for a project, open the [project details view](/features/explore-graph#explore-projects-in-your-workspace) in Nx Console or run `nx show project my-project --web` in the command line.
|
||||
@ -2544,6 +2544,19 @@
|
||||
"file": "shared/packages/expo/expo-plugin"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "gradle",
|
||||
"id": "gradle",
|
||||
"description": "Gradle package.",
|
||||
"itemList": [
|
||||
{
|
||||
"id": "overview",
|
||||
"name": "Overview",
|
||||
"path": "/nx-api/gradle",
|
||||
"file": "shared/packages/gradle/gradle-plugin"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
82
docs/shared/packages/gradle/gradle-plugin.md
Normal file
82
docs/shared/packages/gradle/gradle-plugin.md
Normal file
@ -0,0 +1,82 @@
|
||||
---
|
||||
title: Overview of the Nx Gradle Plugin
|
||||
description: The Nx Plugin for Gradle allows Gradle tasks to be run through Nx.
|
||||
---
|
||||
|
||||
[Gradle](https://gradle.org/) is a fast, dependable, and adaptable open-source build automation tool with an elegant and extensible declarative build language. Gradle supports Android, Java, Kotlin Multiplatform, Groovy, Scala, Javascript, and C/C++.
|
||||
|
||||
The Nx Gradle plugin registers Gradle projects in your Nx workspace. It allows Gradle tasks to be run through Nx. Nx effortlessly makes your [CI faster](/ci/intro/ci-with-nx).
|
||||
|
||||
Nx adds the following features to your workspace:
|
||||
|
||||
- [Cache task results](/features/cache-task-results)
|
||||
- [Distribute task execution](/ci/features/distribute-task-execution)
|
||||
- [Run only tasks affected by a PR](/ci/features/affected)
|
||||
- [Interactively explore your workspace](/features/explore-graph)
|
||||
|
||||
## Add Nx to a Gradle Workspace
|
||||
|
||||
In any Gradle workspace, run the following command to add Nx and select @nx/gradle:
|
||||
|
||||
```shell {% skipRescope=true %}
|
||||
npx nx@latest init
|
||||
```
|
||||
|
||||
Then, you can run Gradle tasks using Nx. For example:
|
||||
|
||||
{% tabs %}
|
||||
{% tab label="Mac/Linux" %}
|
||||
|
||||
```shell {% skipRescope=true %}
|
||||
./nx build <your gradle library>
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% tab label="Windows" %}
|
||||
|
||||
```shell {% skipRescope=true %}
|
||||
nx.bat build <your gradle library>
|
||||
```
|
||||
|
||||
{% /tab %}
|
||||
{% /tabs %}
|
||||
|
||||
## Setting Up @nx/gradle in a Nx Workspace
|
||||
|
||||
In any Nx workspace, you can install `@nx/gradle` by running the following command:
|
||||
|
||||
```shell {% skipRescope=true %}
|
||||
nx add @nx/gradle
|
||||
```
|
||||
|
||||
## How @nx/gradle Infers Tasks
|
||||
|
||||
The `@nx/gradle` plugin will create an Nx project for each Gradle configuration file present. Any of the following files will be recognized as a Gradle configuration file:
|
||||
|
||||
- `gradle.build`
|
||||
- `gradle.build.kts`
|
||||
|
||||
### @nx/gradle Configuration
|
||||
|
||||
The `@nx/gradle` is configured in the `plugins` array in `nx.json`.
|
||||
|
||||
```json {% fileName="nx.json" %}
|
||||
{
|
||||
"plugins": [
|
||||
{
|
||||
"plugin": "@nx/gradle",
|
||||
"options": {
|
||||
"testTargetName": "test",
|
||||
"classesTargetName": "classes",
|
||||
"buildTargetName": "build"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Once a Gradle configuration file has been identified, the targets are created with the name you specify under `testTargetName`, `classesTargetName` or `buildTargetName` in the `nx.json` `plugins` array. The default names for the inferred targets are `test`, `classes` and `build`.
|
||||
|
||||
## View Inferred Tasks
|
||||
|
||||
To view inferred tasks for a project, open the [project details view](/features/explore-graph#explore-projects-in-your-workspace) in Nx Console or run `nx show project my-project --web` in the command line.
|
||||
@ -450,6 +450,8 @@
|
||||
- [init](/nx-api/express/generators/init)
|
||||
- [application](/nx-api/express/generators/application)
|
||||
- [gradle](/nx-api/gradle)
|
||||
- [documents](/nx-api/gradle/documents)
|
||||
- [Overview](/nx-api/gradle/documents/overview)
|
||||
- [generators](/nx-api/gradle/generators)
|
||||
- [init](/nx-api/gradle/generators/init)
|
||||
- [jest](/nx-api/jest)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user