Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .run/projectTree.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="projectTree" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--rerun-tasks" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="projectTree" />
<option value="--verifyDepth=3" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
4 changes: 2 additions & 2 deletions .run/diagonDAG.run.xml → .run/taskGraph.run.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="diagonDAG" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="taskGraph" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
Expand All @@ -11,7 +11,7 @@
<option name="taskNames">
<list>
<option value="assemble" />
<option value="diagonDAG" />
<option value="taskGraph" />
</list>
</option>
<option name="vmOptions" />
Expand Down
5 changes: 2 additions & 3 deletions .run/tasktree.run.xml → .run/taskTree.run.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="tasktree" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="taskTree" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
Expand All @@ -10,8 +10,7 @@
</option>
<option name="taskNames">
<list>
<option value="assemble" />
<option value="tasktree" />
<option value="taskTree" />
</list>
</option>
<option name="vmOptions" />
Expand Down
12 changes: 0 additions & 12 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +0,0 @@
buildscript {
repositories {
gradlePluginPortal()
mavenCentral()
google()
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.21")
classpath("org.jetbrains.kotlin:kotlin-serialization:1.7.21")
}
}
20 changes: 9 additions & 11 deletions example/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id("java")
id("tasktree")
`kotlin-dsl`
alias(libs.plugins.tasktree)
}

val firstTask = tasks.create("simple_first_task") {
Expand Down Expand Up @@ -31,17 +31,15 @@ tasks.create("sub_second_task") {
}

tasktree {

inputs = false
outputs = false
printClassName = false
printDetails = false
printPrice = true
printImportance = true
printComplexPrice = true
printDoubles = true
printImportanceOutSide = true


printRelativePrice = true
printDoubles = false
printMostExpensive = true
}

dependencies {
implementation(project(":example_core"))
}

4 changes: 4 additions & 0 deletions example_core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
plugins {
`kotlin-dsl`
}

6 changes: 4 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
kotlin.code.style=official
android.nonTransitiveRClass=true
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configureondemand=true
org.gradle.configuration-cache=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
14 changes: 14 additions & 0 deletions libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[versions]

tasktree = "0.0.9"

[libraries]

[bundles]


[plugins]

publish-plugin = { id = "com.gradle.plugin-publish", version = "1.1.0" }
tasktree = { id = "com.github.klee0kai.tasktree", version.ref = "tasktree" }

53 changes: 34 additions & 19 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,14 @@ Print gradle task dependencies graph

## Usage

Configure classpath in project's `build.gradle`:

```kotlin
buildscript {
repositories {
maven(url = "https://jitpack.io")
}
dependencies {
classpath("com.github.klee0kai:tasktree:0.0.9")
}
}
```

Apply plugin in your module's `build.gradle`:

```kotlin
plugins {
id("tasktree")
id("com.github.klee0kai.tasktree") version "0.0.9"
}

tasktree {
inputs = false
outputs = false
printClassName = true
maxDepth = 1
}
Expand All @@ -38,7 +23,35 @@ tasktree {
Report your build graph

```bash
./gradlew tasktree assemble
./gradlew taskTree assemble

>>
:example:assemble price: 12; depth: 6; importance: 3; relativePrice: 0,55; relativeDepth: 0,67;
+--- :example:simple_first_task price: 2; depth: 2; importance: 4; relativePrice: 0,09; relativeDepth: 0,22;
| \--- :example:sub_first_task price: 1; depth: 1; importance: 5; relativePrice: 0,05; relativeDepth: 0,11;

```

Verify project's module dependency depth

```bash
./gradlew projectTree --verifyDepth=1

>> Heavy projects: ':example' depth: 2
```

Build graphs

```bash
./gradlew projectGraph

>>
┌─────────────┐
│:example_core│
└┬────────────┘
┌▽───────┐
│:example│
└────────┘
```

## Configure Init Script
Expand All @@ -52,7 +65,7 @@ initscript {
maven(url = "https://jitpack.io")
}
dependencies {
classpath("com.github.klee0kai:tasktree:0.0.9")
classpath("com.github.klee0kai.tasktree:com.github.klee0kai.tasktree.gradle.plugin:0.0.9")
}
}

Expand All @@ -61,7 +74,9 @@ rootProject{

extensions.findByType(com.github.klee0kai.tasktree.TaskTreeExtension::class.java)
?.apply {
printComplexPrice = true
maxDepth = 1
printDetails = true
printRelativePrice = true
}
}
```
Expand Down
6 changes: 6 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ dependencyResolutionManagement {
google()
mavenCentral()
}
versionCatalogs {
create("libs") {
from(files("libs.versions.toml"))
}
}
}

rootProject.name = "taskTree"
includeBuild("tasktree")
include("example")
include("example_core")
21 changes: 5 additions & 16 deletions tasktree/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.21")
classpath("org.jetbrains.kotlin:kotlin-serialization:1.7.21")
}
}

plugins {
`kotlin-dsl`
`java-gradle-plugin`
id("com.gradle.plugin-publish") version "1.1.0"
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
alias(libs.plugins.publish.plugin)
}

group = libs.plugins.tasktree.get().pluginId

gradlePlugin {
plugins.register("tasktree") {
id = "tasktree"
group = "com.github.klee0kai"
version = "0.0.9"
id = libs.plugins.tasktree.get().pluginId
group = libs.plugins.tasktree.get().pluginId
version = libs.versions.tasktree.get()
implementationClass = "com.github.klee0kai.tasktree.TaskTreePlugin"
displayName = "Task Tree"
description = "Print gradle build dependencies graph"
Expand Down
5 changes: 5 additions & 0 deletions tasktree/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ dependencyResolutionManagement {
mavenCentral()
maven(url = "https://jitpack.io")
}
versionCatalogs {
create("libs") {
from(files("../libs.versions.toml"))
}
}
}

rootProject.name = "tasktree"
Expand Down
27 changes: 0 additions & 27 deletions tasktree/src/main/kotlin/com/github/klee0kai/tasktree/TaskStat.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,15 @@ package com.github.klee0kai.tasktree

open class TaskTreeExtension {

/**
* Print task inputs
*/
var inputs: Boolean = false

/**
* Print task outputs
*/
var outputs: Boolean = false

/**
* Graph max depth
*/
var maxDepth: Int = -1

/**
* print task's class type
* print task's/project additional details
*/
var printClassName: Boolean = false
var printDetails: Boolean = false

/**
* Don't show doubles in graph
Expand All @@ -38,29 +28,15 @@ open class TaskTreeExtension {
var printImportance: Boolean = false

/**
* Print the number of dependent tasks from another project
* show the relative price from the maximum
*/
var printImportanceOutSide: Boolean = false
var printRelativePrice: Boolean = false

/**
* Complex price
* ```
* ( price ) * ( importance )
* ```
* Show that task expensive to run and necessary for many others
*/
var printComplexPrice: Boolean = false


/**
* List sorted list of most expensive tasks
*/
var printMostExpensiveTasks: Boolean = false

/**
* List sorted list of most expensive modules
* List sorted list of most expensive tasks or projects
*/
var printMostExpensiveModules: Boolean = false
var printMostExpensive: Boolean = false

}

Expand Down
Loading