https://github.com/getrighhttt/gradlethings
Repository to demonstrate how to work with Gradle.
https://github.com/getrighhttt/gradlethings
Last synced: 5 months ago
JSON representation
Repository to demonstrate how to work with Gradle.
- Host: GitHub
- URL: https://github.com/getrighhttt/gradlethings
- Owner: GetRighhttt
- Created: 2024-02-19T00:18:10.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-02-19T21:58:36.000Z (over 2 years ago)
- Last Synced: 2025-02-07T16:16:23.826Z (over 1 year ago)
- Size: 70.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gradle
### What is Gradle?
- Build automation tool
- Takes your code and packages it into deployable unit
- applies to small or large projects
- written in the Kotlin language
- can also be written in Groovy
- highly configurable to meet project needs

#### Why use Gradle
- Makes building and running applications very easy
- no need for people using your projects to install Gradle
- Gradle wrapper comes bundled in with project
- Just run `./graldew build` and you should be ok
- Very concise; no XML configuration needed
- lightning fast
- Had **dependency management** which is an automated technique for declaring and resolving external resources needed for the project
#### Key Gradle Concepts
- `build.gradle.kts` is the Gradle build script file
- defines how project is build
- written in Kotlin DSL
- lives in top-level of the project
- has `plugins` (extend gradle capability), `repositories`, and `dependencies`, also houses some metadata
- `tasks` defines a unit of work
- invoked form the command line
- `./gradlew build` is considered a build task
- see a full list of available tasks by running `./gradlew tasks`
- can also create own custom tasks
- task can have dependencies on other tasks
- creates a task graph of dependencies
- `wrapper` is the script used to invoke Gradle and run tasks
- always committed into version control
- no local Gradle installation required for anyone building your project
- contains a specific version of gradle for the project
- ALWAYS use the Gradle wrapper script for safety (unless initializing new gradle project)
#### Gradle Project Structure
- Gradle supports single-project and multi-project structures
- single-project structures are usually for smaller projects with a single build output
- multi-project structures are for larger projects with multiple build outputs
#### Typical Structure
| -- `build.gradle.kts` -> main build configuration file
| -- `gradle` -> contains configuration and code for Gradle wrapper
| -- `wrapper`
| | -- `gradle-wrapper.jar`
| -- `gradle-wrapper.properties`
| -- `gradlew` -> gradle wrapper script (Windows and Linux)
| -- `gradlew.bat`
-- `settings.gradle.kts` -> set project name, and additional settings
- all files and directories should be committed into version control automatically
- `.gradle` should not be committed into version control as it is hidden
- project specific cache used internally by Gradle
- `.gitignore` automatically generated by gradle when a project is created
#### Gradle Wrapper
- Standardizes a gradle version used for the project
- Recommended way to invoke all Gradle builds and scripts
- Ensures reliable and standardized build for gradle