Browse Source

Configure explicit dependency on the copyFonts task to fix a build (#4247)

pull/4253/head
Konstantin 11 months ago committed by GitHub
parent
commit
b8be217dad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/AndroidTargetConfiguration.kt
  2. 2
      gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/ResourcesTest.kt
  3. 14
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/build.gradle.kts
  4. 2
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/settings.gradle.kts
  5. 4
      gradle-plugins/compose/src/test/test-projects/misc/commonResources/src/androidMain/AndroidManifest.xml

5
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/AndroidTargetConfiguration.kt

@ -2,7 +2,7 @@ package org.jetbrains.compose.resources
import com.android.build.api.variant.AndroidComponentsExtension
import com.android.build.gradle.BaseExtension
import com.android.build.gradle.tasks.MergeSourceSetFolders
import com.android.build.gradle.internal.tasks.AndroidVariantTask
import org.gradle.api.Project
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.Copy
@ -39,4 +39,7 @@ internal fun Project.configureAndroidResources(
}
)
}
//fixme: it seems like a problem in AGP, so dirty hack now
//https://github.com/JetBrains/compose-multiplatform/issues/4085
tasks.matching { it is AndroidVariantTask }.configureEach { it.dependsOn(copyFonts) }
}

2
gradle-plugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/ResourcesTest.kt

@ -112,7 +112,7 @@ class ResourcesTest : GradlePluginTestBase() {
@Test
fun testCopyFontsInAndroidApp(): Unit = with(testProject("misc/commonResources")) {
gradle("assembleDebug").checks {
gradle("build").checks {
check.taskSuccessful(":copyFontsToAndroidAssets")
}
}

14
gradle-plugins/compose/src/test/test-projects/misc/commonResources/build.gradle.kts

@ -1,6 +1,6 @@
plugins {
kotlin("multiplatform")
id("com.android.library")
id("com.android.application")
id("org.jetbrains.compose")
}
@ -29,10 +29,20 @@ kotlin {
}
android {
compileSdk = 31
compileSdk = 34
namespace = "org.jetbrains.compose.resources.test"
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
applicationId = "org.example.project"
minSdk = 21
targetSdk = 34
versionCode = 1
versionName = "1.0"
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11

2
gradle-plugins/compose/src/test/test-projects/misc/commonResources/settings.gradle.kts

@ -7,7 +7,7 @@ pluginManagement {
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
plugins {
id("com.android.library").version("AGP_VERSION_PLACEHOLDER")
id("com.android.application").version("AGP_VERSION_PLACEHOLDER")
id("org.jetbrains.kotlin.multiplatform").version("KOTLIN_VERSION_PLACEHOLDER")
id("org.jetbrains.compose").version("COMPOSE_GRADLE_PLUGIN_VERSION_PLACEHOLDER")
}

4
gradle-plugins/compose/src/test/test-projects/misc/commonResources/src/androidMain/AndroidManifest.xml

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest>
<application/>
</manifest>
Loading…
Cancel
Save