Skip to content

Commit

Permalink
add cocoapods to :shared-compose-test
Browse files Browse the repository at this point in the history
  • Loading branch information
babichev.a authored and softartdev committed Apr 14, 2024
1 parent 453a0d0 commit 9166859
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 18 deletions.
32 changes: 16 additions & 16 deletions iosApp/iosApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
);
Expand Down Expand Up @@ -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 */ = {
Expand Down
24 changes: 22 additions & 2 deletions shared-compose-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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"))
Expand All @@ -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 {
Expand Down
50 changes: 50 additions & 0 deletions shared-compose-test/iosComposeTestPod.podspec
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9166859

Please sign in to comment.