Xcode 10,源代码 &swiftlint 构建阶段顺序 [英] Xcode 10, sourcery & swiftlint build phases order
问题描述
更新到 Xcode 10 后,初始项目配置存在一些问题.步骤如下:
- 使用
这在 Xcode 9 中运行良好,但显然,它在 Xcode 10 构建系统下不起作用.问题是如果我下载存储库(
<块引用>.generated
文件不是存储库的一部分).然后点击build
它将显示如下结果:...使用 '.sourcery.yml' 中的配置文件正在扫描来源...找到 239 种类型.正在加载模板...加载了 9 个模板.正在生成代码...完成的.处理时间 0.491948962211609 秒...
所以 sourcery 工作正常,然后 linting:
<块引用>检查FromResponse.generated.swift"(1/186)
工作正常以及过程,但最终,构建将失败:
<块引用>错误:找不到构建输入文件:'/path/Generated/FromResponse.generated.swift',...
所以这很奇怪,因为文件实际上存在并且根据构建设置文件应该在生成它们之后编译.那么我应该如何在构建过程中处理 Sourcery?
解决方案我们能够以与此 Github 问题类似的方式修复"此问题:
After updating to Xcode 10 there are some issues with initial project configurations. The steps look like this:
And configuration works like this:
And this was working fine in Xcode 9, but apparently, it's not working under Xcode 10 build system. The issue is if I download repository (
.generated
files are not a part of the repository). And hitbuild
it will show me results like:... Using configuration file at '.sourcery.yml' Scanning sources... Found 239 types. Loading templates... Loaded 9 templates. Generating code... Finished. Processing time 0.491948962211609 seconds ...
So sourcery works ok, then linting:
Linting 'FromResponse.generated.swift' (1/186)
Works fine as well as a process, but in the end, build will fail with:
error: Build input files cannot be found: '/path/Generated/FromResponse.generated.swift', ...
So it's strange since a files are physically there and according to build settings file should be compiled later than generating them. How should I approach sourcery in build process then?
解决方案We are able to "fix" this in a similar way as this Github issue:
https://github.com/mac-cain13/R.swift/issues/438#issuecomment-416982928
We have to add each of the generated files by Sourcery to the output folder and it will get picked up by the Xcode correctly.
这篇关于Xcode 10,源代码 &swiftlint 构建阶段顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!