For multi-computer development
This commit is contained in:
parent
7e5c4b2caa
commit
3a41da299f
@ -15,6 +15,7 @@
|
|||||||
<include name="**/*.xml" />
|
<include name="**/*.xml" />
|
||||||
<include name="**/*.out" />
|
<include name="**/*.out" />
|
||||||
<include name="**/*.dat" />
|
<include name="**/*.dat" />
|
||||||
|
<include name="**/*.log" />
|
||||||
<include name="**/failures" />
|
<include name="**/failures" />
|
||||||
<include name="**/test.gz" />
|
<include name="**/test.gz" />
|
||||||
<include name="**/test.zip" />
|
<include name="**/test.zip" />
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#! py -3
|
#! 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.
|
Extract code examples from TIJ4 Refreshed. Extracts from plain text file.
|
||||||
Creates Ant build.xml file for each subdirectory.
|
Creates Ant build.xml file for each subdirectory.
|
||||||
"""
|
"""
|
||||||
@ -11,7 +10,8 @@ import shutil
|
|||||||
import pprint
|
import pprint
|
||||||
import difflib
|
import difflib
|
||||||
from sortedcontainers import SortedSet
|
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")
|
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])
|
# 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()
|
if __name__ == '__main__': CmdLine.run()
|
||||||
|
@ -301,8 +301,7 @@ class Result:
|
|||||||
jf.write(result)
|
jf.write(result)
|
||||||
return result
|
return result
|
||||||
else:
|
else:
|
||||||
print("{} already has Output: tags:".format(self.javaFilePath))
|
print("{} already has Output!".format(self.javaFilePath))
|
||||||
print(self.output_tags)
|
|
||||||
sys.exit()
|
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]
|
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"
|
assert len(results), "Must run runall.ps1 first"
|
||||||
tagd = defaultdict(list)
|
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:
|
for tag in tagged.output_tags:
|
||||||
tagd[tag].append(str(tagged.javaFilePath))
|
tagd[tag].append(str(tagged.javaFilePath))
|
||||||
pprint.pprint(tagd)
|
pprint.pprint(tagd)
|
||||||
|
1
tools/e.bat
Normal file
1
tools/e.bat
Normal file
@ -0,0 +1 @@
|
|||||||
|
python C:\Users\Bruce\Dropbox\__TIJ4-ebook\Examples.py %*
|
Loading…
x
Reference in New Issue
Block a user