Compare commits

...

20 Commits

Author SHA1 Message Date
Bartosz Polaczyk ddeffe75d6 Merge pull request #130 from polac24/irrelevant-dependency
Add irrelevant dependencies property
2022-05-11 08:59:32 +02:00
Bartosz Polaczyk 181997e3d2 Test fix 2022-05-11 08:37:01 +02:00
Bartosz Polaczyk 1d6ac2c171 Apply reviewer suggestions 2022-05-11 08:30:10 +02:00
Bartosz Polaczyk 3dfd6e296f Typo cleanup 2022-05-10 21:31:34 +02:00
Bartosz Polaczyk c39b286222 Fix swiftlint 2022-05-10 13:15:22 +02:00
Bartosz Polaczyk a55a4547ac Add skipped dependencies regex 2022-05-10 12:58:19 +02:00
Bartosz Polaczyk 51c2007c5b Merge pull request #129 from polac24/docs
Generate gh-pages docs using docc
2022-05-09 09:22:08 +02:00
Bartosz Polaczyk fc092fc4e3 Merge pull request #128 from zzzworm/master
cocoapods plugin support custom FAKE_SRCROOT
2022-05-08 10:55:55 +02:00
Bartosz Polaczyk 3f9596f6e6 Bump to Xcode 13.3.1 2022-05-07 18:00:43 +02:00
Bartosz Polaczyk 15f4ee7eab Generate gh-pages docs using docc 2022-05-07 17:55:26 +02:00
zhouchanghong a6325db0a5 [Docs] add fake_src_root doc for cocoapods plugin 2022-05-07 19:47:11 +08:00
zhouchanghong cfa4fbd070 cocoapods plugin support custom FAKE_SRCROOT 2022-05-07 19:40:10 +08:00
Bartosz Polaczyk c573ced4f4 Add irrelevant_dependencies_paths property 2022-05-07 09:29:20 +02:00
Bartosz Polaczyk 0c2afc15fc Merge pull request #125 from ainopara/master
Fix xcode preview compile issue
2022-04-27 17:48:06 +02:00
ainopara 586e8df56e Fix xcode preview compile issue
When SWIFT_EXEC and LD is setted in a terget, files in the taget can not be previewed due to compile failure which is caused by missing argument.
2022-04-26 19:20:09 +08:00
Bartosz Polaczyk ef3a88c6ec Merge pull request #122 from polac24/20220418-derived
Fix building target dependencies list with custom DERIVED_FILE_DIR
2022-04-19 09:32:43 +02:00
Bartosz Polaczyk 95f95be29e Identify custom DerivedData under sources dir 2022-04-18 09:07:36 +02:00
Bartosz Polaczyk 4d12800096 Skip all DerivedData files in dependencies list 2022-04-18 09:04:17 +02:00
Bartosz Polaczyk fbb456b0e0 Merge pull request #121 from cezarsignori/csignori/rc_derived_files_dir
Set auto-generated Swift header under DERIVED_FILES_DIR as irrelevant dependency
2022-04-18 08:57:44 +02:00
Cezar Signori a321ea3362 Set auto-generated Swift header under DERIVED_FILES_DIR as irrelevant dependency 2022-04-14 14:20:30 +02:00
19 changed files with 225 additions and 33 deletions
+2 -2
View File
@@ -13,9 +13,9 @@ jobs:
args: --strict
macOS:
runs-on: macOS-latest
runs-on: macos-12
env:
XCODE_VERSION: ${{ '13.1' }}
XCODE_VERSION: ${{ '13.3.1' }}
steps:
- name: Select Xcode
run: "sudo xcode-select -s /Applications/Xcode_$XCODE_VERSION.app"
+24
View File
@@ -0,0 +1,24 @@
name: Docs
on:
push:
branches:
- master
jobs:
docs:
runs-on: macos-12
env:
XCODE_VERSION: ${{ '13.3.1' }}
steps:
- uses: actions/checkout@v2
- name: Select Xcode
run: "sudo xcode-select -s /Applications/Xcode_$XCODE_VERSION.app"
- name: "Generate documentation"
run: "swift package --allow-writing-to-directory ./docs generate-documentation --target XCRemoteCache --disable-indexing --transform-for-static-hosting --output-path ./docs --hosting-base-path XCRemoteCache/"
- name: Deploy GH-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
keep_files: false
+2 -2
View File
@@ -6,9 +6,9 @@ on:
jobs:
macOS:
name: Add macOS binaries to release
runs-on: macOS-latest
runs-on: macos-12
env:
XCODE_VERSION: ${{ '13.1' }}
XCODE_VERSION: ${{ '13.3.1' }}
steps:
- name: Select Xcode
run: "sudo xcode-select -s /Applications/Xcode_$XCODE_VERSION.app"
+9
View File
@@ -37,6 +37,15 @@
"version": "0.0.5"
}
},
{
"package": "SwiftDocCPlugin",
"repositoryURL": "https://github.com/apple/swift-docc-plugin",
"state": {
"branch": null,
"revision": "3303b164430d9a7055ba484c8ead67a52f7b74f6",
"version": "1.0.0"
}
},
{
"package": "XcodeProj",
"repositoryURL": "https://github.com/tuist/XcodeProj.git",
+1
View File
@@ -17,6 +17,7 @@ let package = Package(
.package(url: "https://github.com/jpsim/Yams.git", from: "5.0.0"),
.package(url: "https://github.com/apple/swift-argument-parser", from: "0.0.1"),
.package(url: "https://github.com/tuist/XcodeProj.git", from: "8.7.1"),
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
],
targets: [
.target(
+2
View File
@@ -8,6 +8,7 @@ _XCRemoteCache is a remote cache tool for Xcode projects. It reuses target artif
[![Build Status](https://github.com/spotify/XCRemoteCache/workflows/CI/badge.svg)](https://github.com/spotify/XCRemoteCache/workflows/CI/badge.svg)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
[![Slack](https://slackin.spotify.com/badge.svg)](https://slackin.spotify.com)
[![Docs](https://spotify.github.io/XCRemoteCache/documentation/xcremotecache/)](https://github.com/spotify/XCRemoteCache/workflows/Docs/badge.svg)
- [How and Why?](#how-and-why)
* [Accurate target input files](#accurate-target-input-files)
@@ -315,6 +316,7 @@ _Note that for the `producer` mode, the prebuild build phase and `xccc`, `xcld`,
| `disable_certificate_verification` | A Boolean value that opts-in SSL certificate validation is disabled | `false` | ⬜️ |
| `disable_vfs_overlay` | A feature flag to disable virtual file system overlay support (temporary) | `false` | ⬜️ |
| `custom_rewrite_envs` | A list of extra ENVs that should be used as placeholders in the dependency list. ENV rewrite process is optimistic - does nothing if an ENV is not defined in the pre/postbuild process. | `[]` | ⬜️ |
| `irrelevant_dependencies_paths` | Regexes of files that should not be included in a list of dependencies. Warning! Add entries here with caution - excluding dependencies that are relevant might lead to a target overcaching. The regex can match either partially or fully the filepath, e.g. `\\.modulemap$` will exclude all `.modulemap` files. | `[]` | ⬜️ |
## Backend cache server
@@ -40,6 +40,7 @@ public struct PostbuildContext {
var mode: Mode
var targetName: String
var targetTempDir: URL
var derivedFilesDir: URL
/// Location where all compilation outputs (.o) are placed
var compilationTempDir: URL
var configuration: String
@@ -82,6 +83,8 @@ public struct PostbuildContext {
/// location of the json file that define virtual files system overlay
/// (mappings of the virtual location file -> local file path)
let overlayHeadersPath: URL
/// Regexes of files that should not be included in the dependency list
let irrelevantDependenciesPaths: [String]
}
extension PostbuildContext {
@@ -91,6 +94,7 @@ extension PostbuildContext {
let targetNameValue: String = try env.readEnv(key: "TARGET_NAME")
targetName = targetNameValue
targetTempDir = try env.readEnv(key: "TARGET_TEMP_DIR")
derivedFilesDir = try env.readEnv(key: "DERIVED_FILE_DIR")
let archs: [String] = try env.readEnv(key: "ARCHS").split(separator: " ").map(String.init)
guard let firstArch = archs.first, !firstArch.isEmpty else {
throw PostbuildContextError.missingArchitecture
@@ -133,5 +137,6 @@ extension PostbuildContext {
modeMarkerPath = config.modeMarkerPath
/// Note: The file has yaml extension, even it is in the json format
overlayHeadersPath = targetTempDir.appendingPathComponent("all-product-headers.yaml")
irrelevantDependenciesPaths = config.irrelevantDependenciesPaths
}
}
@@ -171,7 +171,9 @@ public class XCPostbuild {
product: context.productsDir,
source: context.srcRoot,
intermediate: context.targetTempDir,
bundle: context.bundleDir
derivedFiles: context.derivedFilesDir,
bundle: context.bundleDir,
skippedRegexes: context.irrelevantDependenciesPaths
)
// Override fingerprints for all produced '.swiftmodule' files
let fingerprintOverrideManager = FingerprintOverrideManagerImpl(
@@ -138,6 +138,11 @@ public struct XCRemoteCacheConfig: Encodable {
/// A list of extra ENVs that should be used as placeholders in the dependency list
/// ENV rewrite process is optimistic - does nothing if an ENV is not defined in the pre/postbuild process
var customRewriteEnvs: [String] = []
/// Regexes of files that should not be included in a list of dependencies. Warning! Add entries here
/// with caution - excluding dependencies that are relevant might lead to a target overcaching
/// Note: The regex can match either partially or fully the filepath, e.g. `\\.modulemap$` will exclude
/// all `.modulemap` files
var irrelevantDependenciesPaths: [String] = []
}
extension XCRemoteCacheConfig {
@@ -193,6 +198,7 @@ extension XCRemoteCacheConfig {
merge.disableCertificateVerification = scheme.disableCertificateVerification ?? disableCertificateVerification
merge.disableVFSOverlay = scheme.disableVFSOverlay ?? disableVFSOverlay
merge.customRewriteEnvs = scheme.customRewriteEnvs ?? customRewriteEnvs
merge.irrelevantDependenciesPaths = scheme.irrelevantDependenciesPaths ?? irrelevantDependenciesPaths
return merge
}
@@ -257,6 +263,7 @@ struct ConfigFileScheme: Decodable {
let disableCertificateVerification: Bool?
let disableVFSOverlay: Bool?
let customRewriteEnvs: [String]?
let irrelevantDependenciesPaths: [String]?
// Yams library doesn't support encoding strategy, see https://github.com/jpsim/Yams/issues/84
enum CodingKeys: String, CodingKey {
@@ -304,6 +311,7 @@ struct ConfigFileScheme: Decodable {
case disableCertificateVerification = "disable_certificate_verification"
case disableVFSOverlay = "disable_vfs_overlay"
case customRewriteEnvs = "custom_rewrite_envs"
case irrelevantDependenciesPaths = "irrelevant_dependencies_paths"
}
}
@@ -27,8 +27,11 @@ public struct Dependency: Equatable {
case source
case fingerprint
case intermediate
case derivedFile
// Product of the target itself
case ownProduct
// User-excluded path
case userExcluded
case unknown
}
@@ -55,14 +58,18 @@ class DependencyProcessorImpl: DependencyProcessor {
private let productPath: String
private let sourcePath: String
private let intermediatePath: String
private let derivedFilesPath: String
private let bundlePath: String?
private let skippedRegexes: [String]
init(xcode: URL, product: URL, source: URL, intermediate: URL, bundle: URL?) {
init(xcode: URL, product: URL, source: URL, intermediate: URL, derivedFiles: URL, bundle: URL?, skippedRegexes: [String]) {
xcodePath = xcode.path.dirPath()
productPath = product.path.dirPath()
sourcePath = source.path.dirPath()
intermediatePath = intermediate.path.dirPath()
derivedFilesPath = derivedFiles.path.dirPath()
bundlePath = bundle?.path.dirPath()
self.skippedRegexes = skippedRegexes
}
func process(_ files: [URL]) -> [Dependency] {
@@ -73,10 +80,14 @@ class DependencyProcessorImpl: DependencyProcessor {
private func classify(_ files: [URL]) -> [Dependency] {
return files.map { file -> Dependency in
let filePath = file.resolvingSymlinksInPath().path
if filePath.hasPrefix(xcodePath) {
if skippedRegexes.contains(where: { filePath.range(of: $0, options: .regularExpression) != nil }) {
return Dependency(url: file, type: .userExcluded)
} else if filePath.hasPrefix(xcodePath) {
return Dependency(url: file, type: .xcode)
} else if filePath.hasPrefix(intermediatePath) {
return Dependency(url: file, type: .intermediate)
} else if filePath.hasPrefix(derivedFilesPath) {
return Dependency(url: file, type: .derivedFile)
} else if let bundle = bundlePath, filePath.hasPrefix(bundle) {
// If a target produces a bundle, explicitly classify all
// of products to distinguish from other targets products
@@ -107,7 +118,12 @@ class DependencyProcessorImpl: DependencyProcessor {
// - All files in `*/Interemediates/*` - this file are created on-fly for a given target
// - Some files may depend on its own product (e.g. .m may #include *-Swift.h) - we know products will match
// because in case of a hit, these will be taken from the artifact
let irrelevantDependenciesType: [Dependency.Kind] = [.xcode, .intermediate, .ownProduct]
// - Customized DERIVED_FILE_DIR may change a directory of
// derived files, which by default is under `*/Interemediates`
// - User-specified (in .rcinfo) files to exclude
let irrelevantDependenciesType: [Dependency.Kind] = [
.xcode, .intermediate, .ownProduct, .derivedFile, .userExcluded,
]
return !irrelevantDependenciesType.contains(dependency.type)
}
}
+10 -1
View File
@@ -48,7 +48,16 @@ public class XCLDMain {
i += 1
}
guard let outputInput = output, let filelistInput = filelist, let dependencyInfoInput = dependencyInfo else {
exit(1, "Missing 'output' argument. Args: \(args)")
let ldCommand = "clang"
print("Fallbacking to compilation using \(ldCommand).")
let args = ProcessInfo().arguments
let paramList = [ldCommand] + args.dropFirst()
let cargs = paramList.map { strdup($0) } + [nil]
execvp(ldCommand, cargs)
/// C-function `execv` returns only when the command fails
exit(1)
}
+10 -2
View File
@@ -60,8 +60,16 @@ public class XCSwiftcMain {
let targetInputInput = target,
let swiftFileListInput = swiftFileList
else {
print("Missing argument. Args: \(args)")
exit(1)
let swiftcCommand = "swiftc"
print("Fallbacking to compilation using \(swiftcCommand).")
let args = ProcessInfo().arguments
let paramList = [swiftcCommand] + args.dropFirst()
let cargs = paramList.map { strdup($0) } + [nil]
execvp(swiftcCommand, cargs)
/// C-function `execv` returns only when the command fails
exit(1)
}
let swiftcArgsInput = SwiftcArgInput(
objcHeaderOutput: objcHeaderOutputInput,
@@ -26,6 +26,7 @@ class PostbuildContextTests: FileXCTestCase {
private static let SampleEnvs = [
"TARGET_NAME": "TARGET_NAME",
"TARGET_TEMP_DIR": "TARGET_TEMP_DIR",
"DERIVED_FILE_DIR": "DERIVED_FILE_DIR",
"ARCHS": "x86_64",
"OBJECT_FILE_DIR_normal": "/OBJECT_FILE_DIR_normal" ,
"CONFIGURATION": "CONFIGURATION",
@@ -27,6 +27,7 @@ class PostbuildTests: FileXCTestCase {
mode: .producer,
targetName: "",
targetTempDir: "",
derivedFilesDir: "",
compilationTempDir: "",
configuration: "",
platform: "",
@@ -53,7 +54,8 @@ class PostbuildTests: FileXCTestCase {
thinnedTargets: [],
action: .build,
modeMarkerPath: "",
overlayHeadersPath: ""
overlayHeadersPath: "",
irrelevantDependenciesPaths: []
)
private var network = RemoteNetworkClientImpl(
NetworkClientFake(fileManager: .default),
@@ -78,7 +80,9 @@ class PostbuildTests: FileXCTestCase {
product: "/Product",
source: "/Source",
intermediate: "/Intermediate",
bundle: nil
derivedFiles: "/DerivedFiles",
bundle: nil,
skippedRegexes: []
)
private var overrideManager = FingerprintOverrideManagerImpl(
overridingFileExtensions: ["swiftmodule"],
@@ -27,17 +27,21 @@ class DependencyProcessorImplTests: FileXCTestCase {
product: "/Product",
source: "/Source",
intermediate: "/Intermediate",
bundle: "/Bundle"
derivedFiles: "/DerivedFiles",
bundle: "/Bundle",
skippedRegexes: []
)
func testIntermediateFileIsSkippedForProductAndSourceSubdirectory() {
func testIntermediateFileIsskippedRegexesForProductAndSourceSubdirectory() {
let intermediateFile: URL = "/Intermediate/some"
let processor = DependencyProcessorImpl(
xcode: "/Xcode",
product: "/",
source: "/",
intermediate: "/Intermediate",
bundle: nil
derivedFiles: "/DerivedFiles",
bundle: nil,
skippedRegexes: []
)
XCTAssertEqual(
@@ -46,14 +50,16 @@ class DependencyProcessorImplTests: FileXCTestCase {
)
}
func testBundleFileIsSkippedForProductAndSourceSubdirectory() {
func testBundleFileIsskippedRegexesForProductAndSourceSubdirectory() {
let bundleFile: URL = "/Bundle/some"
let processor = DependencyProcessorImpl(
xcode: "/Xcode",
product: "/",
source: "/",
intermediate: "/Intermediate",
bundle: "/Bundle"
derivedFiles: "/DerivedFiles",
bundle: "/Bundle",
skippedRegexes: []
)
XCTAssertEqual(
@@ -62,6 +68,22 @@ class DependencyProcessorImplTests: FileXCTestCase {
)
}
func testFiltersOutGeneratedSwiftHeaders() throws {
let dependencies = processor.process([
"/DerivedFiles/ModuleName-Swift.h",
])
XCTAssertEqual(dependencies, [])
}
func testFiltersOutDerivedFile() throws {
let dependencies = processor.process([
"/DerivedFiles/output.h",
])
XCTAssertEqual(dependencies, [])
}
func testFiltersOutProductModulemap() throws {
let dependencies = processor.process([
"/Product/some.modulemap",
@@ -130,7 +152,9 @@ class DependencyProcessorImplTests: FileXCTestCase {
product: "/Product",
source: "/Source",
intermediate: intermediateDirReal,
bundle: "/Bundle"
derivedFiles: "/DerivedFiles",
bundle: "/Bundle",
skippedRegexes: []
)
let intermediateFileSymlink = createSymlink(
@@ -158,7 +182,9 @@ class DependencyProcessorImplTests: FileXCTestCase {
product: "/Product",
source: sourceDirReal,
intermediate: "/Intermediate",
bundle: "/Bundle"
derivedFiles: "/DerivedFiles",
bundle: "/Bundle",
skippedRegexes: []
)
let sourceFileSymlink = createSymlink(
@@ -189,4 +215,76 @@ class DependencyProcessorImplTests: FileXCTestCase {
return sourceDir.appendingPathComponent(filename)
}
func testSkipsCustomizedDerivedDirFileUnderSources() {
let derivedFile: URL = "/DerivedFiles/Module-Swift.h"
let processor = DependencyProcessorImpl(
xcode: "/Xcode",
product: "/",
source: "/",
intermediate: "/Intermediate",
derivedFiles: "/DerivedFiles",
bundle: nil,
skippedRegexes: []
)
XCTAssertEqual(
processor.process([derivedFile]),
[]
)
}
func testSkippsFilesWithFullMatch() {
let source: URL = "/someFile.m"
let processor = DependencyProcessorImpl(
xcode: "/Xcode",
product: "/",
source: "/",
intermediate: "/Intermediate",
derivedFiles: "/DerivedFiles",
bundle: nil,
skippedRegexes: ["/someFile\\.m"]
)
XCTAssertEqual(
processor.process([source]),
[]
)
}
func testSkippsFilesWithPartialMatch() {
let derivedModulemap: URL = "/module.modulemap"
let processor = DependencyProcessorImpl(
xcode: "/Xcode",
product: "/product",
source: "/",
intermediate: "/Intermediate",
derivedFiles: "/DerivedFiles",
bundle: nil,
skippedRegexes: ["\\.modulemap$"]
)
XCTAssertEqual(
processor.process([derivedModulemap]),
[]
)
}
func testDoesntSkipFileIfInvalidRegex() {
let source: URL = "/someFile.m"
let processor = DependencyProcessorImpl(
xcode: "/Xcode",
product: "/product",
source: "/",
intermediate: "/Intermediate",
derivedFiles: "/DerivedFiles",
bundle: nil,
skippedRegexes: ["\\"]
)
XCTAssertEqual(
processor.process([source]),
[.init(url: source, type: .source)]
)
}
}
+1
View File
@@ -53,6 +53,7 @@ An object that is passed to the `xcremotecache` can contain all properties suppo
| `xccc_file` | The path where should be placed the `xccc` binary (in the pod installation phase) | `{podfile_dir}/.rc/xccc` | ⬜️ |
| `remote_commit_file` | The path of the file with the remote commit sha (in the pod installation phase) | `{podfile_dir}/.rc/arc.rc`| ⬜️ |
| `prettify_meta_files` | A Boolean value that opts-in pretty JSON formatting for meta files | `false` | ⬜️ |
| `fake_src_root` | An arbitrary source location shared between producers and consumers. Should be unique for a project. | `/xxxxxxxxxx` | ⬜️ |
| `disable_certificate_verification` | A Boolean value that opts-in SSL certificate validation is disabled | `false` | ⬜️ |
## Uninstalling
@@ -24,7 +24,6 @@ module CocoapodsXCRemoteCacheModifier
# Registers for CocoaPods plugin hooks
module Hooks
BIN_DIR = '.rc'
FAKE_SRCROOT = "/#{'x' * 10 }"
LLDB_INIT_COMMENT="#RemoteCacheCustomSourceMap"
LLDB_INIT_PATH = "#{ENV['HOME']}/.lldbinit"
FAT_ARCHIVE_NAME_INFIX = 'arm64-x86_64'
@@ -40,6 +39,7 @@ module CocoapodsXCRemoteCacheModifier
'check_platform',
'modify_lldb_init',
'prettify_meta_files',
'fake_src_root',
'disable_certificate_verification'
]
@@ -63,6 +63,7 @@ module CocoapodsXCRemoteCacheModifier
'remote_commit_file' => "#{BIN_DIR}/arc.rc",
'exclude_targets' => [],
'prettify_meta_files' => false,
'fake_src_root' => "/#{'x' * 10 }",
'disable_certificate_verification' => false
}
@@configuration.merge! default_values.select { |k, v| !@@configuration.key?(k) }
@@ -106,7 +107,7 @@ module CocoapodsXCRemoteCacheModifier
# @param mode [String] mode name ('consumer', 'producer', 'producer-fast' etc.)
# @param exclude_build_configurations [String[]] list of targets that should have disabled remote cache
# @param final_target [String] name of target that should trigger marking
def self.enable_xcremotecache(target, repo_distance, xc_location, xc_cc_path, mode, exclude_build_configurations, final_target)
def self.enable_xcremotecache(target, repo_distance, xc_location, xc_cc_path, mode, exclude_build_configurations, final_target, fake_src_root)
srcroot_relative_xc_location = parent_dir(xc_location, repo_distance)
target.build_configurations.each do |config|
@@ -121,7 +122,7 @@ module CocoapodsXCRemoteCacheModifier
config.build_settings['LIBTOOL'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xclibtool"]
config.build_settings['LD'] = ["$SRCROOT/#{srcroot_relative_xc_location}/xcld"]
config.build_settings['XCREMOTE_CACHE_FAKE_SRCROOT'] = FAKE_SRCROOT
config.build_settings['XCREMOTE_CACHE_FAKE_SRCROOT'] = fake_src_root
config.build_settings['XCRC_PLATFORM_PREFERRED_ARCH'] = ["$(LINK_FILE_LIST_$(CURRENT_VARIANT)_$(PLATFORM_PREFERRED_ARCH):dir:standardizepath:file:default=arm64)"]
debug_prefix_map_replacement = '$(SRCROOT' + ':dir:standardizepath' * repo_distance + ')'
add_cflags!(config.build_settings, '-fdebug-prefix-map', "#{debug_prefix_map_replacement}=$(XCREMOTE_CACHE_FAKE_SRCROOT)")
@@ -330,17 +331,17 @@ module CocoapodsXCRemoteCacheModifier
end
# Append source rewrite command to the lldbinit content
def self.add_lldbinit_rewrite(lines_content, user_proj_directory)
def self.add_lldbinit_rewrite(lines_content, user_proj_directory,fake_src_root)
all_lines = lines_content.clone
all_lines << LLDB_INIT_COMMENT
all_lines << "settings set target.source-map #{FAKE_SRCROOT} #{user_proj_directory}"
all_lines << "settings set target.source-map #{fake_src_root} #{user_proj_directory}"
all_lines << ""
all_lines
end
def self.save_lldbinit_rewrite(user_proj_directory)
def self.save_lldbinit_rewrite(user_proj_directory,fake_src_root)
lldbinit_lines = clean_lldbinit_content(LLDB_INIT_PATH)
lldbinit_lines = add_lldbinit_rewrite(lldbinit_lines, user_proj_directory) unless user_proj_directory.nil?
lldbinit_lines = add_lldbinit_rewrite(lldbinit_lines, user_proj_directory,fake_src_root) unless user_proj_directory.nil?
File.write(LLDB_INIT_PATH, lldbinit_lines.join("\n"), mode: "w")
end
@@ -372,6 +373,7 @@ module CocoapodsXCRemoteCacheModifier
final_target = @@configuration['final_target']
check_build_configuration = @@configuration['check_build_configuration']
check_platform = @@configuration['check_platform']
fake_src_root = @@configuration['fake_src_root']
xccc_location_absolute = "#{user_proj_directory}/#{xccc_location}"
xcrc_location_absolute = "#{user_proj_directory}/#{xcrc_location}"
@@ -403,7 +405,7 @@ module CocoapodsXCRemoteCacheModifier
next if target.name.start_with?("Pods-")
next if target.name.end_with?("Tests")
next if exclude_targets.include?(target.name)
enable_xcremotecache(target, 1, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target)
enable_xcremotecache(target, 1, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target,fake_src_root)
end
# Create .rcinfo into `Pods` directory as that .xcodeproj reads configuration from .xcodeproj location
@@ -416,7 +418,7 @@ module CocoapodsXCRemoteCacheModifier
next if target.source_build_phase.files_references.empty?
next if target.name.end_with?("Tests")
next if exclude_targets.include?(target.name)
enable_xcremotecache(target, 1, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target)
enable_xcremotecache(target, 1, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target,fake_src_root)
end
generated_project.save()
end
@@ -456,15 +458,15 @@ module CocoapodsXCRemoteCacheModifier
# Attach XCRC to the app targets
user_project.targets.each do |target|
next if exclude_targets.include?(target.name)
enable_xcremotecache(target, 0, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target)
enable_xcremotecache(target, 0, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target,fake_src_root)
end
# Set Target sourcemap
if @@configuration['modify_lldb_init']
save_lldbinit_rewrite(user_proj_directory)
save_lldbinit_rewrite(user_proj_directory,fake_src_root)
else
Pod::UI.puts "[XCRC] lldbinit modification is disabled. Debugging may behave weirdly"
Pod::UI.puts "[XCRC] put \"settings set target.source-map #{FAKE_SRCROOT} \#{your_project_directory}\" to your \".lldbinit\" "
Pod::UI.puts "[XCRC] put \"settings set target.source-map #{fake_src_root} \#{your_project_directory}\" to your \".lldbinit\" "
end
user_project.save()
@@ -13,5 +13,5 @@
# limitations under the License.
module CocoapodsXcremotecache
VERSION = "0.0.9"
VERSION = "0.0.10"
end
+2
View File
@@ -1,5 +1,7 @@
## Development - How to build
Generated [docs](https://spotify.github.io/XCRemoteCache/documentation/xcremotecache/).
### Building the library:
`CONFIG=Debug rake build`