From 9166859f4103a8029b64e29c703a0c0062839b4e Mon Sep 17 00:00:00 2001 From: "babichev.a" Date: Fri, 5 Apr 2024 20:42:26 +0400 Subject: [PATCH] add cocoapods to :shared-compose-test --- iosApp/iosApp.xcodeproj/project.pbxproj | 32 ++++++------ shared-compose-test/build.gradle.kts | 24 ++++++++- shared-compose-test/iosComposeTestPod.podspec | 50 +++++++++++++++++++ 3 files changed, 88 insertions(+), 18 deletions(-) create mode 100644 shared-compose-test/iosComposeTestPod.podspec diff --git a/iosApp/iosApp.xcodeproj/project.pbxproj b/iosApp/iosApp.xcodeproj/project.pbxproj index 02351b44..c23a8c58 100644 --- a/iosApp/iosApp.xcodeproj/project.pbxproj +++ b/iosApp/iosApp.xcodeproj/project.pbxproj @@ -158,7 +158,7 @@ 75CF0FBEED43B2BAC7F61B5C /* Frameworks */, 7594048B29365286005183CD /* Copy moko-resources */, A798D07A9F8F09FA2C8C3203 /* [CP] Embed Pods Frameworks */, - A5DC2BC72D5DE518FFDD4EB0 /* [CP] Copy Pods Resources */, + 75A4484F16A03755A1313570 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -265,43 +265,43 @@ shellPath = /bin/sh; shellScript = "\"$SRCROOT/../gradlew\" -p \"$SRCROOT/../\" :shared:copyFrameworkResourcesToApp \\\n -Pmoko.resources.PLATFORM_NAME=$PLATFORM_NAME \\\n -Pmoko.resources.CONFIGURATION=$CONFIGURATION \\\n -Pmoko.resources.BUILT_PRODUCTS_DIR=$BUILT_PRODUCTS_DIR \\\n -Pmoko.resources.CONTENTS_FOLDER_PATH=$CONTENTS_FOLDER_PATH\\\n -Pkotlin.native.cocoapods.platform=$PLATFORM_NAME \\\n -Pkotlin.native.cocoapods.archs=\"$ARCHS\" \\\n -Pkotlin.native.cocoapods.configuration=$CONFIGURATION \n"; }; - 9540BC583EA31285CCD108E3 /* [CP] Check Pods Manifest.lock */ = { + 75A4484F16A03755A1313570 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources-${CONFIGURATION}-input-files.xcfilelist", ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Copy Pods Resources"; outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-iosApp-checkManifestLockResult.txt", + "${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources.sh\"\n"; showEnvVarsInLog = 0; }; - A5DC2BC72D5DE518FFDD4EB0 /* [CP] Copy Pods Resources */ = { + 9540BC583EA31285CCD108E3 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources-${CONFIGURATION}-input-files.xcfilelist", ); - name = "[CP] Copy Pods Resources"; + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-iosApp-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; A798D07A9F8F09FA2C8C3203 /* [CP] Embed Pods Frameworks */ = { diff --git a/shared-compose-test/build.gradle.kts b/shared-compose-test/build.gradle.kts index 075d64eb..3fc4a65c 100644 --- a/shared-compose-test/build.gradle.kts +++ b/shared-compose-test/build.gradle.kts @@ -1,7 +1,9 @@ import com.softartdev.notedelight.iosIntermediateSourceSets +import org.gradle.internal.os.OperatingSystem plugins { alias(libs.plugins.kotlin.multiplatform) + alias(libs.plugins.kotlin.cocoapods) alias(libs.plugins.compose) } compose { @@ -17,9 +19,26 @@ kotlin { iosIntermediateSourceSets(iosArm64(), iosSimulatorArm64()) applyDefaultHierarchyTemplate() + cocoapods { + name = "iosComposeTestPod" + summary = "Tests for common UI-kit of the NoteDelight app" + homepage = "https://github.com/softartdev/NoteDelight" + version = "1.0" + ios.deploymentTarget = "14.1" + podfile = project.file("../iosApp/Podfile") + pod("SQLCipher", libs.versions.iosSqlCipher.get()) + framework { + baseName = "iosComposeTestKit" + isStatic = true + export(project(":shared")) + export(libs.mokoResources) + export(libs.koin.core) + } + if (!OperatingSystem.current().isMacOsX) noPodspec() + } sourceSets { commonMain.dependencies { - implementation(project(":shared")) + api(project(":shared")) implementation(project(":shared-compose-ui")) implementation(kotlin("test")) @@ -34,7 +53,8 @@ kotlin { @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class) implementation(compose.uiTest) - implementation(libs.koin.core) + api(libs.mokoResources) + api(libs.koin.core) implementation(libs.turbine) } commonTest.dependencies { diff --git a/shared-compose-test/iosComposeTestPod.podspec b/shared-compose-test/iosComposeTestPod.podspec new file mode 100644 index 00000000..0f596e7a --- /dev/null +++ b/shared-compose-test/iosComposeTestPod.podspec @@ -0,0 +1,50 @@ +Pod::Spec.new do |spec| + spec.name = 'iosComposeTestPod' + spec.version = '1.0' + spec.homepage = 'https://github.com/softartdev/NoteDelight' + spec.source = { :http=> ''} + spec.authors = '' + spec.license = '' + spec.summary = 'Tests for common UI-kit of the NoteDelight app' + spec.vendored_frameworks = 'build/cocoapods/framework/iosComposeTestKit.framework' + spec.libraries = 'c++' + spec.ios.deployment_target = '14.1' + spec.dependency 'SQLCipher', '4.5.4' + + if !Dir.exist?('build/cocoapods/framework/iosComposeTestKit.framework') || Dir.empty?('build/cocoapods/framework/iosComposeTestKit.framework') + raise " + + Kotlin framework 'iosComposeTestKit' doesn't exist yet, so a proper Xcode project can't be generated. + 'pod install' should be executed after running ':generateDummyFramework' Gradle task: + + ./gradlew :shared-compose-test:generateDummyFramework + + Alternatively, proper pod installation is performed during Gradle sync in the IDE (if Podfile location is set)" + end + + spec.pod_target_xcconfig = { + 'KOTLIN_PROJECT_PATH' => ':shared-compose-test', + 'PRODUCT_MODULE_NAME' => 'iosComposeTestKit', + } + + spec.script_phases = [ + { + :name => 'Build iosComposeTestPod', + :execution_position => :before_compile, + :shell_path => '/bin/sh', + :script => <<-SCRIPT + if [ "YES" = "$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED" ]; then + echo "Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \"YES\"" + exit 0 + fi + set -ev + REPO_ROOT="$PODS_TARGET_SRCROOT" + "$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework \ + -Pkotlin.native.cocoapods.platform=$PLATFORM_NAME \ + -Pkotlin.native.cocoapods.archs="$ARCHS" \ + -Pkotlin.native.cocoapods.configuration="$CONFIGURATION" + SCRIPT + } + ] + spec.resources = ['build/compose/ios/iosComposeTestKit/compose-resources'] +end \ No newline at end of file