Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve symlinks and dirpaths in dependency processor #67

Merged
merged 1 commit into from Feb 7, 2022

Conversation

vasvf
Copy link
Contributor

@vasvf vasvf commented Feb 1, 2022

First fix:

Before:

  • If we have some module named Name that depend on NameCommon, all artifacts from NameCommon are filtered out as if they were own artifacts

What was done:

  • Appended / symbol to the end of all paths for DependencyProcessorImpl

Now:

  • Name and NameCommon artifacts do not interfere each other.

Second fix:

Before:

  • On archiving, all compiled artifacts of own target, like .modulemap and Name-Swift.h were not filtered out in DependencyProcessorImpl

What was done:

  • According to Apple Documentation, TARGET_BUILD_DIR and BUILT_PRODUCTS_DIR depend on several cases. Generally, they are the same for building. But on archive, they are different, and DependencyProcessorImpl uses TARGET_BUILD_DIR to determine ownership of artifacts. But Xcode mostly operates with BUILT_PRODUCTS_DIR to list all dependencies. And, by the way, BUILT_PRODUCTS_DIR is just a symlink to TARGET_BUILD_DIR. So I added resolving symlinks in DependencyProcessorImpl.
  • Other possibility: use BUILT_PRODUCTS_DIR in DependencyProcessorImpl instead, but I'm not sure why it is TARGET_BUILD_DIR now. So I decided just to resolve symlinks

Now:

  • All compiled own module artifacts are filtered out by DependencyProcessorImpl.

@vasvf
Copy link
Contributor Author

vasvf commented Feb 7, 2022

Any update?

BTW, can we release new version of plugin (at least) after that PR?

productPath = product.path.dirPath()
sourcePath = source.path.dirPath()
intermediatePath = intermediate.path.dirPath()
bundlePath = bundle?.path.dirPath()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively, we could create initialize URLs in PostbuildContext with init(fileURLWithPath: isDirectory:)

@@ -72,7 +72,7 @@ class DependencyProcessorImpl: DependencyProcessor {

private func classify(_ files: [URL]) -> [Dependency] {
return files.map { file -> Dependency in
let filePath = file.path
let filePath = file.resolvingSymlinksInPath().path
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe indeed we should switch to BUILT_PRODUCTS_DIR. For now we can rely on a symlink.

@polac24 polac24 merged commit 1127257 into spotify:master Feb 7, 2022
@polac24
Copy link
Collaborator

polac24 commented Feb 7, 2022

Let me release a new library along with a cocoapods plugin tomorrow. Hopefully, that will contain #71.

@vasvf vasvf deleted the resolve_symlinks branch February 7, 2022 18:32
@polac24
Copy link
Collaborator

polac24 commented Feb 7, 2022

Available in v0.3.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants