-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathupdateClassInfo.groovy
More file actions
40 lines (34 loc) · 918 Bytes
/
Copy pathupdateClassInfo.groovy
File metadata and controls
40 lines (34 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) 2019 Egon Willighagen <egon.willighagen@gmail.com>
//
// GPL v3
// update the class info data file
//
// it takes one optional argument, which is appended to the output
if (args.length == 0) {
println "groovy updateClassInfo.groovy <directory>"
System.exit(0)
}
def folder = args[0]
pkgs = new HashMap<String,String>();
modules = new HashMap<String,String>();
def lines = new File("classinfo.tsv").readLines()
lines.each { String line ->
data = line.split("\t")
topic = data[0]
pkg = data[1]
module = data[2]
pkgs.put(topic, pkg)
modules.put(topic, module)
}
lines = new File("classes.lst").readLines()
lines.each { String line ->
data = line.split("\t")
clazz = data[0]
pkg = data[1]
module = data[2]
if (pkgs.containsKey(clazz)) {
println clazz + "\t" + pkgs.get(clazz) + "\t" + modules.get(clazz)
} else {
println clazz + "\t" + pkg + "\t" + module
}
}