Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2199)

Unified Diff: third_party/jmake/src/org/pantsbuild/jmake/PCDContainer.java

Issue 1373723003: Fix javac --incremental by using jmake for dependency analysis (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@aidl
Patch Set: fix license check Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/jmake/src/org/pantsbuild/jmake/PCDContainer.java
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/PCDContainer.java b/third_party/jmake/src/org/pantsbuild/jmake/PCDContainer.java
new file mode 100644
index 0000000000000000000000000000000000000000..b02cfa49fee20fb60f1769029e40fe2f3c0eafab
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/PCDContainer.java
@@ -0,0 +1,64 @@
+/* Copyright (c) 2002-2008 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+import java.io.File;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * This class is a persistent container for the Project Class Directory, that can
+ * read and write itself from/to disk.
+ *
+ * @author Misha Dmitriev
+ * 12 November 2001
+ */
+public class PCDContainer {
+
+ /** The data structure (currently {@link LinkedHashMap}) for PCD, that maps class name to
+ record containing information about the class */
+ Map<String,PCDEntry> pcd;
+ String storeName;
+ boolean textFormat;
+
+ private PCDContainer(Map<String,PCDEntry> pcd, String storeName, boolean textFormat) {
+ this.storeName = storeName;
+ this.pcd = pcd;
+ this.textFormat = textFormat;
+ }
+
+ public static PCDContainer load(String storeName, boolean textFormat) {
+ if (storeName == null) {
+ storeName = Main.DEFAULT_STORE_NAME;
+ }
+ File storeFile = Utils.checkFileForName(storeName);
+ if (storeFile != null) {
+ Utils.printInfoMessageNoEOL("Opening project database... ");
+ Map<String,PCDEntry> pcd;
+ if (textFormat) {
+ pcd = new TextProjectDatabaseReader().readProjectDatabaseFromFile(storeFile);
+ } else {
+ pcd = new BinaryProjectDatabaseReader().readProjectDatabaseFromFile(storeFile);
+ }
+ PCDContainer pcdc = new PCDContainer(pcd, storeName, textFormat);
+ Utils.printInfoMessage("Done.");
+ return pcdc;
+ }
+ return new PCDContainer(null, storeName, textFormat);
+ }
+
+ public void save() {
+ Utils.printInfoMessageNoEOL("Writing project database... ");
+ File outfile = new File(storeName);
+ if (textFormat) {
+ new TextProjectDatabaseWriter().writeProjectDatabaseToFile(outfile, pcd);
+ } else {
+ new BinaryProjectDatabaseWriter().writeProjectDatabaseToFile(outfile, pcd);
+ }
+ Utils.printInfoMessage("Done.");
+ }
+}
« no previous file with comments | « third_party/jmake/src/org/pantsbuild/jmake/Main.java ('k') | third_party/jmake/src/org/pantsbuild/jmake/PCDEntry.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698