Skip to content

fix: Use text script rather than fixed script paths - #789

Merged
spydon merged 1 commit into
invertase:mainfrom
AlexV525:fix/intellij-script
Nov 14, 2024
Merged

spydon merged 1 commit into
invertase:mainfrom
AlexV525:fix/intellij-script

Conversation

@AlexV525

@AlexV525 AlexV525 commented Nov 8, 2024

Copy link
Copy Markdown
Contributor

Description

The melos executable path could be changed due to environment updates. Using a text script and letting the configuration run in the terminal can reduce the pain of checking out these configurations into version control.

Type of Change

  • 🛠️ fix -- Bug fix (non-breaking change which fixes an issue)

@docs-page

docs-page Bot commented Nov 8, 2024

Copy link
Copy Markdown

To view this pull requests documentation preview, visit the following URL:

docs.page/invertase/melos~789

Documentation is deployed and generated using docs.page.

@AlexV525

Copy link
Copy Markdown
Contributor Author

@spydon Thanks for the approve. I have little time to improve this with some potential tests. If you think it's fine then I will mark this as ready.

@spydon

spydon commented Nov 14, 2024

Copy link
Copy Markdown
Collaborator

@spydon Thanks for the approve. I have little time to improve this with some potential tests. If you think it's fine then I will mark this as ready.

I think it's fine, it looks like it makes sense and I assume you've tested it manually.

@AlexV525
AlexV525 marked this pull request as ready for review November 14, 2024 12:15
@AlexV525
AlexV525 requested a review from spydon November 14, 2024 12:45
@spydon
spydon merged commit bc2da5f into invertase:main Nov 14, 2024
@AlexV525

AlexV525 commented Feb 11, 2025 •

Copy link
Copy Markdown
Contributor Author

Hi @spydon. I'm still seeing the old style of generated configurations. I saw the commit was published in v6.3.2 and I was using the exact same version. Is there something missing from the publish?

EDIT: I just found out that I need to upgrade the workspace dependency! Sorry for disturbing.

@spydon

spydon commented Feb 11, 2025

Copy link
Copy Markdown
Collaborator

Hey @AlexV525, everything should be out.
Maybe something went wrong with this PR so that it didn't have any effect then? 🤔

@spydon

spydon commented Feb 11, 2025 •

Copy link
Copy Markdown
Collaborator

Have you tried if it works on the 7.0.0 pre-release version?

@AlexV525

Copy link
Copy Markdown
Contributor Author

I just upgraded my workspace dependency and it seems working. I used to think that a globally activated package would ignore the resolved version in the workspace, but now it appears not.

@spydon

spydon commented Feb 11, 2025

Copy link
Copy Markdown
Collaborator

I just upgraded my workspace dependency and it seems working. I used to think that a globally activated package would ignore the resolved version in the workspace, but now it appears not.

Ah yes, that is intentional, so that it always runs with the version that you've specified in the pubspec.

spydon added a commit to AzazelSensei/melos that referenced this pull request Aug 14, 2026
…_CACHE remap

Address review feedback:

- Restore the SCRIPT_TEXT-based run configuration template from invertase#789 so
  melos keeps resolving from PATH. A fixed SCRIPT_PATH into the pub cache
  breaks shims, symlinks, and workspace installs, and writes
  machine-specific absolute paths into committed .idea files.
- Revert the PUB_CACHE branch of getMelosBinForIde accordingly, and hoist
  the loop-invariant bin path computation out of writeMelosScripts.
- Keep getMelosRoot generic: the templates probe now lives at the IntelliJ
  call site and is passed to applyPubCacheOverride as a parameter.
- Validate the rewritten root: only remap when the probe subdirectory
  actually exists under PUB_CACHE, otherwise keep the resolved root so
  errors name a real path.
- Guard paths already inside PUB_CACHE (prevents doubling a nested cache
  path), compare paths with p.equals instead of ==, absolutize a relative
  PUB_CACHE the way pub does, and skip the remap when no default cache
  location can be determined (HOME unset).
- Drop the unused getPubCacheDirectory/defaultPubCacheDirectory helpers,
  reuse io.dart's dirExists (wrapped to treat unreadable paths as
  missing), and memoize the resolved melos root.
- Test the remap against real directories, and assert that PUB_CACHE does
  not change the generated run configuration XML.
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.

2 participants