Skip to content

Commit f767dc1

Browse files
committed
Fix :compose:ui:ui-uikit error because of parallel execution
1 parent 6ef383d commit f767dc1

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

compose/ui/ui-uikit/build.gradle

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import androidx.build.KotlinTarget
22
import androidx.build.SoftwareType
3+
import org.gradle.api.services.BuildService
4+
import org.gradle.api.services.BuildServiceParameters
35

46
/*
57
* Copyright 2023 The Android Open Source Project
@@ -17,8 +19,6 @@ import androidx.build.SoftwareType
1719
* limitations under the License.
1820
*/
1921

20-
import androidx.build.KotlinTarget
21-
2222
plugins {
2323
id("AndroidXPlugin")
2424
id("kotlin-multiplatform")
@@ -55,6 +55,13 @@ kotlin {
5555
}
5656

5757
private def configure(target, isDevice, architecture, testTarget) {
58+
// to prevent "Process 'command 'xcodebuild'' finished with non-zero exit value 65"
59+
// "error: unable to attach DB: unable to initialize database (database is locked)"
60+
def xcodeLock =
61+
project.gradle.sharedServices.registerIfAbsent("xcodeBuildLock", XcodeBuildLock) {
62+
maxParallelUsages.set(1)
63+
}
64+
5865
def frameworkName = "CMPUIKitUtils"
5966
def buildSchemeName = frameworkName
6067
def testSchemeName = "${frameworkName}Tests"
@@ -120,6 +127,7 @@ private def configure(target, isDevice, architecture, testTarget) {
120127
target.compilations.main {
121128
def libTaskName = "${compileTaskProvider.name}ObjCLib"
122129
project.tasks.register(libTaskName, Exec) {
130+
usesService(xcodeLock)
123131
inputs.dir(frameworkSourcesDir)
124132
.withPropertyName("${frameworkName}-${sdkName}")
125133
.withPathSensitivity(PathSensitivity.RELATIVE)
@@ -176,4 +184,6 @@ androidx {
176184
inceptionYear = "2023"
177185
description = "Internal iOS UIKit utilities including Objective-C library."
178186
legacyDisableKotlinStrictApiMode = true
179-
}
187+
}
188+
189+
abstract class XcodeBuildLock implements BuildService<BuildServiceParameters.None> {}

0 commit comments

Comments
 (0)