summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/docs/build
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-22 23:50:11 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-22 23:50:11 +0000
commit156f0c678513cc85d6a194a235126fa283ece115 (patch)
tree125150c66af03ad8cbcc758ec41c1378451a7e59 /chrome/common/extensions/docs/build
parent9ba14056e51e361ba14f529151fb7c24cf3a4267 (diff)
downloadchromium_src-156f0c678513cc85d6a194a235126fa283ece115.zip
chromium_src-156f0c678513cc85d6a194a235126fa283ece115.tar.gz
chromium_src-156f0c678513cc85d6a194a235126fa283ece115.tar.bz2
Basic setup for generating apps docs.
It turns out that we don't need to tag anything. Putting the page shell inside extensions/ or apps/ works better with the current state of the code. In order to do the transition, I propose: 1) Land and push a change to the appengine server to make it look in /docs/extensions, then fall back to /docs. 2) Land this CL (without any apps files fleshed out) 3) Add support to app engine server to know about the apps folder too (can test by going to its app engine URL) 4) Flesh out the apps docs 5) Apply the new template 6) Fix the one-off things like generation of experimental.html that need to be fixed for apps-specific. [3-6 can be done in parallel] Review URL: https://chromiumcodereview.appspot.com/10642015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143742 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/docs/build')
-rwxr-xr-xchrome/common/extensions/docs/build/build.py58
-rw-r--r--chrome/common/extensions/docs/build/generator.html21
2 files changed, 32 insertions, 47 deletions
diff --git a/chrome/common/extensions/docs/build/build.py b/chrome/common/extensions/docs/build/build.py
index d08f1d1..0fa7c0a 100755
--- a/chrome/common/extensions/docs/build/build.py
+++ b/chrome/common/extensions/docs/build/build.py
@@ -48,22 +48,26 @@ from directory import Sample
from directory import ApiManifest
from directory import SamplesManifest
-def RenderPages(names, dump_render_tree):
- """
- Calls DumpRenderTree .../generator.html?<names> and writes the
- results to .../docs/<name>.html
- """
- if not names:
- raise Exception("RenderPage called with empty names param")
+def RenderPages(family, dump_render_tree, single_page_name):
+ output_dir = os.path.join(_base_dir, family)
+ names = set(os.path.splitext(name)[0] for name in os.listdir(output_dir)
+ if not name.startswith(".") and name.endswith(".html"))
+
+ # Allow the user to render a single page if they want
+ if single_page_name:
+ if single_page_name in names:
+ names = [single_page_name]
+ else:
+ return []
generator_url = "file:" + urllib.pathname2url(_generator_html)
- generator_url += "?" + ",".join(names)
+ generator_url += "?" + family + "|" + ",".join(names)
# Start with a fresh copy of page shell for each file.
# Save the current contents so that we can look for changes later.
originals = {}
for name in names:
- input_file = _base_dir + "/" + name + ".html"
+ input_file = os.path.join(output_dir, name + ".html")
if (os.path.isfile(input_file)):
originals[name] = open(input_file, 'rb').read()
@@ -110,7 +114,7 @@ def RenderPages(names, dump_render_tree):
result = result.replace(' style=""', '')
# Remove page_shell
- input_file = _base_dir + "/" + name + ".html"
+ input_file = os.path.join(output_dir, name + ".html")
os.remove(input_file)
# Write output
@@ -165,12 +169,6 @@ def FindDumpRenderTree():
"To specify a path to DumpRenderTree use "
"--dump-render-tree-path")
-def GetStaticFileNames():
- static_files = os.listdir(_static_dir)
- return set(os.path.splitext(file_name)[0]
- for file_name in static_files
- if file_name.endswith(".html") and not file_name.startswith("."))
-
def main():
# Prevent windows from using cygwin python.
if (sys.platform == "cygwin"):
@@ -198,23 +196,6 @@ def main():
api_manifest = ApiManifest(_extension_api_json_schemas,
_extension_api_idl_schemas)
- # Read static file names
- static_names = GetStaticFileNames()
-
- # Read module names
- module_names = api_manifest.getModuleNames()
-
- # All pages to generate
- page_names = static_names | module_names
-
- # Allow the user to render a single page if they want
- if options.page_name:
- if options.page_name in page_names:
- page_names = [options.page_name]
- else:
- raise Exception("--page-name argument must be one of %s." %
- ', '.join(sorted(page_names)))
-
# Write temporary JSON files based on the IDL inputs
api_manifest.generateJSONFromIDL()
@@ -224,13 +205,14 @@ def main():
# Write zipped versions of the samples listed in the manifest to the
# filesystem, unless the user has disabled it
+ modified_files = []
if options.zips:
- modified_zips = samples_manifest.writeZippedSamples()
- else:
- modified_zips = []
+ modified_files.extend(samples_manifest.writeZippedSamples())
- modified_files = RenderPages(page_names, dump_render_tree)
- modified_files.extend(modified_zips)
+ doc_families = ["extensions", "apps"]
+ for family in doc_families:
+ modified_files.extend(
+ RenderPages(family, dump_render_tree, options.page_name))
if len(modified_files) == 0:
print "Output files match existing files. No changes made."
diff --git a/chrome/common/extensions/docs/build/generator.html b/chrome/common/extensions/docs/build/generator.html
index 0700d49..d5f09bf 100644
--- a/chrome/common/extensions/docs/build/generator.html
+++ b/chrome/common/extensions/docs/build/generator.html
@@ -2,20 +2,22 @@
<head>
<script>
var childFrame;
+var family;
var pages;
var currentPage;
var result = {};
function init() {
- if (!window.layoutTestController) {
- alert("window.layoutTestController not defined.");
- return;
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ } else {
+ console.error("No layout test controller");
}
-
- layoutTestController.dumpAsText();
- layoutTestController.waitUntilDone();
- pages = window.location.search.substring(1).split(",");
+ var queryString = window.location.search.substring(1).split("|");
+ family = queryString[0];
+ pages = queryString[1].split(",");
if (!pages.length) {
alert("please specify which pages to generate via " +
"?<page> ... ie. generator.html?tabs,bookmarks,cookies,...");
@@ -30,7 +32,7 @@ function init() {
function next() {
currentPage = pages.shift();
- childFrame.src = "../" + currentPage + ".html?regenerate";
+ childFrame.src = "../" + family + "/" + currentPage + ".html?regenerate";
}
var count = 0;
@@ -45,7 +47,8 @@ function done() {
"#BEGIN" + JSON.stringify(result) + "#END");
preNode.appendChild(textNode);
document.getElementsByTagName("body")[0].appendChild(preNode);
- layoutTestController.notifyDone();
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
}
}
</script>