Skip to content

Commit

Permalink
Merge pull request #107 from PatilShreyas/config-cache
Browse files Browse the repository at this point in the history
Add support for configuration cache
  • Loading branch information
PatilShreyas committed May 19, 2024
2 parents e9f64c9 + d7b1e7d commit 0b0b677
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,5 +222,5 @@ fun printHeader(header: String) =
)

object Constants {
const val VERSION = "v1.2.0"
const val VERSION = "v1.3.1"
}
2 changes: 1 addition & 1 deletion docs/use/using-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Run the command to know the usage of CLI
!!! success "▶️Output"

```shell
Usage: Compose Compiler Report to HTML Generator ~ v1.2.0 options_list
Usage: Compose Compiler Report to HTML Generator ~ v1.3.1 options_list
Options:
--applicationName, -app -> Application name (To be displayed in the report) (always required) { String }
--inputDirectory, -i -> Input directory where composable report and metrics are available { String }
Expand Down
8 changes: 4 additions & 4 deletions docs/use/using-gradle-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ Apply the plugin to the module in which _**compose is enabled**_.

```groovy title="build.gradle"
plugins {
id "dev.shreyaspatil.compose-compiler-report-generator" version "1.2.0"
id "dev.shreyaspatil.compose-compiler-report-generator" version "1.3.1"
}
```

=== "Kotlin"

```kotlin title="build.gradle.kts"
plugins {
id("dev.shreyaspatil.compose-compiler-report-generator") version "1.2.0"
id("dev.shreyaspatil.compose-compiler-report-generator") version "1.3.1"
}
```

Expand All @@ -45,7 +45,7 @@ Add this to top project level `build.gradle`
}
}
dependencies {
classpath "dev.shreyaspatil.compose-compiler-report-generator:gradle-plugin:1.2.0"
classpath "dev.shreyaspatil.compose-compiler-report-generator:gradle-plugin:1.3.1"
}
}
```
Expand All @@ -66,7 +66,7 @@ Add this to top project level `build.gradle`
}
}
dependencies {
classpath("dev.shreyaspatil.compose-compiler-report-generator:gradle-plugin:1.2.0")
classpath("dev.shreyaspatil.compose-compiler-report-generator:gradle-plugin:1.3.1")
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.TaskProvider
import org.gradle.tooling.GradleConnector
Expand All @@ -44,7 +48,12 @@ import java.io.FileNotFoundException

const val KEY_ENABLE_REPORT_GEN = "dev.shreyaspatil.composeCompiler.reportGen.enable"

@CacheableTask
abstract class ComposeCompilerReportGenerateTask : DefaultTask() {
@get:InputDirectory
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val projectDirectory: DirectoryProperty

@get:Input
abstract val compileKotlinTasks: Property<String>

Expand Down Expand Up @@ -80,7 +89,7 @@ abstract class ComposeCompilerReportGenerateTask : DefaultTask() {
}

private fun generateRawMetricsAndReport() {
GradleConnector.newConnector().forProjectDirectory(project.layout.projectDirectory.asFile)
GradleConnector.newConnector().forProjectDirectory(projectDirectory.get().asFile)
.connect()
.use {
it.newBuild()
Expand Down Expand Up @@ -153,6 +162,7 @@ fun Project.registerComposeCompilerReportGenTaskForVariant(variant: Variant): Ta
val reportExtension = ComposeCompilerReportExtension.get(project)

return tasks.register(taskName, ComposeCompilerReportGenerateTask::class.java) {
projectDirectory.set(layout.projectDirectory)
compileKotlinTasks.set(compileKotlinTaskName)
reportName.set(reportExtension.name)
composeRawMetricsOutputDirectory.set(reportExtension.composeRawMetricsOutputDirectory)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kotlin.code.style=official

GROUP=dev.shreyaspatil.compose-compiler-report-generator
VERSION_NAME=1.2.0
VERSION_NAME=1.3.1

# Library configuration
SONATYPE_HOST=DEFAULT
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"main": "index.js",
"preferGlobal": true,
"repository": "https://github.com/PatilShreyas/compose-report-to-html",
"version": "1.2.0",
"version": "1.3.1",
"jdeploy": {
"jdk": false,
"javaVersion": "11",
Expand Down

0 comments on commit 0b0b677

Please sign in to comment.