From 1700c6fafadff4826e7e1797e03b93ead00694a2 Mon Sep 17 00:00:00 2001 From: arunkumar9t2 Date: Thu, 9 Nov 2023 18:34:15 +0800 Subject: [PATCH] Use gradle files API instead of Java file API --- .../internal/ComputeWorkspaceDependenciesTask.kt | 6 +----- .../tasks/internal/ResolveVariantDependenciesTask.kt | 11 +++++------ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/tasks/internal/ComputeWorkspaceDependenciesTask.kt b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/tasks/internal/ComputeWorkspaceDependenciesTask.kt index c187e5d0..25bd3c23 100644 --- a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/tasks/internal/ComputeWorkspaceDependenciesTask.kt +++ b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/tasks/internal/ComputeWorkspaceDependenciesTask.kt @@ -34,7 +34,6 @@ import org.gradle.api.tasks.PathSensitivity import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.TaskProvider import org.gradle.kotlin.dsl.register -import java.io.File @CacheableTask abstract class ComputeWorkspaceDependenciesTask : DefaultTask() { @@ -65,10 +64,7 @@ abstract class ComputeWorkspaceDependenciesTask : DefaultTask() { val computeTask = rootProject.tasks .register(TASK_NAME) { workspaceDependencies.set( - File( - rootProject.buildDir, - "grazel/mergedDependencies.json" - ) + rootProject.layout.buildDirectory.file("grazel/mergedDependencies.json") ) } ResolveVariantDependenciesTask.register( diff --git a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/tasks/internal/ResolveVariantDependenciesTask.kt b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/tasks/internal/ResolveVariantDependenciesTask.kt index 0ebab290..5f28c007 100644 --- a/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/tasks/internal/ResolveVariantDependenciesTask.kt +++ b/grazel-gradle-plugin/src/main/kotlin/com/grab/grazel/tasks/internal/ResolveVariantDependenciesTask.kt @@ -49,8 +49,8 @@ import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.TaskProvider import org.gradle.kotlin.dsl.named import org.gradle.kotlin.dsl.register -import java.io.File -import java.util.* +import java.util.TreeMap +import java.util.TreeSet import kotlin.streams.asSequence @CacheableTask @@ -250,10 +250,9 @@ internal abstract class ResolveVariantDependenciesTask : DefaultTask() { } - val resolvedDependenciesJson = File( - project.buildDir, - "grazel/${variant.name}/dependencies.json" - ) + val resolvedDependenciesJson = project.layout + .buildDirectory + .file("grazel/${variant.name}/dependencies.json") val resolveVariantDependenciesTask = project.tasks .register(