Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cache source packages when reference/revision is available #367

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

Open
adduc wants to merge 4 commits into felixfbecker:master
base: master
Choose a base branch
Loading
from adduc:cache-revisions

Conversation

@adduc
Copy link

@adduc adduc commented Apr 26, 2017
edited
Loading

Fixes #366

For projects that use specific revisions for packages (e.g. if a bug fix has not made it to a tagged release yet), the PHP language server would reparse the package's files every time the server started, even if the package had not changed. This change introduces caching support for packages that are checked out from source, by using the revision as part of the cache key.

hajekj reacted with thumbs up emoji
Copy link

codecov bot commented Apr 26, 2017
edited
Loading

Codecov Report

Merging #367 into master will increase coverage by 2.61%.
The diff coverage is 37.5%.

@@ Coverage Diff @@
## master #367 +/- ##
============================================
+ Coverage 84.33% 86.95% +2.61% 
- Complexity 834 835 +1 
============================================
 Files 59 59 
 Lines 1724 1732 +8 
============================================
+ Hits 1454 1506 +52 
+ Misses 270 226 -44
Impacted Files Coverage Δ Complexity Δ
src/Indexer.php 91.25% <37.5%> (+28.23%) 19 <0> (+1) ⬆️
src/Index/ProjectIndex.php 100% <0%> (ø) 4% <0%> (ø) ⬇️
src/LanguageServer.php 95.18% <0%> (+2.4%) 20% <0%> (ø) ⬇️
src/Index/Index.php 80.39% <0%> (+11.76%) 21% <0%> (ø) ⬇️
src/Index/DependenciesIndex.php 53.33% <0%> (+40%) 6% <0%> (ø) ⬇️
src/Cache/FileSystemCache.php 70% <0%> (+50%) 8% <0%> (ø) ⬇️

Copy link
Author

adduc commented Apr 26, 2017

Regarding testing for this change, I'm still wrapping my head around the code. I think it can be accomplished by including a composer.json and composer.lock within fixtures to mock a faux install. I'm going to look into this further.

src/Indexer.php Outdated
// Check if package can be cached.
$packageVersion = ltrim($package->version, 'v');
// If package is anchored to a version
if ($package->name === $packageName && strpos($packageVersion, 'dev') === false) {
Copy link
Owner

@felixfbecker felixfbecker Apr 26, 2017

Choose a reason for hiding this comment

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

package name is checked in both conditions

src/Indexer.php Outdated
break;

// If package is checked out
} elseif ($package->name === $packageName && isset($package->source->reference)) {
Copy link
Owner

@felixfbecker felixfbecker Apr 26, 2017

Choose a reason for hiding this comment

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

space between else if

Copy link
Owner

LGTM overall.
Testing with a fake composer.json and composer.lock sounds like a good approach. Ideally this would be a unit test for the Indexer that asserts a stubbed Cache is called

Copy link
Author

adduc commented Apr 30, 2017
edited
Loading

I've made changes based off your feedback, and modified tests for the two current package caching strategies.

I think this is ready for another review.

Copy link
Owner

Could you do the tests as a unit test for the Indexer?

Copy link
Author

adduc commented Apr 30, 2017

I'd be willing to give it a shot.

Copy link

umpirsky commented Jul 6, 2017

Any updates on this?

felixfbecker, jens1o, CarwynNelson, phux, hiqsol, jacks0n, Daemeron, and kasra73 reacted with thumbs up emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@felixfbecker felixfbecker felixfbecker requested changes

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Cache Key is not set when dependent repository targets a specific commit

AltStyle によって変換されたページ (->オリジナル) /