[Gradle] Use unique artifact name for podspec task + avoid redundant task registration
^KT-51518 Verification Pending
This commit is contained in:
committed by
Space Team
parent
1828f7a374
commit
143a233a9e
+76
-16
@@ -32,15 +32,15 @@ class NativeLibraryDslWithCocoapodsIT : BaseGradleIT() {
|
||||
build(":shared:tasks") {
|
||||
assertSuccessful()
|
||||
assertTasksRegistered(
|
||||
":shared:generateMylibPodspec",
|
||||
":shared:generateMyslibPodspec",
|
||||
":shared:generateMyframePodspec",
|
||||
":shared:generateMyfatframePodspec",
|
||||
":shared:generateSharedPodspec",
|
||||
":lib:generateGrooframePodspec",
|
||||
)
|
||||
assertTasksNotRegistered(
|
||||
":shared:generateMyfatframewithoutpodspecPodspec",
|
||||
":shared:generateMylibStaticLibraryLinuxX64Podspec",
|
||||
":shared:generateMyslibSharedLibraryLinuxX64Podspec",
|
||||
":shared:generateMyframeFrameworkIosArm64Podspec",
|
||||
":shared:generateMyfatframeFatFrameworkPodspec",
|
||||
":shared:generateSharedXCFrameworkPodspec",
|
||||
":lib:generateGrooframeFrameworkIosArm64Podspec",
|
||||
":lib:generateGrooxcframeXCFrameworkPodspec",
|
||||
":shared:generateMyframewihtoutpodspecFrameworkIosArm64Podspec",
|
||||
":lib:generateGrooxcframewithoutpodspecXCFrameworkPodspec",
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ class NativeLibraryDslWithCocoapodsIT : BaseGradleIT() {
|
||||
project {
|
||||
build(":shared:assembleMylibStaticLibraryLinuxX64") {
|
||||
assertSuccessful()
|
||||
assertTasksExecuted(":shared:generateMylibPodspec")
|
||||
assertTasksExecuted(":shared:generateMylibStaticLibraryLinuxX64Podspec")
|
||||
assertFilesContentEqual("podspecs/mylib.podspec", "/shared/build/out/static/mylib.podspec")
|
||||
}
|
||||
}
|
||||
@@ -62,29 +62,50 @@ class NativeLibraryDslWithCocoapodsIT : BaseGradleIT() {
|
||||
project {
|
||||
build(":shared:assembleMyslibSharedLibraryLinuxX64") {
|
||||
assertSuccessful()
|
||||
assertTasksExecuted(":shared:generateMyslibPodspec")
|
||||
assertTasksExecuted(":shared:generateMyslibSharedLibraryLinuxX64Podspec")
|
||||
assertFilesContentEqual("podspecs/myslib.podspec", "/shared/build/out/dynamic/myslib.podspec")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `not generate podspec when withPodspec is empty`() {
|
||||
project {
|
||||
build(":shared:assembleMyslibwithoutpodspecSharedLibraryLinuxX64") {
|
||||
assertSuccessful()
|
||||
assertTasksSkipped(":shared:generateMyslibwithoutpodspecSharedLibraryLinuxX64Podspec")
|
||||
assertContains("Skipping task ':shared:generateMyslibwithoutpodspecSharedLibraryLinuxX64Podspec' because there are no podspec attributes defined")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `generate podspec when assembling framework`() {
|
||||
project {
|
||||
build(":shared:assembleMyframeFrameworkIosArm64") {
|
||||
assertSuccessful()
|
||||
assertTasksExecuted(":shared:generateMyframePodspec")
|
||||
assertTasksExecuted(":shared:generateMyframeFrameworkIosArm64Podspec")
|
||||
assertFilesContentEqual("podspecs/myframe.podspec", "/shared/build/out/framework/myframe.podspec")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `not generate podspec when there is no withPodspec`() {
|
||||
project {
|
||||
build(":shared:assembleMyframewihtoutpodspecFrameworkIosArm64") {
|
||||
assertSuccessful()
|
||||
assertTasksSkipped(":shared:generateMyframewihtoutpodspecFrameworkIosArm64Podspec")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `generate podspec when assembling fat framework`() {
|
||||
project {
|
||||
build(":shared:assembleMyfatframeFatFramework") {
|
||||
assertSuccessful()
|
||||
assertTasksExecuted(":shared:generateMyfatframePodspec")
|
||||
assertTasksExecuted(":shared:generateMyfatframeFatFrameworkPodspec")
|
||||
assertFilesContentEqual("podspecs/myfatframe.podspec", "/shared/build/out/fatframework/myfatframe.podspec")
|
||||
}
|
||||
}
|
||||
@@ -95,23 +116,62 @@ class NativeLibraryDslWithCocoapodsIT : BaseGradleIT() {
|
||||
project {
|
||||
build(":shared:assembleSharedXCFramework") {
|
||||
assertSuccessful()
|
||||
assertTasksExecuted(":shared:generateSharedPodspec")
|
||||
assertTasksExecuted(":shared:generateSharedXCFrameworkPodspec")
|
||||
assertFilesContentEqual("podspecs/shared.podspec", "/shared/build/out/xcframework/shared.podspec")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `generate podspec when assembling framework from groovy`() {
|
||||
fun `generate podspec when assembling xcframework from groovy`() {
|
||||
project {
|
||||
build(":lib:assembleGrooframeFrameworkIosArm64") {
|
||||
assertSuccessful()
|
||||
assertTasksExecuted(":lib:generateGrooframePodspec")
|
||||
assertTasksExecuted(":lib:generateGrooframeFrameworkIosArm64Podspec")
|
||||
assertFilesContentEqual("podspecs/grooframe.podspec", "/lib/build/out/framework/grooframe.podspec")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `not generate podspec from groovy when withPodspec is empty`() {
|
||||
project {
|
||||
build(":lib:assembleGrooxcframeXCFramework") {
|
||||
assertSuccessful()
|
||||
assertTasksSkipped(":lib:generateGrooxcframeXCFrameworkPodspec")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `not generate podspec from groovy when there is no withPodspec`() {
|
||||
project {
|
||||
build(":lib:assembleGrooxcframewithoutpodspecXCFramework") {
|
||||
assertSuccessful()
|
||||
assertTasksSkipped(":lib:generateGrooxcframewithoutpodspecXCFrameworkPodspec")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `generate podspecs when several frameworks have with the same name`() {
|
||||
project {
|
||||
projectDir.resolve("shared/build.gradle.kts").appendText("""
|
||||
kotlinArtifacts {
|
||||
Native.Library {
|
||||
target = linuxX64
|
||||
|
||||
withPodspec {}
|
||||
}
|
||||
}
|
||||
""".trimIndent())
|
||||
|
||||
build(":shared:assembleSharedXCFramework") {
|
||||
assertSuccessful()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun project(block: Project.() -> Unit) {
|
||||
transformProjectWithPluginsDsl("new-kn-library-dsl-cocoapods").block()
|
||||
}
|
||||
|
||||
+12
@@ -23,9 +23,21 @@ kotlinArtifacts {
|
||||
attribute('homepage', 'https://example.com/lib')
|
||||
attribute('ios.deployment_target', '"10.0"')
|
||||
attribute('swift_versions', '[\'4\', \'5\']')
|
||||
}
|
||||
|
||||
withPodspec {
|
||||
rawStatement(' # This is raw statement that is appended \'as is\' to the podspec')
|
||||
rawStatement(' spec.frameworks = \'CFNetwork\'')
|
||||
}
|
||||
}
|
||||
|
||||
it.native.XCFramework("grooxcframe") {
|
||||
targets(iosX64, iosArm64, iosSimulatorArm64)
|
||||
|
||||
withPodspec {}
|
||||
}
|
||||
|
||||
it.native.XCFramework("grooxcframewithoutpodspec") {
|
||||
targets(iosX64, iosArm64, iosSimulatorArm64)
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
Pod::Spec.new do |spec|
|
||||
spec.name = 'myslib'
|
||||
spec.version = '0.1'
|
||||
spec.vendored_library = 'libmyslib.dylib'
|
||||
|
||||
spec.version = '111'
|
||||
end
|
||||
|
||||
+14
@@ -42,6 +42,16 @@ kotlinArtifacts {
|
||||
modes(DEBUG)
|
||||
addModule(project(":lib"))
|
||||
|
||||
withPodspec {
|
||||
attribute("version", "111")
|
||||
}
|
||||
}
|
||||
Native.Library("myslibwithoutpodspec") {
|
||||
target = linuxX64
|
||||
isStatic = false
|
||||
modes(DEBUG)
|
||||
addModule(project(":lib"))
|
||||
|
||||
withPodspec {} // intentionally empty
|
||||
}
|
||||
Native.Framework("myframe") {
|
||||
@@ -83,13 +93,17 @@ kotlinArtifacts {
|
||||
attribute("license", "MIT")
|
||||
attribute("homepage", "https://github.com/Alpaca/Alpaca")
|
||||
attribute("source", "{ :git => 'https://github.com/Alpaca/Alpaca.git', :tag => spec.version }")
|
||||
}
|
||||
|
||||
withPodspec {
|
||||
attribute("ios.deployment_target", "10.0")
|
||||
attribute("osx.deployment_target", "10.12")
|
||||
attribute("watchos.deployment_target", "3.0")
|
||||
|
||||
attribute("swift_versions", "['4', '5']")
|
||||
}
|
||||
|
||||
withPodspec {
|
||||
rawStatement(" # This is raw statement that is appended 'as is' to the podspec")
|
||||
rawStatement(" spec.frameworks = 'CFNetwork'")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user