Skip to content

Commit

Permalink
Release/1.0.0-beta7 (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarari authored Feb 4, 2023
1 parent 6aea08f commit 7cf7a8f
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 42 deletions.
5 changes: 4 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@

# Changelog

## HotFix - 1.0.0-beta7
* Modules Dependency Graph first node selection bug fixed

## 1.0.0-beta6
* [Issue 89](https://github.com/janbarari/gradle-analytics-plugin/issues/89)
* [Feature 52](https://github.com/janbarari/gradle-analytics-plugin/issues/52)
* Tracking All Branches feature added [Feature 52](https://github.com/janbarari/gradle-analytics-plugin/issues/52)
* [Issue 90](https://github.com/janbarari/gradle-analytics-plugin/issues/90)
* Redundant Dependency Connection Metric [PR](https://github.com/janbarari/gradle-analytics-plugin/pull/93)
* Internal Logger [PR](https://github.com/janbarari/gradle-analytics-plugin/pull/86)
Expand Down
44 changes: 24 additions & 20 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@
[![codecov](https://codecov.io/gh/janbarari/gradle-analytics-plugin/branch/develop/graph/badge.svg)](https://codecov.io/gh/janbarari/gradle-analytics-plugin)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=janbarari_gradle-analytics-plugin&metric=alert_status)](https://sonarcloud.io/dashboard?id=janbarari_gradle-analytics-plugin)

A free Gradle plugin to analyze your project builds. It provides unique visual and text metrics in HTML format.
Have you encountered a lengthy build time despite using the best practices? Are you curious how top tech companies manage their massive project build times?

<br/>
Below you can see the metrics provided by the plugin 👇
The build is an important process. If we want to have a faster and more efficient build, we need to understand how it works for our project.

!!! Quote "If you can't measure it, you can't improve it. (Lord Kelvin)"

!!! Note ""

To understand the metrics and report that plugin provides, It is required to understand Gradle basics and how this build
system works.<br /><a href="https://docs.gradle.org/current/userguide/what_is_gradle.html" target="_blank">https://docs.gradle.org/current/userguide/what_is_gradle.html</a>
The Gradle Analytics Plugin helps you analyze and measure your project builds. It provides unique visual and text metrics in HTML format.

To understand the metrics and report that plugin provides, It is required to understand Gradle basics and how this build
system works.<br /><a href="https://docs.gradle.org/current/userguide/what_is_gradle.html" target="_blank">https://docs.gradle.org/current/userguide/what_is_gradle.html</a>

Below you can see the metrics provided by the plugin 👇

## Build Status
An overview of metrics results of the `requested task` in the build processes over the aforementioned period.
Expand All @@ -45,25 +48,25 @@ An overview of metrics results of the `requested task` in the build processes ov

<br/>
## Initialization Process
Gradle supports single and multi-project builds. During the initialization process, Gradle determines which projects are going to take part in the build, and creates a Project instance for each of these projects. By adding more projects or modules the process will take longer.
Gradle supports single and multi-project builds. During the initialization process, Gradle determines which projects are going to take part in the build, and creates a Project instance for each of these projects.

It denotes the average initialization process time over the report period.

![](img/initialization-process.png)

<br/>
## Configuration Process
Constructs and configures the task graph for the build and then determines which tasks need to run and in which order, based on the task the user wants to run. Be careful about the tasks you register to the project and try to make them cacheable.
Constructs and configures the task graph for the build and then determines which tasks need to run and in which order, based on the task the user wants to run.

It shows the average configuration process time over the report period.

![](img/configuration-process.png)

<br/>
## Dependency Resolve Process
Downloading and resolving the project's dependencies is one of the configuration process' stages. If the project has multiple third-party libraries dependencies, make sure that you have a good network speed.
Downloading the project's dependencies is one of the configuration process stages.

It represents the download(Dependency Resolve) process average duration during the report period.
It represents the download/resolve process average duration during the report period.

![](img/dependency-resolve-process.png)

Expand All @@ -77,7 +80,7 @@ It represents the Execution Process average duration during the report period.

<br/>
## Modules Execution Process
It represents the (Median) process execution time of each module over the report period.
It represents the median execution process time of each module over the report period.

![](img/module-execution-process-1.png)
![](img/module-execution-process-2.png)
Expand All @@ -90,7 +93,7 @@ It represents the average duration of overall build process.

<br/>
## Modules Source Count
It represents the project and its modules source file count. (files with extension of kt, java).
It represents the project and its modules source file count. (files with extension of `kt`, `java`).

![](img/modules-source-count.png)

Expand All @@ -110,7 +113,7 @@ It represents the project and its modules source method count.
## Cache Hit
Gradle creates a cache for the executed task to be reused in the next incremental builds, the more cached tasks lead to faster builds.

It represents the project and modules tasks average cache hit rate (tasks run with FROM_CACHE or UP_TO_DATE).
It represents the project and modules tasks average cache hit rate (tasks run with `FROM_CACHE` or `UP_TO_DATE`).

![](img/cache-hit.png)

Expand All @@ -122,23 +125,24 @@ It represents the successful build rate of the `requested task` during the repor

<br/>
## Modules Crash Count
It represents how many build failures happened during the `requested task` execution caused by project modules during the report period.
It represents how many build failures happened to the `requested task` execution caused by project modules during the report period.

![](img/modules-crash-count.png)

<br/>
## Parallel Execution Rate
Gradle uses CPU cores to execute more tasks simultaneously, leading to a faster build.

It represents a rate that how much time was saved in the execution of the build process with parallel execution versus real elapsed time.
It represents a rate of how much time was saved in the execution of the build process with parallel execution versus serial elapsed time.

![](img/parallel-execution-rate.png)

<br/>
## Modules Dependency Graph
It represents the project module's dependency graph and their connection types.
It represents the project module's dependency graph and with it connection types.

Modules have colors that warm colors have represents more dependent modules, and It is recommended to have fewer warm color modules because by applying any change in these modules, all other dependent modules need to rebuild and this cost more time and resources from your machines and put the builds in queue.
Modules in the graph are clickable (shows first/deep nodes).
Modules with warm colors are more dependent modules, and it is recommended to have fewer warm color modules because, by applying any change to these modules, all other dependent modules need to rebuild, which takes more time and resources.

![](img/modules-dependency-graph.gif)

Expand All @@ -156,7 +160,7 @@ It represents the latest modules execution process timeline graph.

<br/>
## Modules Build Heatmap
This plugin uses `Modules Cache Usage` and `Modules Dependency Graph` to generate this metric that shows how many times a module was built during the report period.
Shows how many times a module was built during the report period.

Each bar has the name of the module and the number of dependent modules, smaller warm bars lead to faster builds as those modules with warm colors have more dependent modules.

Expand All @@ -166,7 +170,7 @@ In addition, it helps to modify the modular structure by tracing the graph and f

<br/>
## Non-cacheable Tasks
These tasks are executed in the `requested task` tree without being cached. Try to avoid creating tasks that are not cacheable. Track this chart and detect tasks that are time-consuming.
These tasks are executed in the `requested task` tree without being cached. Try to avoid creating tasks that are not cacheable.

![](img/non-cacheable-tasks.png)

Expand Down
38 changes: 22 additions & 16 deletions docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ Apply the Gradle Plugin to the root of your project.
=== "Kotlin"
``` kotlin
plugins {
id("io.github.janbarari.gradle-analytics-plugin") version "1.0.0-beta5"
id("io.github.janbarari.gradle-analytics-plugin") version "1.0.0-beta7"
}
```
=== "Groovy"
``` groovy
plugins {
id 'io.github.janbarari.gradle-analytics-plugin' version '1.0.0-beta5'
id 'io.github.janbarari.gradle-analytics-plugin' version '1.0.0-beta7'
}
```
[For legacy plugin application, see the Gradle Plugin Portal.](https://plugins.gradle.org/plugin/io.github.janbarari.gradle-analytics-plugin)
Expand All @@ -56,7 +56,7 @@ Add plugin configuration in the root of your project.
=== "Kotlin"
``` kotlin
gradleAnalyticsPlugin {
isEnabled = true // By default it's True.
isEnabled = true // Optional: By default it's True.

database {
local = sqlite {
Expand All @@ -70,30 +70,32 @@ Add plugin configuration in the root of your project.
name = "MYSQL_DATABASE_NAME"
user = "MYSQL_DATABASE_USER"
password = "MYSQL_DATABASE_PASSWORD"
port = MYSQL_DATABASE_PORT // Default is 3306
port = MYSQL_DATABASE_PORT // Optional: Default is 3306.
}
}

trackingTasks = listOf(
trackingTasks = setOf(
// Add your requested tasks to be analyzed, Example:
":app:assembleDebug"
":app:assembleDebug",
":jar",
":assemble"
)

trackingBranches = listOf(
trackingBranches = setOf(
// requested tasks only analyzed in the branches you add here, Example:
"master",
"develop"
)

isTrackAllBranchesEnabled = false // Default is false
isTrackAllBranchesEnabled = false // Optional: Default is False.

outputPath = "OUTPUT_REPORT_PATH"
outputPath = "OUTPUT_REPORT_PATH" // Optional: Default is project /build/ dir.
}
```
=== "Groovy"
``` groovy
gradleAnalyticsPlugin {
isEnabled = true // By default it's True.
isEnabled = true // Optional: By default it's True.

database {
local = sqlite {
Expand All @@ -107,13 +109,15 @@ Add plugin configuration in the root of your project.
name = 'MYSQL_DATABASE_NAME'
user = 'MYSQL_DATABASE_USER'
password = 'MYSQL_DATABASE_PASSWORD'
port = MYSQL_DATABASE_PORT // Default is 3306
port = MYSQL_DATABASE_PORT // Optional: Default is 3306.
}
}

trackingTasks = [
// Add your requested tasks to be analyzed, Example:
':app:assembleDebug'
':app:assembleDebug',
':jar',
':assemble'
]

trackingBranches = [
Expand All @@ -122,18 +126,20 @@ Add plugin configuration in the root of your project.
'develop'
]

isTrackAllBranchesEnabled = false // Default is false
isTrackAllBranchesEnabled = false // Optional: Default is False.

outputPath = 'OUTPUT_REPORT_PATH'
outputPath = 'OUTPUT_REPORT_PATH' // Optional: Default is project /build/ dir.
}
```
<br/>
<strong>Important Notes</strong><br/>

- The plugin will create one automatically if there isn't an SQLite database. You only need to fill in the `name` and `path`.
- The plugin will create one automatically if there isn't an SQLite database. You only need to fill in the `name` and `path` (Recommended).
- Both `sqlite / mysql` can be used to config `local` or `ci` databases.
- The `local` or `ci` database can be skipped if don't need analytics on each of them.
- Both `local` and `ci` configs are optional.
- If using the plugin in your CI/CD make sure the `CI=true` environment variable exists in your CI system environments and the `ci` database is configured.
- The `outputPath` can be skipped, it will generate the report inside the project build directory.
- By enabling `isTrackAllBranchesEnabled` analytics will be kicked on all branches.
- `isEnabled` and `isTrackAllBranchesEnabled` are not mandatory since they have default values.

<br/>
6 changes: 4 additions & 2 deletions docs/third-party.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@
# Third party
All third-party dependencies that are being used in the plugin source:

- <b>Gradle API 7.4.2</b>
- <b>Gradle API 7.6</b>
- <b>Kotlin 1.6.20</b>
- <b>Coroutines 1.6.3</b>
- <b>Moshi 1.13.0</b>
- <b>Jetbrains Exposed 0.38.1</b>
- <b>Detekt 1.20.0-RC2</b>
- <b>Mockk 1.12.4</b>
- `mysql:mysql-connector-java:8.0.29`
- `org.xerial:sqlite-jdbc:3.36.0.3`
- `commons-io:commons-io:2.11.0`
- `com.github.oshi:oshi-core`
- `com.github.oshi:oshi-core:6.4.0`
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ pluginTags = kotlin,plugin,analytics,analysis,gradle,gradle-plugin,gradle-plugin
pluginImplementationClass = io.github.janbarari.gradle.analytics.GradleAnalyticsPlugin
pluginDeclarationName = gradleAnalyticsPlugin
pluginGroupPackageName = io.github.janbarari
pluginVersion = 1.0.0-beta6
pluginVersion = 1.0.0-beta7
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class GradleAnalyticsPlugin @Inject constructor(

companion object {
const val PLUGIN_NAME = "gradleAnalyticsPlugin"
const val PLUGIN_VERSION = "1.0.0-beta6"
const val PLUGIN_VERSION = "1.0.0-beta7"
const val OUTPUT_DIRECTORY_NAME = "gradle-analytics-plugin"
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/modules-dependency-graph-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
for(var i=0; i<parsedGraph.dependencies.length; i++) {
const item = parsedGraph.dependencies[i];

if(item.path == path || item.dependency.includes(path)) {
if(item.path == path || item.dependency == path) {
addedItems.push(item);

var type = "";
Expand Down

0 comments on commit 7cf7a8f

Please sign in to comment.