I'm trying to set a project which is a framework that has its own module map file. The example I'm working with can be found at gitlab.com/gabriellievano/earlgrey-tuist (the module map-file-issue
branch shows the issue. main
has a workaround).
Here's the target spec:
.target(
name: "AppFramework",
destinations: .iOS,
product: .framework,
bundleId: "com.google.earlgrey.CommonLib",
infoPlist: .file(path: .relativeToRoot("Vendor/EarlGrey/EarlGrey/AppFramework/Info.plist")),
sources: [
"EarlGrey/AppFramework/**/*.m",
"EarlGrey/third_party/**/*.c",
],
headers: .headers(
public: [
"EarlGrey/CommonLib/GREYConstants.h",
"EarlGrey/CommonLib/Error/GREYError.h",
"EarlGrey/CommonLib/Error/GREYErrorConstants.h",
],
project: [
"EarlGrey/AppFramework/**/*.h",
"EarlGrey/third_party/fishhook/fishhook.h",
]
),
scripts: [
.post(
script: "sh EarlGrey/Scripts/build_universal_framework.sh",
name: "Run script",
runForInstallBuildsOnly: true
),
],
dependencies: [
.project(target: "ChannelLib", path: .relativeToRoot("Vendor/EarlGrey/eDistantObject")),
.project(target: "DeviceLib", path: .relativeToRoot("Vendor/EarlGrey/eDistantObject")),
.project(target: "MeasureLib", path: .relativeToRoot("Vendor/EarlGrey/eDistantObject")),
.target(name: "CommonLib"),
.target(name: "UILib"),
.sdk(name: "IOKit", type: .framework, status: .required),
],
settings: .settings(
base: .targetBase()
.currentProjectVersion("1")
.definesModule(true)
.dylibCompatibilityVersion("1")
.dylibCurrentVersion("1")
.dylibInstallNameBase("@rpath")
.headerSearchPaths([
"EarlGrey/Submodules/eDistantObject/**",
"EarlGrey/Submodules/fishhook/",
"EarlGrey/",
"EarlGrey/TestLib/**",
])
.moduleMapFile("$(PROJECT_DIR)/EarlGrey/AppFramework/AppFramework.modulemap")
.otherLinkerFlags(["-ObjC"])
.productNameIsTargetName()
.merging([
"VERSIONING_SYSTEM": "apple-generic",
"VERSION_INFO_PREFIX": "",
])
)
),
In this example, moduleMapFile(_ path)
will merge the MODULEMAP_FILE
setting. i.e.:
public func moduleMapFile(_ path: String) -> SettingsDictionary {
return merging([
"MODULEMAP_FILE": .string(path),
])
}
Despite this, when generating the project, MODULEMAP_FILE
will be empty for the AppFramework
target, and both OTHER_CFLAGS
and OTHER_CPLUSPLUSFLAGS
remain unchanged from the set value (which in this case it's inherited from the project settings, -fobjc-arc -fobjc-arc-exceptions
).
Either MODULEMAP_FILE
or the -fmodule_map_file
flag should be set to allow custom module maps.
git clone -b modulemap-file-issue https://gitlab.com/gabriellievano/earlgrey-tuist
git submodule update --init
cd Vendor/EarlGrey/EarlGrey
sh Scripts/download_deps.sh
cd ../../..
mise install tuist
mise x -- tuist install
mise x -- tuist generate
Open Xcode project and view build settings for AppFramework
(in Vendor/EarlGrey project). There will be no module map path assigned to either MODULEMAP_FILE
nor -fmodule_map_file
flag.
There's no error
14.5
Verified in 4.5.1 and 4.23.0
15.4
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too