Browse Source

Remove usages of internal Gradle API FileOperations (#2606)

dima-avdeev/resources-demo-js-workaround
Alexey Tsvetkov 2 years ago committed by GitHub
parent
commit
4f1bb98711
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposeExtension.kt
  2. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt
  3. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/JvmApplicationBuildTypes.kt
  4. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/MacOSNotarizationSettings.kt
  5. 4
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/MacOSSigningSettings.kt
  6. 4
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/ProguardSettings.kt
  7. 4
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/TargetFormat.kt
  8. 1
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/ExternalToolRunner.kt
  9. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/JvmApplicationContext.kt
  10. 1
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/JvmApplicationData.kt
  11. 1
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/JvmApplicationInternal.kt
  12. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/JvmTasks.kt
  13. 1
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/MacSigner.kt
  14. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/configureDesktop.kt
  15. 8
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/configureJvmApplication.kt
  16. 4
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/configureNativeApplication.kt
  17. 1
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/dirLayoutUtils.kt
  18. 4
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/files/fileUtils.kt
  19. 1
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/packageVersions.kt
  20. 4
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/validation/ValidatedMacOSSigningSettings.kt
  21. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/validation/validatePackageVersions.kt
  22. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/wixToolset.kt
  23. 10
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractCheckNativeDistributionRuntime.kt
  24. 4
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractCheckNotarizationStatusTask.kt
  25. 6
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractJLinkTask.kt
  26. 19
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractJPackageTask.kt
  27. 6
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractJvmToolOperationTask.kt
  28. 6
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractNativeMacApplicationPackageAppDirTask.kt
  29. 4
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractNativeMacApplicationPackageDmgTask.kt
  30. 5
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractNativeMacApplicationPackageTask.kt
  31. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractNotarizationTask.kt
  32. 6
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractProguardTask.kt
  33. 8
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractRunDistributableTask.kt
  34. 6
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractSuggestModulesTask.kt
  35. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractUploadAppForNotarizationTask.kt
  36. 1
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/preview/internal/configurePreview.kt
  37. 6
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/preview/tasks/AbstractConfigureDesktopPreviewTask.kt
  38. 14
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/tasks/AbstractComposeDesktopTask.kt
  39. 5
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/tasks/AbstractUnpackDefaultComposeApplicationResourcesTask.kt
  40. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/internal/SimctlUtils.kt
  41. 4
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/internal/configureExperimentalUikitApplication.kt
  42. 4
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/internal/configureInstallIosDeployTask.kt
  43. 4
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/internal/configureInstallXcodeGenTask.kt
  44. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/internal/configurePackComposeUiKitApplicationForXCodeTask.kt
  45. 6
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/internal/registerConnectedDeviceTasks.kt
  46. 6
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/internal/registerSimulatorTasks.kt
  47. 6
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/tasks/AbstractComposeIosTask.kt
  48. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/web/internal/configureExperimentalWebApplication.kt
  49. 11
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/web/tasks/ExperimentalUnpackSkikoWasmRuntimeTask.kt
  50. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/diagnosticUtils.kt
  51. 58
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/fileUtils.kt
  52. 23
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/gradleUtils.kt
  53. 4
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/osUtils.kt
  54. 31
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/providerUtils.kt
  55. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/stringUtils.kt
  56. 22
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/taskUtils.kt
  57. 8
      gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/DesktopApplicationTest.kt
  58. 4
      gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/unit/FileHashTest.kt

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposeExtension.kt

@ -10,7 +10,7 @@ import org.gradle.api.model.ObjectFactory
import org.gradle.api.plugins.ExtensionAware
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import org.jetbrains.compose.desktop.application.internal.nullableProperty
import org.jetbrains.compose.internal.utils.nullableProperty
import javax.inject.Inject
abstract class ComposeExtension @Inject constructor(

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt

@ -20,11 +20,11 @@ import org.gradle.api.plugins.ExtensionAware
import org.jetbrains.compose.android.AndroidExtension
import org.jetbrains.compose.desktop.DesktopExtension
import org.jetbrains.compose.desktop.application.internal.configureDesktop
import org.jetbrains.compose.desktop.application.internal.currentTarget
import org.jetbrains.compose.desktop.preview.internal.initializePreview
import org.jetbrains.compose.experimental.dsl.ExperimentalExtension
import org.jetbrains.compose.experimental.internal.checkExperimentalTargetsWithSkikoIsEnabled
import org.jetbrains.compose.experimental.internal.configureExperimental
import org.jetbrains.compose.internal.utils.currentTarget
import org.jetbrains.compose.web.WebExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/JvmApplicationBuildTypes.kt

@ -7,7 +7,7 @@ package org.jetbrains.compose.desktop.application.dsl
import org.gradle.api.Action
import org.gradle.api.model.ObjectFactory
import org.jetbrains.compose.desktop.application.internal.new
import org.jetbrains.compose.internal.utils.new
import javax.inject.Inject
abstract class JvmApplicationBuildTypes @Inject constructor(

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/MacOSNotarizationSettings.kt

@ -11,7 +11,7 @@ import org.gradle.api.provider.ProviderFactory
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Optional
import org.jetbrains.compose.desktop.application.internal.ComposeProperties
import org.jetbrains.compose.desktop.application.internal.nullableProperty
import org.jetbrains.compose.internal.utils.nullableProperty
import javax.inject.Inject
abstract class MacOSNotarizationSettings {

4
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/MacOSSigningSettings.kt

@ -11,8 +11,8 @@ import org.gradle.api.provider.ProviderFactory
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Optional
import org.jetbrains.compose.desktop.application.internal.ComposeProperties
import org.jetbrains.compose.desktop.application.internal.notNullProperty
import org.jetbrains.compose.desktop.application.internal.nullableProperty
import org.jetbrains.compose.internal.utils.notNullProperty
import org.jetbrains.compose.internal.utils.nullableProperty
import javax.inject.Inject
abstract class MacOSSigningSettings {

4
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/ProguardSettings.kt

@ -8,8 +8,8 @@ package org.jetbrains.compose.desktop.application.dsl
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Property
import org.jetbrains.compose.desktop.application.internal.notNullProperty
import org.jetbrains.compose.desktop.application.internal.nullableProperty
import org.jetbrains.compose.internal.utils.notNullProperty
import org.jetbrains.compose.internal.utils.nullableProperty
import javax.inject.Inject
private const val DEFAULT_PROGUARD_VERSION = "7.2.2"

4
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/TargetFormat.kt

@ -5,8 +5,8 @@
package org.jetbrains.compose.desktop.application.dsl
import org.jetbrains.compose.desktop.application.internal.OS
import org.jetbrains.compose.desktop.application.internal.currentOS
import org.jetbrains.compose.internal.utils.OS
import org.jetbrains.compose.internal.utils.currentOS
enum class TargetFormat(
internal val id: String,

1
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/ExternalToolRunner.kt

@ -10,6 +10,7 @@ import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
import org.gradle.process.ExecOperations
import org.gradle.process.ExecResult
import org.jetbrains.compose.internal.utils.ioFile
import java.io.File
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/JvmApplicationContext.kt

@ -13,7 +13,7 @@ import org.jetbrains.compose.desktop.application.dsl.JvmApplicationBuildType
import org.jetbrains.compose.internal.KOTLIN_JVM_PLUGIN_ID
import org.jetbrains.compose.internal.KOTLIN_MPP_PLUGIN_ID
import org.jetbrains.compose.internal.javaSourceSets
import org.jetbrains.compose.internal.joinDashLowercaseNonEmpty
import org.jetbrains.compose.internal.utils.joinDashLowercaseNonEmpty
import org.jetbrains.compose.internal.mppExt
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType

1
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/JvmApplicationData.kt

@ -12,6 +12,7 @@ import org.gradle.api.provider.Provider
import org.gradle.api.provider.ProviderFactory
import org.jetbrains.compose.desktop.application.dsl.JvmApplicationDistributions
import org.jetbrains.compose.desktop.application.dsl.JvmApplicationBuildTypes
import org.jetbrains.compose.internal.utils.new
import javax.inject.Inject
internal open class JvmApplicationData @Inject constructor(

1
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/JvmApplicationInternal.kt

@ -13,6 +13,7 @@ import org.gradle.api.tasks.SourceSet
import org.jetbrains.compose.desktop.application.dsl.JvmApplication
import org.jetbrains.compose.desktop.application.dsl.JvmApplicationDistributions
import org.jetbrains.compose.desktop.application.dsl.JvmApplicationBuildTypes
import org.jetbrains.compose.internal.utils.new
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
import javax.inject.Inject

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/JvmTasks.kt

@ -9,7 +9,7 @@ import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.tasks.TaskProvider
import org.jetbrains.compose.desktop.application.dsl.JvmApplicationBuildType
import org.jetbrains.compose.internal.uppercaseFirstChar
import org.jetbrains.compose.internal.utils.uppercaseFirstChar
internal class JvmTasks(
private val project: Project,

1
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/MacSigner.kt

@ -6,6 +6,7 @@
package org.jetbrains.compose.desktop.application.internal
import org.jetbrains.compose.desktop.application.internal.validation.ValidatedMacOSSigningSettings
import org.jetbrains.compose.internal.utils.MacUtils
import java.io.File
import java.nio.file.Files
import java.util.regex.Pattern

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/configureDesktop.kt

@ -8,7 +8,7 @@ package org.jetbrains.compose.desktop.application.internal
import org.gradle.api.Project
import org.jetbrains.compose.desktop.DesktopExtension
import org.jetbrains.compose.desktop.tasks.AbstractUnpackDefaultComposeApplicationResourcesTask
import org.jetbrains.compose.internal.registerTask
import org.jetbrains.compose.internal.utils.registerTask
internal fun configureDesktop(project: Project, desktopExtension: DesktopExtension) {
if (desktopExtension._isJvmApplicationInitialized) {

8
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/configureJvmApplication.kt

@ -17,6 +17,14 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.compose.desktop.application.internal.validation.validatePackageVersions
import org.jetbrains.compose.desktop.application.tasks.*
import org.jetbrains.compose.desktop.tasks.AbstractUnpackDefaultComposeApplicationResourcesTask
import org.jetbrains.compose.internal.utils.OS
import org.jetbrains.compose.internal.utils.currentOS
import org.jetbrains.compose.internal.utils.currentTarget
import org.jetbrains.compose.internal.utils.dir
import org.jetbrains.compose.internal.utils.ioFile
import org.jetbrains.compose.internal.utils.ioFileOrNull
import org.jetbrains.compose.internal.utils.javaExecutable
import org.jetbrains.compose.internal.utils.provider
import java.io.File
private val defaultJvmArgs = listOf("-D$CONFIGURE_SWING_GLOBALS=true")

4
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/configureNativeApplication.kt

@ -15,7 +15,9 @@ import org.jetbrains.compose.desktop.application.tasks.AbstractNativeMacApplicat
import org.jetbrains.compose.desktop.application.tasks.AbstractNativeMacApplicationPackageDmgTask
import org.jetbrains.compose.desktop.application.tasks.AbstractNativeMacApplicationPackageTask
import org.jetbrains.compose.desktop.tasks.AbstractUnpackDefaultComposeApplicationResourcesTask
import org.jetbrains.compose.internal.joinLowerCamelCase
import org.jetbrains.compose.internal.utils.OS
import org.jetbrains.compose.internal.utils.currentOS
import org.jetbrains.compose.internal.utils.joinLowerCamelCase
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBinary
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeOutputKind

1
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/dirLayoutUtils.kt

@ -10,6 +10,7 @@ import org.gradle.api.Task
import org.gradle.api.file.Directory
import org.gradle.api.file.ProjectLayout
import org.gradle.api.provider.Provider
import org.jetbrains.compose.internal.utils.dir
internal val Project.jvmDirs: JvmDirectoriesProvider
get() = JvmDirectoriesProvider(project.layout)

4
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/files/fileUtils.kt

@ -7,8 +7,8 @@ package org.jetbrains.compose.desktop.application.internal.files
import org.gradle.api.tasks.Internal
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.compose.desktop.application.internal.OS
import org.jetbrains.compose.desktop.application.internal.currentOS
import org.jetbrains.compose.internal.utils.OS
import org.jetbrains.compose.internal.utils.currentOS
import java.io.*
import java.security.DigestInputStream
import java.security.MessageDigest

1
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/packageVersions.kt

@ -8,6 +8,7 @@ package org.jetbrains.compose.desktop.application.internal
import org.gradle.api.provider.Provider
import org.jetbrains.compose.desktop.application.dsl.JvmApplicationDistributions
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.compose.internal.utils.OS
internal fun JvmApplicationContext.packageVersionFor(
targetFormat: TargetFormat

4
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/validation/ValidatedMacOSSigningSettings.kt

@ -9,8 +9,8 @@ import org.gradle.api.Project
import org.gradle.api.provider.Provider
import org.jetbrains.compose.desktop.application.dsl.MacOSSigningSettings
import org.jetbrains.compose.desktop.application.internal.ComposeProperties
import org.jetbrains.compose.desktop.application.internal.OS
import org.jetbrains.compose.desktop.application.internal.currentOS
import org.jetbrains.compose.internal.utils.OS
import org.jetbrains.compose.internal.utils.currentOS
import java.io.File
internal data class ValidatedMacOSSigningSettings(

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/validation/validatePackageVersions.kt

@ -8,7 +8,7 @@ package org.jetbrains.compose.desktop.application.internal.validation
import org.gradle.api.GradleException
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.compose.desktop.application.internal.JvmApplicationContext
import org.jetbrains.compose.desktop.application.internal.OS
import org.jetbrains.compose.internal.utils.OS
import org.jetbrains.compose.desktop.application.internal.packageBuildVersionFor
import org.jetbrains.compose.desktop.application.internal.packageVersionFor

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/wixToolset.kt

@ -9,6 +9,8 @@ import de.undercouch.gradle.tasks.download.Download
import org.gradle.api.Project
import org.gradle.api.tasks.Copy
import org.jetbrains.compose.desktop.application.tasks.AbstractJPackageTask
import org.jetbrains.compose.internal.utils.OS
import org.jetbrains.compose.internal.utils.currentOS
import java.io.File
internal const val DOWNLOAD_WIX_TOOLSET_TASK_NAME = "downloadWix"

10
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractCheckNativeDistributionRuntime.kt

@ -7,16 +7,16 @@ package org.jetbrains.compose.desktop.application.tasks
import org.gradle.api.file.Directory
import org.gradle.api.file.RegularFile
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.*
import org.jetbrains.compose.desktop.application.internal.JvmRuntimeProperties
import org.jetbrains.compose.desktop.application.internal.executableName
import org.jetbrains.compose.desktop.application.internal.ioFile
import org.jetbrains.compose.desktop.application.internal.notNullProperty
import org.jetbrains.compose.internal.utils.executableName
import org.jetbrains.compose.internal.utils.ioFile
import org.jetbrains.compose.internal.utils.notNullProperty
import org.jetbrains.compose.desktop.application.internal.ExternalToolRunner
import org.jetbrains.compose.desktop.tasks.AbstractComposeDesktopTask
import org.jetbrains.compose.internal.utils.clearDirs
import java.io.File
// __COMPOSE_NATIVE_DISTRIBUTIONS_MIN_JAVA_VERSION__
@ -88,7 +88,7 @@ abstract class AbstractCheckNativeDistributionRuntime : AbstractComposeDesktopTa
}
private fun getJavaRuntimeVersionUnsafe(): String? {
cleanDirs(workingDir)
fileOperations.clearDirs(workingDir)
val workingDir = workingDir.ioFile
val printJavaRuntimeClassName = "PrintJavaRuntimeVersion"

4
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractCheckNotarizationStatusTask.kt

@ -8,10 +8,10 @@ package org.jetbrains.compose.desktop.application.tasks
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.tasks.*
import org.jetbrains.compose.desktop.application.internal.ExternalToolRunner
import org.jetbrains.compose.desktop.application.internal.MacUtils
import org.jetbrains.compose.internal.utils.MacUtils
import org.jetbrains.compose.desktop.application.internal.NOTARIZATION_REQUEST_INFO_FILE_NAME
import org.jetbrains.compose.desktop.application.internal.NotarizationRequestInfo
import org.jetbrains.compose.desktop.application.internal.ioFile
import org.jetbrains.compose.internal.utils.ioFile
abstract class AbstractCheckNotarizationStatusTask : AbstractNotarizationTask() {
@get:Internal

6
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractJLinkTask.kt

@ -14,9 +14,9 @@ import org.gradle.api.tasks.Optional
import org.jetbrains.compose.desktop.application.internal.RuntimeCompressionLevel
import org.jetbrains.compose.desktop.application.internal.JvmRuntimeProperties
import org.jetbrains.compose.desktop.application.internal.cliArg
import org.jetbrains.compose.desktop.application.internal.ioFile
import org.jetbrains.compose.desktop.application.internal.notNullProperty
import org.jetbrains.compose.desktop.application.internal.nullableProperty
import org.jetbrains.compose.internal.utils.ioFile
import org.jetbrains.compose.internal.utils.notNullProperty
import org.jetbrains.compose.internal.utils.nullableProperty
import java.io.File
// todo: public DSL

19
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractJPackageTask.kt

@ -6,7 +6,6 @@
package org.jetbrains.compose.desktop.application.tasks
import org.gradle.api.file.*
import org.gradle.api.internal.file.FileOperations
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
@ -22,6 +21,7 @@ import org.jetbrains.compose.desktop.application.internal.files.*
import org.jetbrains.compose.desktop.application.internal.files.MacJarSignFileCopyingProcessor
import org.jetbrains.compose.desktop.application.internal.JvmRuntimeProperties
import org.jetbrains.compose.desktop.application.internal.validation.validate
import org.jetbrains.compose.internal.utils.*
import java.io.*
import java.util.*
import javax.inject.Inject
@ -408,8 +408,7 @@ abstract class AbstractJPackageTask @Inject constructor(
outdatedLibs.addAll(files.files)
logger.debug("Clearing all files in working dir: $libsDirFile")
fileOperations.delete(libsDirFile)
libsDirFile.mkdirs()
fileOperations.clearDirs(libsDirFile)
}
if (inputChanges.isIncremental) {
@ -440,8 +439,7 @@ abstract class AbstractJPackageTask @Inject constructor(
val fileProcessor =
macSigner?.let { signer ->
val tmpDirForSign = signDir.ioFile
fileOperations.delete(tmpDirForSign)
tmpDirForSign.mkdirs()
fileOperations.clearDirs(tmpDirForSign)
MacJarSignFileCopyingProcessor(
signer,
@ -473,7 +471,7 @@ abstract class AbstractJPackageTask @Inject constructor(
}
// todo: incremental copy
cleanDirs(packagedResourcesDir)
fileOperations.clearDirs(packagedResourcesDir)
val destResourcesDir = packagedResourcesDir.ioFile
val appResourcesDir = appResourcesDir.ioFileOrNull
if (appResourcesDir != null) {
@ -481,14 +479,14 @@ abstract class AbstractJPackageTask @Inject constructor(
val relPath = file.relativeTo(appResourcesDir).path
val destFile = destResourcesDir.resolve(relPath)
if (file.isDirectory) {
fileOperations.mkdir(destFile)
fileOperations.mkdirs(destFile)
} else {
file.copyTo(destFile)
}
}
}
cleanDirs(jpackageResources)
fileOperations.clearDirs(jpackageResources)
if (currentOS == OS.MacOS) {
InfoPlistBuilder(macExtraPlistKeysRawXml.orNull)
.also { setInfoPlistValues(it) }
@ -642,7 +640,7 @@ private fun isSkikoForCurrentOS(lib: File): Boolean =
lib.name.startsWith("skiko-awt-runtime-${currentOS.id}-${currentArch.id}")
&& lib.name.endsWith(".jar")
private fun unpackSkikoForCurrentOS(sourceJar: File, skikoDir: File, fileOperations: FileOperations): List<File> {
private fun unpackSkikoForCurrentOS(sourceJar: File, skikoDir: File, fileOperations: FileSystemOperations): List<File> {
val entriesToUnpack = when (currentOS) {
OS.MacOS -> setOf("libskiko-macos-${currentArch.id}.dylib")
OS.Windows -> setOf("skiko-windows-${currentArch.id}.dll", "icudtl.dat")
@ -654,8 +652,7 @@ private fun unpackSkikoForCurrentOS(sourceJar: File, skikoDir: File, fileOperati
val targetJar = skikoDir.resolve(sourceJar.name)
outputFiles.add(targetJar)
fileOperations.delete(skikoDir)
fileOperations.mkdir(skikoDir)
fileOperations.clearDirs(skikoDir)
transformJar(sourceJar, targetJar) { entry, zin, zout ->
// check both entry or entry.sha256
if (entry.name.removeSuffix(".sha256") in entriesToUnpack) {

6
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractJvmToolOperationTask.kt

@ -14,10 +14,8 @@ import org.gradle.api.tasks.*
import org.gradle.process.ExecResult
import org.gradle.work.InputChanges
import org.jetbrains.compose.desktop.application.internal.ComposeProperties
import org.jetbrains.compose.desktop.application.internal.ioFile
import org.jetbrains.compose.desktop.application.internal.jvmToolFile
import org.jetbrains.compose.desktop.application.internal.notNullProperty
import org.jetbrains.compose.desktop.tasks.AbstractComposeDesktopTask
import org.jetbrains.compose.internal.utils.*
import java.io.File
abstract class AbstractJvmToolOperationTask(private val toolName: String) : AbstractComposeDesktopTask() {
@ -37,7 +35,7 @@ abstract class AbstractJvmToolOperationTask(private val toolName: String) : Abst
}
protected open fun prepareWorkingDir(inputChanges: InputChanges) {
cleanDirs(workingDir)
fileOperations.clearDirs(workingDir)
}
protected open fun makeArgs(tmpDir: File): MutableList<String> = arrayListOf<String>().apply {

6
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractNativeMacApplicationPackageAppDirTask.kt

@ -11,9 +11,9 @@ import org.gradle.api.tasks.*
import org.gradle.api.tasks.Optional
import org.jetbrains.compose.desktop.application.internal.InfoPlistBuilder
import org.jetbrains.compose.desktop.application.internal.PlistKeys
import org.jetbrains.compose.desktop.application.internal.ioFile
import org.jetbrains.compose.desktop.application.internal.notNullProperty
import org.jetbrains.compose.desktop.application.internal.nullableProperty
import org.jetbrains.compose.internal.utils.ioFile
import org.jetbrains.compose.internal.utils.notNullProperty
import org.jetbrains.compose.internal.utils.nullableProperty
import java.io.File
private const val KOTLIN_NATIVE_MIN_SUPPORTED_MAC_OS = "10.13"

4
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractNativeMacApplicationPackageDmgTask.kt

@ -9,8 +9,8 @@ import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.*
import org.jetbrains.compose.desktop.application.internal.ioFile
import org.jetbrains.compose.desktop.application.internal.notNullProperty
import org.jetbrains.compose.internal.utils.ioFile
import org.jetbrains.compose.internal.utils.notNullProperty
import java.io.File
abstract class AbstractNativeMacApplicationPackageDmgTask : AbstractNativeMacApplicationPackageTask() {

5
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractNativeMacApplicationPackageTask.kt

@ -10,9 +10,8 @@ import org.gradle.api.file.DirectoryProperty
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.*
import org.jetbrains.compose.desktop.application.internal.ioFile
import org.jetbrains.compose.desktop.application.internal.notNullProperty
import org.jetbrains.compose.desktop.tasks.AbstractComposeDesktopTask
import org.jetbrains.compose.internal.utils.*
import java.io.File
abstract class AbstractNativeMacApplicationPackageTask : AbstractComposeDesktopTask() {
@ -34,7 +33,7 @@ abstract class AbstractNativeMacApplicationPackageTask : AbstractComposeDesktopT
@TaskAction
fun run() {
cleanDirs(destinationDir, workingDir)
fileOperations.clearDirs(destinationDir, workingDir)
createPackage(
destinationDir = destinationDir.ioFile,

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractNotarizationTask.kt

@ -10,7 +10,7 @@ import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Nested
import org.gradle.api.tasks.Optional
import org.jetbrains.compose.desktop.application.dsl.MacOSNotarizationSettings
import org.jetbrains.compose.desktop.application.internal.nullableProperty
import org.jetbrains.compose.internal.utils.nullableProperty
import org.jetbrains.compose.desktop.application.internal.validation.validate
import org.jetbrains.compose.desktop.tasks.AbstractComposeDesktopTask

6
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractProguardTask.kt

@ -15,12 +15,10 @@ import org.gradle.api.provider.Provider
import org.gradle.api.tasks.*
import org.gradle.api.tasks.Optional
import org.jetbrains.compose.desktop.application.internal.*
import org.jetbrains.compose.desktop.application.internal.ioFile
import org.jetbrains.compose.desktop.application.internal.files.mangledName
import org.jetbrains.compose.desktop.application.internal.files.normalizedPath
import org.jetbrains.compose.desktop.application.internal.notNullProperty
import org.jetbrains.compose.desktop.application.internal.nullableProperty
import org.jetbrains.compose.desktop.tasks.AbstractComposeDesktopTask
import org.jetbrains.compose.internal.utils.*
import java.io.File
import java.io.Writer
import kotlin.collections.LinkedHashMap
@ -80,7 +78,7 @@ abstract class AbstractProguardTask : AbstractComposeDesktopTask() {
project.dependencies.create("com.guardsquare:proguard-gradle:${proguardVersion.get()}")
).files
cleanDirs(destinationDir, workingDir)
fileOperations.clearDirs(destinationDir, workingDir)
val destinationDir = destinationDir.ioFile.absoluteFile
// todo: can be cached for a jdk

8
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractRunDistributableTask.kt

@ -11,10 +11,10 @@ import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.TaskProvider
import org.jetbrains.compose.desktop.application.internal.OS
import org.jetbrains.compose.desktop.application.internal.currentOS
import org.jetbrains.compose.desktop.application.internal.executableName
import org.jetbrains.compose.desktop.application.internal.ioFile
import org.jetbrains.compose.internal.utils.OS
import org.jetbrains.compose.internal.utils.currentOS
import org.jetbrains.compose.internal.utils.executableName
import org.jetbrains.compose.internal.utils.ioFile
import org.jetbrains.compose.desktop.tasks.AbstractComposeDesktopTask
import javax.inject.Inject

6
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractSuggestModulesTask.kt

@ -14,12 +14,10 @@ import org.gradle.api.provider.Provider
import org.gradle.api.tasks.*
import org.jetbrains.compose.desktop.application.dsl.DEFAULT_RUNTIME_MODULES
import org.jetbrains.compose.desktop.application.internal.ComposeProperties
import org.jetbrains.compose.desktop.application.internal.ioFile
import org.jetbrains.compose.desktop.application.internal.ExternalToolRunner
import org.jetbrains.compose.desktop.application.internal.jvmToolFile
import org.jetbrains.compose.desktop.application.internal.files.normalizedPath
import org.jetbrains.compose.desktop.application.internal.notNullProperty
import org.jetbrains.compose.desktop.tasks.AbstractComposeDesktopTask
import org.jetbrains.compose.internal.utils.*
abstract class AbstractSuggestModulesTask : AbstractComposeDesktopTask() {
@get:Input
@ -47,7 +45,7 @@ abstract class AbstractSuggestModulesTask : AbstractComposeDesktopTask() {
fun run() {
val jtool = jvmToolFile("jdeps", javaHome = javaHome)
cleanDirs(workingDir)
fileOperations.clearDirs(workingDir)
val args = arrayListOf<String>().apply {
add("--print-module-deps")
add("--ignore-missing-deps")

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractUploadAppForNotarizationTask.kt

@ -11,6 +11,8 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.compose.desktop.application.internal.*
import org.jetbrains.compose.desktop.application.internal.files.checkExistingFile
import org.jetbrains.compose.desktop.application.internal.files.findOutputFileOrDir
import org.jetbrains.compose.internal.utils.MacUtils
import org.jetbrains.compose.internal.utils.ioFile
import java.io.File
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

1
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/preview/internal/configurePreview.kt

@ -5,6 +5,7 @@ import org.jetbrains.compose.desktop.DesktopExtension
import org.jetbrains.compose.desktop.application.internal.JvmApplicationRuntimeFilesProvider
import org.jetbrains.compose.desktop.preview.tasks.AbstractConfigureDesktopPreviewTask
import org.jetbrains.compose.internal.*
import org.jetbrains.compose.internal.utils.uppercaseFirstChar
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget

6
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/preview/tasks/AbstractConfigureDesktopPreviewTask.kt

@ -7,9 +7,9 @@ import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.*
import org.jetbrains.compose.ComposeBuildConfig
import org.jetbrains.compose.desktop.application.internal.currentTarget
import org.jetbrains.compose.desktop.application.internal.javaExecutable
import org.jetbrains.compose.desktop.application.internal.notNullProperty
import org.jetbrains.compose.internal.utils.currentTarget
import org.jetbrains.compose.internal.utils.javaExecutable
import org.jetbrains.compose.internal.utils.notNullProperty
import org.jetbrains.compose.desktop.tasks.AbstractComposeDesktopTask
import org.jetbrains.compose.desktop.ui.tooling.preview.rpc.*
import java.io.File

14
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/tasks/AbstractComposeDesktopTask.kt

@ -8,7 +8,7 @@ package org.jetbrains.compose.desktop.tasks
import org.gradle.api.DefaultTask
import org.gradle.api.file.Directory
import org.gradle.api.file.FileSystemLocation
import org.gradle.api.internal.file.FileOperations
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
@ -18,7 +18,8 @@ import org.gradle.api.tasks.LocalState
import org.gradle.process.ExecOperations
import org.jetbrains.compose.desktop.application.internal.ComposeProperties
import org.jetbrains.compose.desktop.application.internal.ExternalToolRunner
import org.jetbrains.compose.desktop.application.internal.notNullProperty
import org.jetbrains.compose.internal.utils.clearDirs
import org.jetbrains.compose.internal.utils.notNullProperty
import javax.inject.Inject
abstract class AbstractComposeDesktopTask : DefaultTask() {
@ -32,7 +33,7 @@ abstract class AbstractComposeDesktopTask : DefaultTask() {
protected abstract val execOperations: ExecOperations
@get:Inject
protected abstract val fileOperations: FileOperations
protected abstract val fileOperations: FileSystemOperations
@get:LocalState
protected val logsDir: Provider<Directory> = project.layout.buildDirectory.dir("compose/logs/$name")
@ -47,11 +48,4 @@ abstract class AbstractComposeDesktopTask : DefaultTask() {
@get:Internal
internal val runExternalTool: ExternalToolRunner
get() = ExternalToolRunner(verbose, logsDir, execOperations)
protected fun cleanDirs(vararg dirs: Provider<out FileSystemLocation>) {
for (dir in dirs) {
fileOperations.delete(dir)
fileOperations.mkdir(dir)
}
}
}

5
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/tasks/AbstractUnpackDefaultComposeApplicationResourcesTask.kt

@ -13,7 +13,8 @@ import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
import org.jetbrains.compose.ComposeBuildConfig
import org.jetbrains.compose.desktop.application.internal.ioFile
import org.jetbrains.compose.internal.utils.clearDirs
import org.jetbrains.compose.internal.utils.ioFile
private const val DEFAULT_COMPOSE_PROGUARD_RULES_FILE_NAME = "default-compose-desktop-rules.pro"
@ -35,7 +36,7 @@ abstract class AbstractUnpackDefaultComposeApplicationResourcesTask : AbstractCo
@TaskAction
fun run() {
cleanDirs(destinationDir)
fileOperations.clearDirs(destinationDir)
unpack(iconSourcePath("mac", "icns"), resources.macIcon)
unpack(iconSourcePath("windows", "ico"), resources.windowsIcon)

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/internal/SimctlUtils.kt

@ -6,7 +6,7 @@
package org.jetbrains.compose.experimental.uikit.internal
import kotlinx.serialization.json.Json
import org.jetbrains.compose.desktop.application.internal.MacUtils
import org.jetbrains.compose.internal.utils.MacUtils
import org.jetbrains.compose.experimental.uikit.tasks.AbstractComposeIosTask
val json = Json {

4
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/internal/configureExperimentalUikitApplication.kt

@ -6,8 +6,8 @@
package org.jetbrains.compose.experimental.uikit.internal
import org.gradle.api.Project
import org.jetbrains.compose.desktop.application.internal.OS
import org.jetbrains.compose.desktop.application.internal.currentOS
import org.jetbrains.compose.internal.utils.OS
import org.jetbrains.compose.internal.utils.currentOS
import org.jetbrains.compose.experimental.dsl.ExperimentalUiKitApplication
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension

4
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/internal/configureInstallIosDeployTask.kt

@ -6,8 +6,8 @@
package org.jetbrains.compose.experimental.uikit.internal
import org.gradle.api.Project
import org.jetbrains.compose.desktop.application.internal.MacUtils
import org.jetbrains.compose.desktop.application.internal.UnixUtils
import org.jetbrains.compose.internal.utils.MacUtils
import org.jetbrains.compose.internal.utils.UnixUtils
import org.jetbrains.compose.experimental.uikit.tasks.AbstractComposeIosTask
internal val Project.iosDeployExecutable get() = iosDeploySrc.resolve("build/Release/ios-deploy")

4
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/internal/configureInstallXcodeGenTask.kt

@ -6,8 +6,8 @@
package org.jetbrains.compose.experimental.uikit.internal
import org.gradle.api.Project
import org.jetbrains.compose.desktop.application.internal.MacUtils
import org.jetbrains.compose.desktop.application.internal.UnixUtils
import org.jetbrains.compose.internal.utils.MacUtils
import org.jetbrains.compose.internal.utils.UnixUtils
import org.jetbrains.compose.experimental.uikit.tasks.AbstractComposeIosTask
internal val Project.xcodeGenExecutable get() = xcodeGenSrc.resolve(".build/apple/Products/Release/xcodegen")

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/internal/configurePackComposeUiKitApplicationForXCodeTask.kt

@ -7,7 +7,7 @@ package org.jetbrains.compose.experimental.uikit.internal
import org.gradle.api.Project
import org.jetbrains.compose.experimental.uikit.tasks.ExperimentalPackComposeApplicationForXCodeTask
import org.jetbrains.compose.internal.fileToDir
import org.jetbrains.compose.internal.utils.fileToDir
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType

6
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/internal/registerConnectedDeviceTasks.kt

@ -7,13 +7,13 @@ package org.jetbrains.compose.experimental.uikit.internal
import org.gradle.api.Project
import org.gradle.api.tasks.TaskProvider
import org.jetbrains.compose.desktop.application.internal.MacUtils
import org.jetbrains.compose.internal.utils.MacUtils
import org.jetbrains.compose.experimental.dsl.DeployTarget
import org.jetbrains.compose.experimental.dsl.UiKitConfiguration
import org.jetbrains.compose.experimental.uikit.tasks.AbstractComposeIosTask
import org.jetbrains.compose.experimental.uikit.tasks.ExperimentalPackComposeApplicationForXCodeTask
import org.jetbrains.compose.internal.getLocalProperty
import org.jetbrains.compose.internal.localPropertiesFile
import org.jetbrains.compose.internal.utils.getLocalProperty
import org.jetbrains.compose.internal.utils.localPropertiesFile
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
fun Project.registerConnectedDeviceTasks(

6
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/internal/registerSimulatorTasks.kt

@ -7,9 +7,9 @@ package org.jetbrains.compose.experimental.uikit.internal
import org.gradle.api.Project
import org.gradle.api.tasks.TaskProvider
import org.jetbrains.compose.desktop.application.internal.Arch
import org.jetbrains.compose.desktop.application.internal.MacUtils
import org.jetbrains.compose.desktop.application.internal.currentArch
import org.jetbrains.compose.internal.utils.Arch
import org.jetbrains.compose.internal.utils.MacUtils
import org.jetbrains.compose.internal.utils.currentArch
import org.jetbrains.compose.experimental.dsl.DeployTarget
import org.jetbrains.compose.experimental.dsl.UiKitConfiguration
import org.jetbrains.compose.experimental.uikit.tasks.AbstractComposeIosTask

6
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/uikit/tasks/AbstractComposeIosTask.kt

@ -7,7 +7,7 @@ package org.jetbrains.compose.experimental.uikit.tasks
import org.gradle.api.DefaultTask
import org.gradle.api.file.Directory
import org.gradle.api.internal.file.FileOperations
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
@ -17,7 +17,7 @@ import org.gradle.api.tasks.LocalState
import org.gradle.process.ExecOperations
import org.jetbrains.compose.desktop.application.internal.ComposeProperties
import org.jetbrains.compose.desktop.application.internal.ExternalToolRunner
import org.jetbrains.compose.desktop.application.internal.notNullProperty
import org.jetbrains.compose.internal.utils.notNullProperty
import javax.inject.Inject
abstract class AbstractComposeIosTask : DefaultTask() {
@ -31,7 +31,7 @@ abstract class AbstractComposeIosTask : DefaultTask() {
protected abstract val execOperations: ExecOperations
@get:Inject
protected abstract val fileOperations: FileOperations
protected abstract val fileOperations: FileSystemOperations
@get:LocalState
protected val logsDir: Provider<Directory> = project.layout.buildDirectory.dir("compose/logs/$name")

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/web/internal/configureExperimentalWebApplication.kt

@ -6,7 +6,7 @@
package org.jetbrains.compose.experimental.web.internal
import org.jetbrains.compose.experimental.dsl.ExperimentalWebApplication
import org.jetbrains.compose.internal.registerTask
import org.jetbrains.compose.internal.utils.registerTask
import org.jetbrains.compose.experimental.web.tasks.ExperimentalUnpackSkikoWasmRuntimeTask
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrTarget

11
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/experimental/web/tasks/ExperimentalUnpackSkikoWasmRuntimeTask.kt

@ -9,10 +9,13 @@ import org.gradle.api.DefaultTask
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.component.ModuleComponentIdentifier
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
import org.jetbrains.compose.internal.debug
import org.jetbrains.compose.internal.utils.clearDirs
import org.jetbrains.compose.internal.utils.debug
import javax.inject.Inject
abstract class ExperimentalUnpackSkikoWasmRuntimeTask : DefaultTask() {
@get:InputFiles
@ -21,10 +24,12 @@ abstract class ExperimentalUnpackSkikoWasmRuntimeTask : DefaultTask() {
@get:OutputDirectory
abstract val outputDir: DirectoryProperty
@get:Inject
internal abstract val fileOperations: FileSystemOperations
@TaskAction
fun run() {
project.delete(outputDir)
project.mkdir(outputDir)
fileOperations.clearDirs(outputDir)
val runtimeArtifacts = runtimeClasspath.resolvedConfiguration.resolvedArtifacts
for (artifact in runtimeArtifacts) {
logger.debug { "Checking artifact: id=${artifact.id}, file=${artifact.file}" }

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/diagnosticUtils.kt → gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/diagnosticUtils.kt

@ -3,7 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
*/
package org.jetbrains.compose.desktop.application.internal
package org.jetbrains.compose.internal.utils
import java.io.PrintWriter
import java.io.StringWriter

58
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/fileUtils.kt

@ -0,0 +1,58 @@
/*
* Copyright 2020-2023 JetBrains s.r.o. and respective authors and developers.
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
*/
package org.jetbrains.compose.internal.utils
import org.gradle.api.Project
import org.gradle.api.file.Directory
import org.gradle.api.file.FileSystemLocation
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.file.RegularFile
import org.gradle.api.provider.Provider
import java.io.File
internal fun Provider<String>.toDir(project: Project): Provider<Directory> =
project.layout.dir(map { File(it) })
internal fun Provider<File>.fileToDir(project: Project): Provider<Directory> =
project.layout.dir(this)
internal fun Provider<Directory>.file(relativePath: String): Provider<RegularFile> =
map { it.file(relativePath) }
internal fun Provider<Directory>.dir(relativePath: String): Provider<Directory> =
map { it.dir(relativePath) }
internal val <T : FileSystemLocation> Provider<T>.ioFile: File
get() = get().asFile
internal val <T : FileSystemLocation> Provider<T>.ioFileOrNull: File?
get() = orNull?.asFile
internal fun FileSystemOperations.delete(vararg files: Any) {
delete { it.delete(*files) }
}
internal fun FileSystemOperations.mkdirs(vararg dirs: File) {
for (dir in dirs) {
dir.mkdirs()
}
}
internal fun FileSystemOperations.mkdirs(vararg dirs: Provider<out FileSystemLocation>) {
mkdirs(*dirs.ioFiles())
}
internal fun FileSystemOperations.clearDirs(vararg dirs: File) {
delete(*dirs)
mkdirs(*dirs)
}
internal fun FileSystemOperations.clearDirs(vararg dirs: Provider<out FileSystemLocation>) {
clearDirs(*dirs.ioFiles())
}
private fun Array<out Provider<out FileSystemLocation>>.ioFiles(): Array<File> =
let { providers -> Array(size) { i -> providers[i].ioFile } }

23
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/gradleUtils.kt → gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/gradleUtils.kt

@ -1,17 +1,12 @@
/*
* Copyright 2020-2021 JetBrains s.r.o. and respective authors and developers.
* Copyright 2020-2023 JetBrains s.r.o. and respective authors and developers.
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
*/
package org.jetbrains.compose.internal
package org.jetbrains.compose.internal.utils
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.file.Directory
import org.gradle.api.logging.Logger
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.TaskProvider
import java.io.File
import java.util.*
internal inline fun Logger.info(fn: () -> String) {
@ -26,20 +21,6 @@ internal inline fun Logger.debug(fn: () -> String) {
}
}
internal inline fun <reified T : Task> Project.registerTask(
name: String,
crossinline fn: T.() -> Unit
): TaskProvider<T> =
tasks.register(name, T::class.java) { task ->
task.fn()
}
internal fun Provider<String>.toDir(project: Project): Provider<Directory> =
project.layout.dir(map { File(it) })
internal fun Provider<File>.fileToDir(project: Project): Provider<Directory> =
project.layout.dir(this)
val Project.localPropertiesFile get() = project.rootProject.file("local.properties")
fun Project.getLocalProperty(key: String): String? {

4
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/osUtils.kt → gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/osUtils.kt

@ -1,9 +1,9 @@
/*
* Copyright 2020-2022 JetBrains s.r.o. and respective authors and developers.
* Copyright 2020-2023 JetBrains s.r.o. and respective authors and developers.
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
*/
package org.jetbrains.compose.desktop.application.internal
package org.jetbrains.compose.internal.utils
import org.gradle.api.provider.Provider
import org.jetbrains.compose.desktop.application.internal.files.checkExistingFile

31
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/gradleUtils.kt → gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/providerUtils.kt

@ -1,19 +1,17 @@
/*
* Copyright 2020-2022 JetBrains s.r.o. and respective authors and developers.
* Copyright 2020-2023 JetBrains s.r.o. and respective authors and developers.
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
*/
package org.jetbrains.compose.desktop.application.internal
package org.jetbrains.compose.internal.utils
import org.gradle.api.Task
import org.gradle.api.file.Directory
import org.gradle.api.file.FileSystemLocation
import org.gradle.api.file.RegularFile
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.TaskProvider
import java.io.File
internal inline fun <reified T> ObjectFactory.new(vararg params: Any): T =
newInstance(T::class.java, *params)
@SuppressWarnings("UNCHECKED_CAST")
internal inline fun <reified T : Any> ObjectFactory.nullableProperty(): Property<T?> =
@ -30,22 +28,3 @@ internal inline fun <reified T> Provider<T>.toProperty(objects: ObjectFactory):
internal inline fun <reified T> Task.provider(noinline fn: () -> T): Provider<T> =
project.provider(fn)
internal fun Provider<Directory>.file(relativePath: String): Provider<RegularFile> =
map { it.file(relativePath) }
internal fun Provider<Directory>.dir(relativePath: String): Provider<Directory> =
map { it.dir(relativePath) }
internal inline fun <reified T> ObjectFactory.new(vararg params: Any): T =
newInstance(T::class.java, *params)
internal fun <T : Task> TaskProvider<T>.dependsOn(vararg dependencies: Any) {
configure { it.dependsOn(*dependencies) }
}
internal val <T : FileSystemLocation> Provider<T>.ioFile: File
get() = get().asFile
internal val <T : FileSystemLocation> Provider<T>.ioFileOrNull: File?
get() = orNull?.asFile

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/stringUtils.kt → gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/stringUtils.kt

@ -3,7 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
*/
package org.jetbrains.compose.internal
package org.jetbrains.compose.internal.utils
internal fun String.uppercaseFirstChar(): String =
transformFirstCharIfNeeded(

22
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/utils/taskUtils.kt

@ -0,0 +1,22 @@
/*
* Copyright 2020-2023 JetBrains s.r.o. and respective authors and developers.
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
*/
package org.jetbrains.compose.internal.utils
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.tasks.TaskProvider
internal fun <T : Task> TaskProvider<T>.dependsOn(vararg dependencies: Any) {
configure { it.dependsOn(*dependencies) }
}
internal inline fun <reified T : Task> Project.registerTask(
name: String,
crossinline fn: T.() -> Unit
): TaskProvider<T> =
tasks.register(name, T::class.java) { task ->
task.fn()
}

8
gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/DesktopApplicationTest.kt

@ -7,8 +7,12 @@ package org.jetbrains.compose.test.tests.integration
import org.gradle.internal.impldep.org.testng.Assert
import org.gradle.testkit.runner.TaskOutcome
import org.jetbrains.compose.desktop.application.internal.*
import org.jetbrains.compose.internal.uppercaseFirstChar
import org.jetbrains.compose.internal.utils.MacUtils
import org.jetbrains.compose.internal.utils.OS
import org.jetbrains.compose.internal.utils.currentArch
import org.jetbrains.compose.internal.utils.currentOS
import org.jetbrains.compose.internal.utils.currentTarget
import org.jetbrains.compose.internal.utils.uppercaseFirstChar
import org.jetbrains.compose.test.utils.*
import java.io.File

4
gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/unit/FileHashTest.kt

@ -5,8 +5,8 @@
package org.jetbrains.compose.test.tests.unit
import org.jetbrains.compose.desktop.application.internal.OS
import org.jetbrains.compose.desktop.application.internal.currentOS
import org.jetbrains.compose.internal.utils.OS
import org.jetbrains.compose.internal.utils.currentOS
import org.jetbrains.compose.desktop.application.internal.files.contentHash
import org.junit.jupiter.api.Assertions.*

Loading…
Cancel
Save