]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Include linter class MD5 in linter version
authorvrana <jakubv@fb.com>
Tue, 26 Feb 2013 23:20:13 +0000 (15:20 -0800)
committervrana <jakubv@fb.com>
Wed, 27 Feb 2013 00:01:25 +0000 (16:01 -0800)
Summary:
People constantly forget to bump the linter version and I don't see a way how to stop it.
This may bump the version even if it wouldn't be required but let's rather undercache than overcache.

Test Plan: `var_dump($version)`.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D5129

src/lint/engine/ArcanistLintEngine.php

index f3bb44bdd37009969ff7f24e590cd6df0be0fdd7..6076d3e650daddf903577b95d5972b527fb2719d 100644 (file)
@@ -185,10 +185,24 @@ abstract class ArcanistLintEngine {
     }
 
     $versions = array($this->getCacheVersion());
+
     foreach ($linters as $linter) {
       $linter->setEngine($this);
-      $versions[] = get_class($linter).':'.$linter->getCacheVersion();
+      $version = get_class($linter).':'.$linter->getCacheVersion();
+
+      $symbols = id(new PhutilSymbolLoader())
+        ->setType('class')
+        ->setName(get_class($linter))
+        ->selectSymbolsWithoutLoading();
+      $symbol = idx($symbols, 'class$'.get_class($linter));
+      if ($symbol) {
+        $version .= ':'.md5_file(
+          phutil_get_library_root($symbol['library']).'/'.$symbol['where']);
+      }
+
+      $versions[] = $version;
     }
+
     $this->cacheVersion = crc32(implode("\n", $versions));
 
     $this->stopped = array();