Skip to content

Commit

Permalink
Support subdirectories & restructure
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyTsvetkov committed Jul 17, 2023
1 parent b5cc7d1 commit 208dd76
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import org.jetbrains.compose.desktop.preview.internal.initializePreview
import org.jetbrains.compose.experimental.dsl.ExperimentalExtension
import org.jetbrains.compose.experimental.internal.configureExperimentalTargetsFlagsCheck
import org.jetbrains.compose.experimental.internal.configureExperimental
import org.jetbrains.compose.experimental.uikit.internal.configureSyncTask
import org.jetbrains.compose.experimental.uikit.internal.resources.configureSyncTask
import org.jetbrains.compose.internal.KOTLIN_MPP_PLUGIN_ID
import org.jetbrains.compose.internal.mppExt
import org.jetbrains.compose.internal.utils.currentTarget
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.experimental.uikit.internal
package org.jetbrains.compose.experimental.uikit.internal.resources

import org.gradle.api.provider.Property
import org.gradle.api.provider.SetProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
* 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.experimental.uikit.internal
package org.jetbrains.compose.experimental.uikit.internal.resources

import org.gradle.api.Project
import org.gradle.api.file.Directory
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.TaskContainer
import org.jetbrains.compose.experimental.uikit.internal.utils.IosGradleProperties
import org.jetbrains.compose.experimental.uikit.internal.utils.asIosNativeTargetOrNull
import org.jetbrains.compose.experimental.uikit.internal.utils.cocoapodsExt
import org.jetbrains.compose.experimental.uikit.internal.utils.withCocoapodsPlugin
import org.jetbrains.compose.experimental.uikit.tasks.SyncComposeResourcesForIosTask
import org.jetbrains.compose.internal.utils.joinLowerCamelCase
import org.jetbrains.compose.internal.utils.new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,10 @@
* 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.experimental.uikit.internal
package org.jetbrains.compose.experimental.uikit.internal.resources

import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.konan.target.KonanTarget

internal fun KotlinNativeTarget.isIosSimulatorTarget(): Boolean =
konanTarget === KonanTarget.IOS_X64 || konanTarget === KonanTarget.IOS_SIMULATOR_ARM64

internal fun KotlinNativeTarget.isIosDeviceTarget(): Boolean =
konanTarget === KonanTarget.IOS_ARM64 || konanTarget === KonanTarget.IOS_ARM32

internal fun KotlinNativeTarget.isIosTarget(): Boolean =
isIosSimulatorTarget() || isIosDeviceTarget()

internal fun KotlinTarget.asIosNativeTargetOrNull(): KotlinNativeTarget? =
(this as? KotlinNativeTarget)?.takeIf { it.isIosTarget() }

// based on AppleSdk.kt from Kotlin Gradle Plugin
// See https://github.com/JetBrains/kotlin/blob/142421da5b966049b4eab44ce6856eb172cf122a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/plugin/mpp/apple/AppleSdk.kt
internal fun determineIosKonanTargetsFromEnv(platform: String, archs: List<String>): List<KonanTarget> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.experimental.uikit.internal
package org.jetbrains.compose.experimental.uikit.internal.utils

import org.gradle.api.provider.Provider
import org.gradle.api.provider.ProviderFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.experimental.uikit.internal
package org.jetbrains.compose.experimental.uikit.internal.utils

import org.gradle.api.Project
import org.gradle.api.plugins.ExtensionAware
Expand Down
Original file line number Diff line number Diff line change
@@ -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.experimental.uikit.internal.utils

import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.konan.target.KonanTarget

internal fun KotlinNativeTarget.isIosSimulatorTarget(): Boolean =
konanTarget === KonanTarget.IOS_X64 || konanTarget === KonanTarget.IOS_SIMULATOR_ARM64

internal fun KotlinNativeTarget.isIosDeviceTarget(): Boolean =
konanTarget === KonanTarget.IOS_ARM64 || konanTarget === KonanTarget.IOS_ARM32

internal fun KotlinNativeTarget.isIosTarget(): Boolean =
isIosSimulatorTarget() || isIosDeviceTarget()

internal fun KotlinTarget.asIosNativeTargetOrNull(): KotlinNativeTarget? =
(this as? KotlinNativeTarget)?.takeIf { it.isIosTarget() }
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import org.gradle.api.file.FileCollection
import org.gradle.api.provider.Provider
import org.gradle.api.provider.SetProperty
import org.gradle.api.tasks.*
import org.jetbrains.compose.experimental.uikit.internal.determineIosKonanTargetsFromEnv
import org.jetbrains.compose.experimental.uikit.internal.IosTargetResources
import org.jetbrains.compose.experimental.uikit.internal.resources.determineIosKonanTargetsFromEnv
import org.jetbrains.compose.experimental.uikit.internal.resources.IosTargetResources
import java.io.File
import kotlin.io.path.Path
import kotlin.io.path.pathString
Expand Down

0 comments on commit 208dd76

Please sign in to comment.