For multi-computer development

This commit is contained in:
Bruce Eckel 2015-05-15 22:36:55 -07:00
parent 7e5c4b2caa
commit 3a41da299f
4 changed files with 40 additions and 5 deletions

View File

@ -15,6 +15,7 @@
<include name="**/*.xml" />
<include name="**/*.out" />
<include name="**/*.dat" />
<include name="**/*.log" />
<include name="**/failures" />
<include name="**/test.gz" />
<include name="**/test.zip" />

View File

@ -1,6 +1,5 @@
#! py -3
"""
TODO: Make sure there's a newline at the end of the extracted files
Extract code examples from TIJ4 Refreshed. Extracts from plain text file.
Creates Ant build.xml file for each subdirectory.
"""
@ -11,7 +10,8 @@ import shutil
import pprint
import difflib
from sortedcontainers import SortedSet
from betools import CmdLine
from collections import defaultdict
from betools import CmdLine, visitDir, ruler, head
maindef = re.compile("public\s+static\s+void\s+main")
@ -368,4 +368,37 @@ def checkAntClean():
# pprint.pprint([f for f in others if "test" in f or "Test" in f])
tagRE = re.compile("{.*?}", re.DOTALL)
def findTags(lines):
topblock = []
for line in lines:
if line.startswith("//"):
topblock.append(line)
else:
break
topblock = [line[2:].strip() for line in topblock]
tags = tagRE.findall(" ".join(topblock))
return tags
@CmdLine('t', "findAllCommentTags" )
def findAllCommentTags():
"Find all '{}' comment tags in Java files"
tagdict = defaultdict(list)
examples = Path(r"C:\Users\Bruce\Dropbox\__TIJ4-ebook\ExtractedExamples")
for jf in [f for f in examples.rglob("*.java")]:
with jf.open() as code:
lines = code.readlines()
tags = findTags(lines)
if tags:
# head(jf.name)
# print("\n".join(tags))
for t in tags:
tagdict[t].append(jf.name)
pprint.pprint(tagdict)
if __name__ == '__main__': CmdLine.run()

View File

@ -301,8 +301,7 @@ class Result:
jf.write(result)
return result
else:
print("{} already has Output: tags:".format(self.javaFilePath))
print(self.output_tags)
print("{} already has Output!".format(self.javaFilePath))
sys.exit()
@ -314,7 +313,8 @@ def discoverOutputTags():
results = [r for r in [Result.create(jfp) for jfp in RunFiles.base.rglob("*.java")] if r]
assert len(results), "Must run runall.ps1 first"
tagd = defaultdict(list)
for tagged in [r for r in [Result.create(jfp) for jfp in RunFiles.base.rglob("*.java")] if r and r.output_tags]:
for tagged in [r for r in [Result.create(jfp) for jfp in RunFiles.base.rglob("*.java")]
if r and r.output_tags]:
for tag in tagged.output_tags:
tagd[tag].append(str(tagged.javaFilePath))
pprint.pprint(tagd)

1
tools/e.bat Normal file
View File

@ -0,0 +1 @@
python C:\Users\Bruce\Dropbox\__TIJ4-ebook\Examples.py %*