Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14009233
D9861.id23661.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9861.id23661.diff
View Options
diff --git a/scripts/phutil_rebuild_map.php b/scripts/phutil_rebuild_map.php
--- a/scripts/phutil_rebuild_map.php
+++ b/scripts/phutil_rebuild_map.php
@@ -61,18 +61,16 @@
}
if ($args->getArg('show')) {
- $builder->setDryRun(true);
-}
-
-$library_map = $builder->buildMap();
+ $library_map = $builder->buildMap();
-if ($args->getArg('show')) {
if ($args->getArg('ugly')) {
echo json_encode($library_map);
} else {
$json = new PhutilJSON();
echo $json->encodeFormatted($library_map);
}
+} else {
+ $builder->updateMap();
}
exit(0);
diff --git a/src/__tests__/PhutilInfrastructureTestCase.php b/src/__tests__/PhutilInfrastructureTestCase.php
--- a/src/__tests__/PhutilInfrastructureTestCase.php
+++ b/src/__tests__/PhutilInfrastructureTestCase.php
@@ -21,8 +21,6 @@
$root = phutil_get_library_root($library);
$new_library_map = id(new PhutilLibraryMapBuilder($root))
- ->setQuiet(true)
- ->setDryRun(true)
->buildMap();
$bootloader = PhutilBootloader::getInstance();
diff --git a/src/moduleutils/PhutilLibraryMapBuilder.php b/src/moduleutils/PhutilLibraryMapBuilder.php
--- a/src/moduleutils/PhutilLibraryMapBuilder.php
+++ b/src/moduleutils/PhutilLibraryMapBuilder.php
@@ -14,7 +14,6 @@
private $root;
private $quiet = true;
private $subprocessLimit = 8;
- private $dryRun = false;
const LIBRARY_MAP_VERSION_KEY = '__library_version__';
const LIBRARY_MAP_VERSION = 2;
@@ -63,21 +62,7 @@
}
/**
- * Control whether the map should be rebuilt, or just shown (printed to
- * stdout in JSON).
- *
- * @param bool If true, show map instead of updating.
- * @return this
- *
- * @task map
- */
- public function setDryRun($dry_run) {
- $this->dryRun = $dry_run;
- return $this;
- }
-
- /**
- * Build or rebuild the library map.
+ * Build the library map.
*
* @return dict
*
@@ -94,7 +79,6 @@
$this->log("Loading symbol cache...\n");
$symbol_cache = $this->loadSymbolCache();
-
// Build out the symbol analysis for all the files in the library. For
// each file, check if it's in cache. If we miss in the cache, do a fresh
// analysis.
@@ -148,15 +132,19 @@
// Our map is up to date, so either show it on stdout or write it to disk.
$this->log("Building library map...\n");
- $library_map = $this->buildLibraryMap($symbol_map);
+ return $this->buildLibraryMap($symbol_map);
+ }
- if (!$this->dryRun) {
- $this->log("Writing map...\n");
- $this->writeLibraryMap($library_map);
- }
+ /**
+ * Build and update the library map.
+ *
+ * @task map
+ */
+ public function updateMap() {
+ $library_map = $this->buildMap();
- $this->log("Done.\n");
- return $library_map;
+ $this->log("Writing map...\n");
+ $this->writeLibraryMap($library_map);
}
/**
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 31, 1:11 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6747401
Default Alt Text
D9861.id23661.diff (2 KB)
Attached To
Mode
D9861: Separate map building and updating in `PhutilLibraryMapBuilder`
Attached
Detach File
Event Timeline
Log In to Comment