parser.add_argument("--timeout", help="Execution timeout of mvn compile/test/package", default=None) args = parser.parse_args() working_directory = tempfile.mkdtemp() project = Project(args.url) project.clone(working_directory) project.checkout_commit(args.commit) if len(project.pom.poms) == 0: os._exit(os.EX_OK) project.compile(timeout=args.timeout, stdout="out.log") packages = [ "org.json", "org.json.simple", "com.google.gson", "com.fasterxml.jackson.databind", "com.fasterxml.jackson.core", "org.eclipse.yasson", "org.glassfish.json", "com.alibaba.fastjson" ] pathes = [] for p in Path(project.path).rglob('target'): if os.path.exists(os.path.join(p, "classes")): pathes.append(os.path.join(p, "classes")) cmd = "java -cp depswap.jar se.kth.assertteam.depanalyzer.Analyzer %s %s" % ( ",".join(pathes), ",".join(packages))
output = { "commit": project.get_commit(), "root": os.path.dirname(project.pom.poms[0]["path"]).replace(project.path, ""), "test_results": [], "start": time.time(), "env": getEnv() } if args.coverage: project.inject_jacoco_plugin() log_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "output.log") project.compile(clean=False, stdout=log_path, timeout="10m") output['compile-log'] = "" if os.path.exists(log_path): with open(log_path, 'r') as fd: output['compile-log'] = fd.read() output['test-logs'] = [] for i in range(0, args.iteration): #project.test(clean=False) project.test(clean=False, stdout=log_path, timeout=args.timeout) if os.path.exists(log_path): with open(log_path, 'r') as fd: output['test-logs'].append(fd.read()) if args.output is not None: project.copy_test_results(args.output) if args.coverage: project.copy_jacoco(args.output)