Page MenuHomePhabricator

D9861.diff
No OneTemporary

D9861.diff

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->buildAndWriteMap();
}
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 buildAndWriteMap() {
+ $library_map = $this->buildMap();
- $this->log("Done.\n");
- return $library_map;
+ $this->log("Writing map...\n");
+ $this->writeLibraryMap($library_map);
}
/**

File Metadata

Mime Type
text/plain
Expires
Thu, May 9, 8:01 PM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6276244
Default Alt Text
D9861.diff (2 KB)

Event Timeline