Repository navigation
chore: sync upstream PR #8719 - fix(cli): use relative iOS SPM plugin symlinks #255
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
base: plus
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| import { | ||
| ensureDir, | ||
| ensureSymlink, | ||
| pathExists, | ||
| existsSync, | ||
|
|
@@ -7,10 +8,13 @@ import { | |
| remove, | ||
| move, | ||
| mkdtemp, | ||
| realpath, | ||
| lstat, | ||
| readlink, | ||
| readdirSync, | ||
| } from 'fs-extra'; | ||
| import { tmpdir } from 'os'; | ||
| import { join, relative, resolve } from 'path'; | ||
| import { basename, dirname, join, relative, resolve } from 'path'; | ||
| import type { PlistObject } from 'plist'; | ||
| import { build, parse } from 'plist'; | ||
| import { extract } from 'tar'; | ||
|
|
@@ -159,7 +163,25 @@ let package = Package( | |
| ? symlinkFolder | ||
| : convertToUnixPath(relative(spmDirectory, getPluginReferencePath(config, plugin))); | ||
| if (symlink) { | ||
| await ensureSymlink(plugin.rootPath, resolve(config.ios.nativeProjectDirAbs, 'CapApp-SPM', symlinkFolder)); | ||
| const linkPath = resolve(config.ios.nativeProjectDirAbs, 'CapApp-SPM', symlinkFolder); | ||
| await ensureDir(dirname(linkPath)); | ||
| const realLinkDir = await realpath(dirname(linkPath)); | ||
| const relativePluginPath = relative(realLinkDir, getPluginReferencePath(config, plugin)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: The new Prompt for AI agents |
||
| const destLink = join(realLinkDir, basename(linkPath)); | ||
| const existingTarget = await readlink(destLink).catch(() => undefined); | ||
| if (existingTarget !== relativePluginPath) { | ||
| if (existingTarget !== undefined) { | ||
| await remove(destLink); | ||
| } else if (existsSync(destLink)) { | ||
| const destStat = await lstat(destLink); | ||
| if (destStat.isSymbolicLink()) { | ||
| await remove(destLink); | ||
| } else { | ||
| fatal(`Cannot create SPM plugin symlink at ${destLink}: path exists and is not a symlink`); | ||
| } | ||
| } | ||
| await ensureSymlink(relativePluginPath, destLink); | ||
| } | ||
| } | ||
| const traits = packageTraits[plugin.id]; | ||
| const traitsSuffix = traits?.length | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.