-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathnoxfile.py
56 lines (43 loc) · 1.81 KB
/
noxfile.py
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from pathlib import Path
import nox
ROOT = Path(__file__).parent
# default actions to be run if nothing is explicitly specified with the -s option
nox.options.sessions = []
def get_oft_jar(session: nox.Session) -> Path:
oft_version = "4.1.0"
oft_jar = Path.home() / ".m2" / "repository" / "org" / "itsallcode" / "openfasttrace" / "openfasttrace" / oft_version / f"openfasttrace-{oft_version}.jar"
if not oft_jar.exists():
print(f"Downloading OpenFastTrace {oft_version}")
session.run("mvn", "--batch-mode", "org.apache.maven.plugins:maven-dependency-plugin:3.3.0:get", f"-Dartifact=org.itsallcode.openfasttrace:openfasttrace:{oft_version}")
return oft_jar
def run_oft_for_udf_client(session: nox.Session, *args) -> None:
oft_jar = get_oft_jar(session)
udf_client_base_dir = ROOT / "exaudfclient"
udf_client_src_dir = udf_client_base_dir / "base"
with session.chdir(ROOT):
session.run(
"java",
"-jar",
oft_jar,
"trace",
"-a",
"feat,req,dsn",
f"{udf_client_base_dir}/docs",
f"{udf_client_src_dir}",
"-t",
"V2,_",
*args
)
@nox.session(name="run-oft", python=False)
def run_oft_udf_client_plaintext(session: nox.Session):
"""
Downloads (if needed) OFT and executes it for the udf client for tag "V2,_" printing the output to stdout.
"""
run_oft_for_udf_client(session)
@nox.session(name="run-oft-html", python=False)
def run_oft_udf_client_html(session: nox.Session):
"""
Downloads (if needed) OFT and executes it for the udf client for tag "V2,_" creating a html page as output.
"""
html_file = session.posargs[0] if session.posargs else "report.html"
run_oft_for_udf_client(session, "-o", "html", "-f", html_file)