From fe1fa5719aaa0e0942f5b84a769163b9ce1c11bf Mon Sep 17 00:00:00 2001 From: Pasin Suriyentrakorn Date: Mon, 22 Jan 2024 10:33:43 -0800 Subject: [PATCH] CBL-4648 : Use Swift Private Module Map for ObjC headers (#3214) * Used Swift Private Module Map for the ObjC headers instead of putting the ObjC headers that are supposed to be private in the main module map file and use the post-processing script (remote_private_headers.sh) to remove the headers after build. * Removed the main handcrafted CouchbaseLiteSwift.modulemap and CouchbaseLiteSwift-EE.modulemap and let XCode generates them instead. * Removed remove_private_headers.sh and also the build phrase step that calls the script from the project. * Fixed build_xcframework.sh when running the script with relative out directory path (xcodebuild -create-xcframework requires absolute paths for the dSYM directory). * Changed file mode of all scripts in Scripts to be executable. --- CouchbaseLite.xcodeproj/project.pbxproj | 44 +----- Scripts/build_xcframework.sh | 26 ++-- Scripts/generate_objc_release_zip.sh | 0 Scripts/generate_package_manifest.sh | 0 Scripts/generate_swift_release_zip.sh | 0 Scripts/remove_private_headers.sh | 12 -- Scripts/strip_frameworks.sh | 0 Swift/CouchbaseLiteSwift-EE.modulemap | 152 --------------------- Swift/CouchbaseLiteSwift.modulemap | 120 ---------------- Swift/CouchbaseLiteSwift.private.modulemap | 112 +++++++++++++++ xcconfigs/CBL Swift.xcconfig | 2 +- xcconfigs/Project.xcconfig | 2 +- xcconfigs/Project_Debug_EE.xcconfig | 3 +- xcconfigs/Project_Release_EE.xcconfig | 3 +- 14 files changed, 137 insertions(+), 339 deletions(-) mode change 100644 => 100755 Scripts/build_xcframework.sh mode change 100644 => 100755 Scripts/generate_objc_release_zip.sh mode change 100644 => 100755 Scripts/generate_package_manifest.sh mode change 100644 => 100755 Scripts/generate_swift_release_zip.sh delete mode 100755 Scripts/remove_private_headers.sh mode change 100644 => 100755 Scripts/strip_frameworks.sh delete mode 100644 Swift/CouchbaseLiteSwift-EE.modulemap delete mode 100644 Swift/CouchbaseLiteSwift.modulemap create mode 100644 Swift/CouchbaseLiteSwift.private.modulemap diff --git a/CouchbaseLite.xcodeproj/project.pbxproj b/CouchbaseLite.xcodeproj/project.pbxproj index 43559f3f7..df0c3a403 100644 --- a/CouchbaseLite.xcodeproj/project.pbxproj +++ b/CouchbaseLite.xcodeproj/project.pbxproj @@ -2073,7 +2073,6 @@ 1A93FAE124F0E6E60015D54D /* prepare_project.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = prepare_project.sh; path = ../Scripts/prepare_project.sh; sourceTree = ""; }; 1A93FAE224F0E6E60015D54D /* generate_carthage_package.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = generate_carthage_package.sh; path = ../Scripts/generate_carthage_package.sh; sourceTree = ""; }; 1A93FAE324F0E6E60015D54D /* generate_ee_release_zip.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = generate_ee_release_zip.sh; path = ../Scripts/generate_ee_release_zip.sh; sourceTree = ""; }; - 1A93FAE424F0E6E60015D54D /* pull_request_build.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = pull_request_build.sh; path = ../Scripts/pull_request_build.sh; sourceTree = ""; }; 1A93FAE524F0E6E60015D54D /* loc.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = loc.sh; path = ../Scripts/loc.sh; sourceTree = ""; }; 1A9617F2289BF3C10037E78E /* URLEndpointListenerTest+Collection.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "URLEndpointListenerTest+Collection.m"; sourceTree = ""; }; 1A9617FF289BF6940037E78E /* URLEndpointListenerTest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = URLEndpointListenerTest.h; sourceTree = ""; }; @@ -2176,6 +2175,8 @@ 27EF6A931E298E26004748DF /* PredicateQueryTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PredicateQueryTest.m; sourceTree = ""; }; 27F961971ED8D9440060F804 /* CBLReachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CBLReachability.h; sourceTree = ""; }; 27F961981ED8D9440060F804 /* CBLReachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CBLReachability.m; sourceTree = ""; }; + 40E905462B5B6D9D00EDF483 /* CouchbaseLiteSwift.private.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = CouchbaseLiteSwift.private.modulemap; sourceTree = ""; }; + 40E905782B5B9A6700EDF483 /* CouchbaseLiteSwift.private.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = CouchbaseLiteSwift.private.modulemap; sourceTree = ""; }; 69002EA9234E693F00776107 /* CBLErrorMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CBLErrorMessage.h; sourceTree = ""; }; 69002EB8234E693F00776107 /* CBLErrorMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CBLErrorMessage.m; sourceTree = ""; }; 6932D48B2954640000D28C18 /* CBLQueryFullTextIndexExpression.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CBLQueryFullTextIndexExpression.h; path = ../CBLQueryFullTextIndexExpression.h; sourceTree = ""; }; @@ -2429,7 +2430,6 @@ 9381961D1EC11A8C0032CC51 /* CBLDictionary+Swift.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CBLDictionary+Swift.h"; sourceTree = ""; }; 938196201EC11CDF0032CC51 /* CBLArray+Swift.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CBLArray+Swift.h"; sourceTree = ""; }; 938196291EC152410032CC51 /* Document.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Document.swift; sourceTree = ""; }; - 93823518207D7CF70022328B /* CouchbaseLiteSwift-EE.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = "CouchbaseLiteSwift-EE.modulemap"; sourceTree = ""; }; 9383A5821F1EE7C00083053D /* CBLQueryResultSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CBLQueryResultSet.h; sourceTree = ""; }; 9383A5831F1EE7C00083053D /* CBLQueryResultSet.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CBLQueryResultSet.mm; sourceTree = ""; }; 9383A5881F1EE8EF0083053D /* CBLQueryResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CBLQueryResult.h; sourceTree = ""; }; @@ -2465,7 +2465,6 @@ 9388CB8E21BCDF8B005CA66D /* carat.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = carat.png; sourceTree = ""; }; 9388CB8F21BCDF8B005CA66D /* dash.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = dash.png; sourceTree = ""; }; 9388CB9021BCDF8B005CA66D /* gh.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = gh.png; sourceTree = ""; }; - 9388CB9221BCDF8B005CA66D /* remove_private_headers.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = remove_private_headers.sh; sourceTree = ""; }; 9388CB9321BCDF8B005CA66D /* get_repo_version.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = get_repo_version.sh; sourceTree = ""; }; 9388CB9421BCDF8B005CA66D /* build_framework.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = build_framework.sh; sourceTree = ""; }; 9388CB9521BCDF8B005CA66D /* strip_frameworks.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = strip_frameworks.sh; sourceTree = ""; }; @@ -2584,7 +2583,6 @@ 93CD02DD1EA037B200AFB3FA /* CBLDictionary.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CBLDictionary.mm; sourceTree = ""; }; 93CD02E41EA0382C00AFB3FA /* CBLMutableDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CBLMutableDictionary.h; sourceTree = ""; }; 93CD02E51EA0382D00AFB3FA /* CBLMutableDictionary.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CBLMutableDictionary.mm; sourceTree = ""; }; - 93CED8B620488B9200E6F0A4 /* CouchbaseLiteSwift.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = CouchbaseLiteSwift.modulemap; sourceTree = ""; }; 93CED8C820488BC900E6F0A4 /* DatabaseChange.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseChange.swift; sourceTree = ""; }; 93CED8CA20488BD400E6F0A4 /* DocumentChange.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentChange.swift; sourceTree = ""; }; 93CED8CC20488C1300E6F0A4 /* Blob.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Blob.swift; sourceTree = ""; }; @@ -2828,7 +2826,6 @@ 1A93FAE324F0E6E60015D54D /* generate_ee_release_zip.sh */, 1A93FAE524F0E6E60015D54D /* loc.sh */, 1A93FAE124F0E6E60015D54D /* prepare_project.sh */, - 1A93FAE424F0E6E60015D54D /* pull_request_build.sh */, ); name = Scripts; sourceTree = ""; @@ -2887,8 +2884,7 @@ 9388CC4521C250A4005CA66D /* Log */, 27BE3B491E4E45CB0012B74A /* Tests */, 275F92761E4D30A4007FD5A2 /* CouchbaseLiteSwift.h */, - 93CED8B620488B9200E6F0A4 /* CouchbaseLiteSwift.modulemap */, - 93823518207D7CF70022328B /* CouchbaseLiteSwift-EE.modulemap */, + 40E905462B5B6D9D00EDF483 /* CouchbaseLiteSwift.private.modulemap */, 275F92771E4D30A4007FD5A2 /* Info.plist */, ); path = Swift; @@ -3097,6 +3093,7 @@ 93249D7D246B6EFF000A8A6E /* Listener */, 931713F722C183F200F1B5BF /* Query */, 9392608E20A0C94100E5748C /* Replicator */, + 40E905782B5B9A6700EDF483 /* CouchbaseLiteSwift.private.modulemap */, ); name = Swift; path = ../Sources/Swift; @@ -3442,7 +3439,6 @@ 9388CB7721BCDF8B005CA66D /* Support */, 9388CB7521BCDF8B005CA66D /* generate_api_docs.sh */, 9388CB7621BCDF8B005CA66D /* prepare_cocoapods.sh */, - 9388CB9221BCDF8B005CA66D /* remove_private_headers.sh */, 9388CB9321BCDF8B005CA66D /* get_repo_version.sh */, 9388CB9421BCDF8B005CA66D /* build_framework.sh */, 6992582A22DFE9A100E0D1D2 /* build_xcframework.sh */, @@ -4834,7 +4830,6 @@ 275F926F1E4D30A4007FD5A2 /* Sources */, 275F92701E4D30A4007FD5A2 /* Frameworks */, 275F92711E4D30A4007FD5A2 /* Headers */, - 93CED8D52048B3D600E6F0A4 /* Remove private headers */, ); buildRules = ( ); @@ -4948,7 +4943,6 @@ 9343F015207D61AB00F19A89 /* Sources */, 9343F0B1207D61AB00F19A89 /* Frameworks */, 9343F0B4207D61AB00F19A89 /* Headers */, - 9343F12D207D61AB00F19A89 /* Remove private headers */, ); buildRules = ( ); @@ -5553,36 +5547,6 @@ shellPath = /bin/sh; shellScript = "source \"$SCRIPT_INPUT_FILE_0\""; }; - 9343F12D207D61AB00F19A89 /* Remove private headers */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "$(SRCROOT)/Scripts/remove_private_headers.sh", - ); - name = "Remove private headers"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "source \"$SCRIPT_INPUT_FILE_0\"\necho \"Private headers removed\"\n"; - }; - 93CED8D52048B3D600E6F0A4 /* Remove private headers */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "$(SRCROOT)/Scripts/remove_private_headers.sh", - ); - name = "Remove private headers"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "source \"$SCRIPT_INPUT_FILE_0\"\necho \"Private headers removed\"\n"; - }; 93D118ED1F560232000F6D3E /* Check Git Commit */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/Scripts/build_xcframework.sh b/Scripts/build_xcframework.sh old mode 100644 new mode 100755 index 4ad3738ba..4fcb9f25a --- a/Scripts/build_xcframework.sh +++ b/Scripts/build_xcframework.sh @@ -66,8 +66,9 @@ else QUIET="-quiet" fi -# clean the output directory -OUTPUT_BASE_DIR=${OUTPUT_DIR}/xc/${SCHEME} +# Create output dir and get the absolute path (required by the xcodebuild -create-xcframework command) +mkdir -p "${OUTPUT_DIR}" +OUTPUT_DIR=`realpath "${OUTPUT_DIR}"` # Get binary and framework name: BIN_NAME=`xcodebuild -scheme "${SCHEME}" -showBuildSettings|grep -w PRODUCT_NAME|head -n 1|awk '{ print $3 }'` @@ -98,11 +99,11 @@ else EDITION="CBL_EDITION=Enterprise" fi -# archive +# Archive BUILD_DIR=$OUTPUT_DIR/build/$(echo ${SCHEME} | sed 's/ /_/g') FRAMEWORK_LOC=${BIN_NAME}.xcarchive/Products/Library/Frameworks/${BIN_NAME}.framework -# this will be used to collect all destination framework path with `-framework` +# This will be used to collect all destination framework path with `-framework` # to include them in `-create-xcframework` FRAMEWORK_PATH_ARGS=() @@ -132,13 +133,16 @@ xcarchive "generic/platform=iOS" xcarchive "generic/platform=macOS" xcarchive "generic/platform=macOS,variant=Mac Catalyst" -# create xcframework +# Create xcframework + +# Clean the output directory +OUTPUT_XC_DIR=${OUTPUT_DIR}/xc/${SCHEME} +rm -rf "${OUTPUT_XC_DIR}" + echo "Creating XCFramework..." -mkdir -p "${OUTPUT_BASE_DIR}" -xcodebuild -create-xcframework \ - -output "${OUTPUT_BASE_DIR}/${BIN_NAME}.xcframework" \ - ${FRAMEWORK_PATH_ARGS[*]} +mkdir -p "${OUTPUT_XC_DIR}" +xcodebuild -create-xcframework -output "${OUTPUT_XC_DIR}/${BIN_NAME}.xcframework" ${FRAMEWORK_PATH_ARGS[*]} -# remove build directory +# Remove build directory rm -rf ${BUILD_DIR} -echo "Finished creating XCFramework. Output at "${OUTPUT_BASE_DIR}/${BIN_NAME}.xcframework"" +echo "Finished creating XCFramework. Output at "${OUTPUT_XC_DIR}/${BIN_NAME}.xcframework"" diff --git a/Scripts/generate_objc_release_zip.sh b/Scripts/generate_objc_release_zip.sh old mode 100644 new mode 100755 diff --git a/Scripts/generate_package_manifest.sh b/Scripts/generate_package_manifest.sh old mode 100644 new mode 100755 diff --git a/Scripts/generate_swift_release_zip.sh b/Scripts/generate_swift_release_zip.sh old mode 100644 new mode 100755 diff --git a/Scripts/remove_private_headers.sh b/Scripts/remove_private_headers.sh deleted file mode 100755 index a09faf717..000000000 --- a/Scripts/remove_private_headers.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -set -e - -FRAMEWORK_DIR=${TARGET_BUILD_DIR}/${PRODUCT_NAME}${WRAPPER_SUFFIX} -MODULE_MAP_FILE=${FRAMEWORK_DIR}/Modules/module.modulemap - -# Remove private headers from module.modulemap file: -perl -i -0pe "s/module Private {[\s\S]*?}/module Private { }/" "${MODULE_MAP_FILE}" - -# Remove PrivateHeaders folder: -rm -rf "${FRAMEWORK_DIR}/PrivateHeaders" diff --git a/Scripts/strip_frameworks.sh b/Scripts/strip_frameworks.sh old mode 100644 new mode 100755 diff --git a/Swift/CouchbaseLiteSwift-EE.modulemap b/Swift/CouchbaseLiteSwift-EE.modulemap deleted file mode 100644 index a092f7bfb..000000000 --- a/Swift/CouchbaseLiteSwift-EE.modulemap +++ /dev/null @@ -1,152 +0,0 @@ -// -// CouchbaseLiteSwift.modulemap -// CouchbaseLite -// -// Copyright (c) 2017 Couchbase, Inc All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -framework module CouchbaseLiteSwift { - umbrella header "CouchbaseLiteSwift.h" - - export * - module * { export * } - - module Private { - // CouchbaseLite.h: - header "CBLArray.h" - header "CBLArrayFragment.h" - header "CBLAuthenticator.h" - header "CBLBasicAuthenticator.h" - header "CBLBlob.h" - header "CBLCollection.h" - header "CBLCollectionChange.h" - header "CBLCollectionChangeObservable.h" - header "CBLCollectionConfiguration.h" - header "CBLConflict.h" - header "CBLConflictResolver.h" - header "CBLConsoleLogger.h" - header "CBLDatabase.h" - header "CBLDatabaseChange.h" - header "CBLDatabaseConfiguration.h" - header "CBLDictionary.h" - header "CBLDictionaryFragment.h" - header "CBLDocument.h" - header "CBLDocumentChange.h" - header "CBLDocumentFlags.h" - header "CBLDocumentFragment.h" - header "CBLDocumentReplication.h" - header "CBLEndpoint.h" - header "CBLErrors.h" - header "CBLFileLogger.h" - header "CBLFragment.h" - header "CBLFullTextIndex.h" - header "CBLFullTextIndexConfiguration.h" - header "CBLIndex.h" - header "CBLIndexable.h" - header "CBLIndexBuilder.h" - header "CBLIndexConfiguration.h" - header "CBLListenerToken.h" - header "CBLLog.h" - header "CBLLogFileConfiguration.h" - header "CBLLogger.h" - header "CBLQueryChange.h" - header "CBLMutableArray.h" - header "CBLMutableArrayFragment.h" - header "CBLMutableDictionary.h" - header "CBLMutableDictionaryFragment.h" - header "CBLMutableDocument.h" - header "CBLMutableFragment.h" - header "CBLNewDictionary.h" - header "CBLQuery.h" - header "CBLQuery+JSON.h" - header "CBLQueryArrayExpression.h" - header "CBLQueryArrayFunction.h" - header "CBLQueryBuilder.h" - header "CBLQueryCollation.h" - header "CBLQueryDataSource.h" - header "CBLQueryExpression.h" - header "CBLQueryFactory.h" - header "CBLQueryFunction.h" - header "CBLQueryFullTextExpression.h" - header "CBLQueryFullTextFunction.h" - header "CBLQueryJoin.h" - header "CBLQueryLimit.h" - header "CBLQueryMeta.h" - header "CBLQueryOrdering.h" - header "CBLQueryParameters.h" - header "CBLQueryResult.h" - header "CBLQueryResultSet.h" - header "CBLQuerySelectResult.h" - header "CBLQueryVariableExpression.h" - header "CBLReplicator.h" - header "CBLReplicatorChange.h" - header "CBLReplicatorConfiguration.h" - header "CBLReplicatorTypes.h" - header "CBLScope.h" - header "CBLSessionAuthenticator.h" - header "CBLURLEndpoint.h" - header "CBLValueIndex.h" - header "CBLValueIndexConfiguration.h" - header "CBLCollectionTypes.h" - header "CBLDefaults.h" - header "CBLQueryFullTextIndexExpressionProtocol.h" - - // Internal - header "CBLQueryFullTextIndexExpression.h" - - // Swift Extensions: - header "CBLArray+Swift.h" - header "CBLBlob+Swift.h" - header "CBLCollection+Swift.h" - header "CBLDatabase+Swift.h" - header "CBLDictionary+Swift.h" - header "CBLLog+Swift.h" - header "CBLReplicatorConfiguration+Swift.h" - header "CBLConflictResolverBridge.h" - header "CBLCollectionConfiguration+Swift.h" - - // Enterprise: - header "CBLClientCertificateAuthenticator.h" - header "CBLCoreMLPredictiveModel.h" - header "CBLDatabaseConfiguration+Encryption.h" - header "CBLDatabaseEndpoint.h" - header "CBLDatabase+Encryption.h" - header "CBLDatabase+Prediction.h" - header "CBLEncryptionKey.h" - header "CBLIndexBuilder+Prediction.h" - header "CBLListenerAuthenticator.h" - header "CBLListenerCertificateAuthenticator.h" - header "CBLListenerPasswordAuthenticator.h" - header "CBLMessage.h" - header "CBLMessageEndpoint.h" - header "CBLMessageEndpointConnection.h" - header "CBLMessageEndpointListener.h" - header "CBLMessagingError.h" - header "CBLPrediction.h" - header "CBLPrediction+Swift.h" - header "CBLPredictiveIndex.h" - header "CBLProtocolType.h" - header "CBLQueryFunction+Prediction.h" - header "CBLQueryFunction+Vector.h" - header "CBLReplicatorConfiguration+ServerCert.h" - header "CBLTLSIdentity.h" - header "CBLURLEndpointListener.h" - header "CBLURLEndpointListenerConfiguration.h" - - // Enterprise Swift Extensions: - header "CBLTLSIdentity+Swift.h" - header "CBLURLEndpointListener+Swift.h" - } -} diff --git a/Swift/CouchbaseLiteSwift.modulemap b/Swift/CouchbaseLiteSwift.modulemap deleted file mode 100644 index 04c398941..000000000 --- a/Swift/CouchbaseLiteSwift.modulemap +++ /dev/null @@ -1,120 +0,0 @@ -// -// CouchbaseLiteSwift.modulemap -// CouchbaseLite -// -// Copyright (c) 2017 Couchbase, Inc All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -framework module CouchbaseLiteSwift { - umbrella header "CouchbaseLiteSwift.h" - - export * - module * { export * } - - module Private { - // CouchbaseLite.h: - header "CBLArray.h" - header "CBLArrayFragment.h" - header "CBLAuthenticator.h" - header "CBLBasicAuthenticator.h" - header "CBLBlob.h" - header "CBLCollection.h" - header "CBLCollectionChange.h" - header "CBLCollectionChangeObservable.h" - header "CBLCollectionConfiguration.h" - header "CBLConflict.h" - header "CBLConflictResolver.h" - header "CBLConsoleLogger.h" - header "CBLDatabase.h" - header "CBLDatabaseChange.h" - header "CBLDatabaseConfiguration.h" - header "CBLDictionary.h" - header "CBLDictionaryFragment.h" - header "CBLDocument.h" - header "CBLDocumentChange.h" - header "CBLDocumentFlags.h" - header "CBLDocumentFragment.h" - header "CBLDocumentReplication.h" - header "CBLEndpoint.h" - header "CBLErrors.h" - header "CBLFileLogger.h" - header "CBLFragment.h" - header "CBLFullTextIndex.h" - header "CBLFullTextIndexConfiguration.h" - header "CBLIndex.h" - header "CBLIndexable.h" - header "CBLIndexBuilder.h" - header "CBLIndexConfiguration.h" - header "CBLListenerToken.h" - header "CBLLog.h" - header "CBLLogFileConfiguration.h" - header "CBLLogger.h" - header "CBLQueryChange.h" - header "CBLMutableArray.h" - header "CBLMutableArrayFragment.h" - header "CBLMutableDictionary.h" - header "CBLMutableDictionaryFragment.h" - header "CBLMutableDocument.h" - header "CBLMutableFragment.h" - header "CBLNewDictionary.h" - header "CBLQuery.h" - header "CBLQuery+JSON.h" - header "CBLQueryArrayExpression.h" - header "CBLQueryArrayFunction.h" - header "CBLQueryBuilder.h" - header "CBLQueryCollation.h" - header "CBLQueryDataSource.h" - header "CBLQueryExpression.h" - header "CBLQueryFactory.h" - header "CBLQueryFunction.h" - header "CBLQueryFullTextExpression.h" - header "CBLQueryFullTextFunction.h" - header "CBLQueryJoin.h" - header "CBLQueryLimit.h" - header "CBLQueryMeta.h" - header "CBLQueryOrdering.h" - header "CBLQueryParameters.h" - header "CBLQueryResult.h" - header "CBLQueryResultSet.h" - header "CBLQuerySelectResult.h" - header "CBLQueryVariableExpression.h" - header "CBLReplicator.h" - header "CBLReplicatorChange.h" - header "CBLReplicatorConfiguration.h" - header "CBLReplicatorTypes.h" - header "CBLScope.h" - header "CBLSessionAuthenticator.h" - header "CBLURLEndpoint.h" - header "CBLValueIndex.h" - header "CBLValueIndexConfiguration.h" - header "CBLCollectionTypes.h" - header "CBLDefaults.h" - header "CBLQueryFullTextIndexExpressionProtocol.h" - - // Internal - header "CBLQueryFullTextIndexExpression.h" - - // Swift Extensions: - header "CBLArray+Swift.h" - header "CBLBlob+Swift.h" - header "CBLCollection+Swift.h" - header "CBLDatabase+Swift.h" - header "CBLDictionary+Swift.h" - header "CBLLog+Swift.h" - header "CBLReplicatorConfiguration+Swift.h" - header "CBLConflictResolverBridge.h" - header "CBLCollectionConfiguration+Swift.h" - } -} diff --git a/Swift/CouchbaseLiteSwift.private.modulemap b/Swift/CouchbaseLiteSwift.private.modulemap new file mode 100644 index 000000000..95bf9e262 --- /dev/null +++ b/Swift/CouchbaseLiteSwift.private.modulemap @@ -0,0 +1,112 @@ +// +// CouchbaseLiteSwift.private.modulemap +// CouchbaseLite +// +// Copyright (c) 2024 Couchbase, Inc All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +framework module CouchbaseLiteSwift_Private { + header "CBLArray.h" + header "CBLArrayFragment.h" + header "CBLAuthenticator.h" + header "CBLBasicAuthenticator.h" + header "CBLBlob.h" + header "CBLCollection.h" + header "CBLCollectionChange.h" + header "CBLCollectionChangeObservable.h" + header "CBLCollectionConfiguration.h" + header "CBLConflict.h" + header "CBLConflictResolver.h" + header "CBLConsoleLogger.h" + header "CBLDatabase.h" + header "CBLDatabaseChange.h" + header "CBLDatabaseConfiguration.h" + header "CBLDictionary.h" + header "CBLDictionaryFragment.h" + header "CBLDocument.h" + header "CBLDocumentChange.h" + header "CBLDocumentFlags.h" + header "CBLDocumentFragment.h" + header "CBLDocumentReplication.h" + header "CBLEndpoint.h" + header "CBLErrors.h" + header "CBLFileLogger.h" + header "CBLFragment.h" + header "CBLFullTextIndex.h" + header "CBLFullTextIndexConfiguration.h" + header "CBLIndex.h" + header "CBLIndexable.h" + header "CBLIndexBuilder.h" + header "CBLIndexConfiguration.h" + header "CBLListenerToken.h" + header "CBLLog.h" + header "CBLLogFileConfiguration.h" + header "CBLLogger.h" + header "CBLQueryChange.h" + header "CBLMutableArray.h" + header "CBLMutableArrayFragment.h" + header "CBLMutableDictionary.h" + header "CBLMutableDictionaryFragment.h" + header "CBLMutableDocument.h" + header "CBLMutableFragment.h" + header "CBLNewDictionary.h" + header "CBLQuery.h" + header "CBLQuery+JSON.h" + header "CBLQueryArrayExpression.h" + header "CBLQueryArrayFunction.h" + header "CBLQueryBuilder.h" + header "CBLQueryCollation.h" + header "CBLQueryDataSource.h" + header "CBLQueryExpression.h" + header "CBLQueryFactory.h" + header "CBLQueryFunction.h" + header "CBLQueryFullTextExpression.h" + header "CBLQueryFullTextFunction.h" + header "CBLQueryJoin.h" + header "CBLQueryLimit.h" + header "CBLQueryMeta.h" + header "CBLQueryOrdering.h" + header "CBLQueryParameters.h" + header "CBLQueryResult.h" + header "CBLQueryResultSet.h" + header "CBLQuerySelectResult.h" + header "CBLQueryVariableExpression.h" + header "CBLReplicator.h" + header "CBLReplicatorChange.h" + header "CBLReplicatorConfiguration.h" + header "CBLReplicatorTypes.h" + header "CBLScope.h" + header "CBLSessionAuthenticator.h" + header "CBLURLEndpoint.h" + header "CBLValueIndex.h" + header "CBLValueIndexConfiguration.h" + header "CBLCollectionTypes.h" + header "CBLDefaults.h" + header "CBLQueryFullTextIndexExpressionProtocol.h" + + // Internal + header "CBLQueryFullTextIndexExpression.h" + + // Swift Extensions: + header "CBLArray+Swift.h" + header "CBLBlob+Swift.h" + header "CBLCollection+Swift.h" + header "CBLDatabase+Swift.h" + header "CBLDictionary+Swift.h" + header "CBLLog+Swift.h" + header "CBLReplicatorConfiguration+Swift.h" + header "CBLConflictResolverBridge.h" + header "CBLCollectionConfiguration+Swift.h" +} diff --git a/xcconfigs/CBL Swift.xcconfig b/xcconfigs/CBL Swift.xcconfig index 77f940402..487ce8ce8 100644 --- a/xcconfigs/CBL Swift.xcconfig +++ b/xcconfigs/CBL Swift.xcconfig @@ -22,4 +22,4 @@ INFOPLIST_FILE = Swift/Info.plist PRODUCT_BUNDLE_IDENTIFIER = com.couchbase.CouchbaseLiteSwift PRODUCT_NAME = CouchbaseLiteSwift -MODULEMAP_FILE = $(CBL_SWIFT_MODULEMAP_FILE) +MODULEMAP_PRIVATE_FILE = $(CBL_SWIFT_PRIVATE_MODULEMAP_FILE) diff --git a/xcconfigs/Project.xcconfig b/xcconfigs/Project.xcconfig index fe70f0ff9..dca5e89b6 100644 --- a/xcconfigs/Project.xcconfig +++ b/xcconfigs/Project.xcconfig @@ -20,7 +20,7 @@ CBL_VERSION_STRING = 3.2.0 CBL_BUILD_NUMBER = 0 CBL_EXPORTED_SYMBOLS_FILE = Objective-C/CouchbaseLite.exp -CBL_SWIFT_MODULEMAP_FILE = Swift/CouchbaseLiteSwift.modulemap +CBL_SWIFT_PRIVATE_MODULEMAP_FILE = Swift/CouchbaseLiteSwift.private.modulemap CBL_COPYRIGHT_YEAR = 2021 IPHONEOS_DEPLOYMENT_TARGET = 11.0 diff --git a/xcconfigs/Project_Debug_EE.xcconfig b/xcconfigs/Project_Debug_EE.xcconfig index 3bea6a29c..7d3c7fb18 100644 --- a/xcconfigs/Project_Debug_EE.xcconfig +++ b/xcconfigs/Project_Debug_EE.xcconfig @@ -7,7 +7,8 @@ #include "Project_Debug.xcconfig" -CBL_SWIFT_MODULEMAP_FILE = Swift/CouchbaseLiteSwift-EE.modulemap +CBL_SWIFT_PRIVATE_MODULEMAP_FILE = ../Sources/Swift/CouchbaseLiteSwift.private.modulemap GCC_PREPROCESSOR_DEFINITIONS = ${GCC_PREPROCESSOR_DEFINITIONS_DEF} COUCHBASE_ENTERPRISE OTHER_SWIFT_FLAGS = -DCOUCHBASE_ENTERPRISE +SWIFT_ACTIVE_COMPILATION_CONDITIONS = COUCHBASE_ENTERPRISE diff --git a/xcconfigs/Project_Release_EE.xcconfig b/xcconfigs/Project_Release_EE.xcconfig index 36fc08b7d..1d9981163 100644 --- a/xcconfigs/Project_Release_EE.xcconfig +++ b/xcconfigs/Project_Release_EE.xcconfig @@ -7,9 +7,10 @@ #include "Project_Release.xcconfig" CBL_EXPORTED_SYMBOLS_FILE = ../Sources/Objective-C/CouchbaseLite.exp -CBL_SWIFT_MODULEMAP_FILE = Swift/CouchbaseLiteSwift-EE.modulemap +CBL_SWIFT_PRIVATE_MODULEMAP_FILE = ../Sources/Swift/CouchbaseLiteSwift.private.modulemap GCC_PREPROCESSOR_DEFINITIONS = ${GCC_PREPROCESSOR_DEFINITIONS_DEF} COUCHBASE_ENTERPRISE OTHER_SWIFT_FLAGS = -DCOUCHBASE_ENTERPRISE +SWIFT_ACTIVE_COMPILATION_CONDITIONS = COUCHBASE_ENTERPRISE BUILD_LIBRARY_FOR_DISTRIBUTION = YES