8000 [AssetMapper] Allowing for files to be written to some non-local location by weaverryan · Pull Request #51847 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[AssetMapper] Allowing for files to be written to some non-local location #51847

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

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

weaverryan
Copy link
Member
Q A
Branch? 6.4
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #50221
License MIT

Hi!

An attempt at making AssetMapper flexible enough to support non-local filesystems. The "hook point" would be that you could replace the asset_mapper.local_public_assets_filesystem service with your own that implements PublicAssetsFilesystemInterface. I'm not worried about making the hook point super user-friendly: I just want the system to support this now, as trying to add this later (when we need to protect BC) will be harder.

Cheers!

@carsonbot carsonbot added this to the 6.4 milestone Oct 4, 2023
@shyim
Copy link
Contributor
shyim commented Oct 4, 2023

looks pretty good. I am right now in Berlin for SymfonyLive. I will check next week and build something with flysystem :).

But arent the most things breaking changes? 🤔

@chalasr
Copy link
Member
chalasr commented Oct 5, 2023

But arent the most things breaking changes? 🤔

Indeed, but the component has been released as experimental to allow for such changes if needed.

@weaverryan
Copy link
Member Author

Indeed, but the component has been released as experimental to allow for such changes if needed.

That's also why I'd like to get this in NOW for 6.4 - the component will be stable in 6.4, so making a change like this will be harder. We're already dipping a little beyond the 6.4 feature-freeze date :)

@weaverryan weaverryan force-pushed the asset-mapper-remote-filesystem branch from ac2f5cf to 45e93ee Compare October 5, 2023 15:05
@weaverryan weaverryan added the ❄️ Feature Freeze Important Pull Requests to finish before the next Symfony "feature freeze" label Oct 6, 2023
@weaverryan weaverryan force-pushed the asset-mapper-remote-filesystem branch from 85d6468 to fef0903 Compare October 6, 2023 17:26
public function getOutputDir(): string
{
return $this->outputDir;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

I created this event - and just included $outputDir because I had it available. Now that it's not readily available, I don't think it's a big deal to not include it. My use-case for this event is to run some code that pre-compiles some internal files (not into the output directory) so that when the true compilation process happens, those files are ready and available.

@weaverryan weaverryan force-pushed the asset-mapper-remote-filesystem branch from fef0903 to 67249ca Compare October 11, 2023 00:05
@weaverryan
Copy link
Member Author

@shyim While I think this PR is valid and should be merged, since you created the original issue, if you were able to validate that this gives you what you need, that would help :)

Copy link
Contributor
@shyim shyim left a comment

Choose a reason for hiding this comment

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

I exchanged the interface with flysystem and it works fine for me. Thanks for your awesome work and sorry for my late reply.

@weaverryan weaverryan force-pushed the asset-mapper-remote-filesystem branch 3 times, most recently from b3157ee to d01d19c Compare October 16, 2023 20:42
@weaverryan
Copy link
Member Author
weaverryan commented Oct 17, 2023

Test failures in AssetMapper - but it looks like it's coming from #50734 - the $this variable in

$fileLink = $this->getFileLink($trace['file'], $lineNumber);
is an instance of HtmlErrorRenderer

Rebased and those tests are fixed.

@weaverryan weaverryan force-pushed the asset-mapper-remote-filesystem branch 2 times, most recently from 65c2b75 to bad3998 Compare October 18, 2023 13:07
Copy link
Member
@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

LGTM, just one minor question :)

@weaverryan weaverryan force-pushed the asset-mapper-remote-filesystem branch from bad3998 to 2937d07 Compare October 19, 2023 18:06
@fabpot
Copy link
Member
fabpot commented Oct 20, 2023

@weaverryan Can you rebase this one?

@weaverryan weaverryan force-pushed the asset-mapper-remote-filesystem branch from 2937d07 to 11050dc Compare October 20, 2023 14:06
Copy link
Member Author
@weaverryan weaverryan left a comment

Choose a reason for hiding this comment

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

Rebased and re-tested on a project locally. Should be good to go!

$entries = $this->importMapConfigReader->getEntries();

return $entries->has($moduleName) ? $entries->get($moduleName) : null;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

From an earlier PR - method was no longer used

@fabpot fabpot force-pushed the asset-mapper-remote-filesystem branch from d5f695c to 48a2d68 Compare October 20, 2023 16:05
@fabpot
Copy link
Member
fabpot commented Oct 20, 2023

Thank you @weaverryan.

@fabpot fabpot merged commit d261eeb into symfony:6.4 Oct 20, 2023
@weaverryan weaverryan deleted the asset-mapper-remote-filesystem branch October 20, 2023 16:11
This was referenced Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AssetMapper Feature ❄️ Feature Freeze Important Pull Requests to finish before the next Symfony "feature freeze" Status: Reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[AssetMapper] Add a Filesystem abstraction
7 participants
0