-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.js
95 lines (78 loc) · 3.15 KB
/
constants.js
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
const path = require('path');
const fs = require('fs');
/*
****** ! ** ! ** ! ** ! ** ! ** ! ** ! ** ! ** ! ** ! ** ! *******
**** ******
*** Fill the following constants before running the tool *****
**** ******
******************************************************************
*/
/**
* your repository HTTP address
*/
const REPO_URL = "https://github.com/expressjs/express.git"
// const REPO_URL = "https://github.com/expressjs/session.git"
/**
* the main branch of your repository; it is usually master or main.
*/
const REPO_MAIN_BRANCH = "master" //
/**
* the relative address of your project's test directory
* Example:
* Assume your project's test directory is GreatProject/subdir/tests/
* you should set REPO_TEST_RELATIVE_DIR="subdir/tests/"
*/
const REPO_TEST_RELATIVE_DIR = "test";
/**
* the relative addresses of your project's test subdirectories that must be excluded.
* Example:
* Assume your project's test directory is GreatProject/subdir/tests/
* and you want GreatProject/subdir/tests/fixture/ to be excluded.
* you should set REPO_TEST_EXCLUDED_DIRS = ["fixture"]
*/
const REPO_TEST_EXCLUDED_DIRS = [];
/**
* The first commits with which you want to begin the whole analysis.
* You can leave it empty if you want to begin with the latest one.
*/
const SEED_COMMIT = "" //
/**
* Where you want to keep the dependencies and the final report.
* By default it's addressed to "data/"
*/
let DATA_PATH = __dirname + path.sep + 'data'
const PROJECT_NAME = [...REPO_URL.matchAll("[\\w\\.-]+(?=.git)")].pop();
/**
* REPO_PATH, Your project path
*/
const REPO_PATH = DATA_PATH + path.sep + PROJECT_NAME;
/*
****************************************************************************
**** ******
*** NO NEED TO CHANGE THE FOLLOWING VARIABLES (of course you can!) *****
**** ******
****************************************************************************
*/
/**
* DA execution commands
*/
const DA_COMMAND = `$GRAAL_HOME${path.sep}bin${path.sep}node --nodeprof.Scope=app --jvm --experimental-options --vm.Dtruffle.class.path.append=$NODEPROF_HOME${path.sep}nodeprof.jar --nodeprof $NODEPROF_HOME${path.sep}jalangi.js --analysis utils.js --analysis analyser.js runner.mjs`;
/**
* reported data paths
*/
const DA_DEPENDENCIES_PATH = DATA_PATH + path.sep + "dependencies.json"; // recorded dependencies by dynamic analysis
const Caprese_RESULT_PATH = DATA_PATH + path.sep + "caprese.json"; // caprese result
if (!fs.existsSync(DATA_PATH)) {
fs.mkdirSync(DATA_PATH);
addFile(DA_DEPENDENCIES_PATH, "{}")
addFile(Caprese_RESULT_PATH, "")
}
function addFile(filePath, data) {
if (fs.existsSync(filePath)) {
fs.writeFileSync(filePath, data)
}
}
module.exports = {
REPO_URL, PROJECT_NAME, REPO_TEST_RELATIVE_DIR, SEED_COMMIT, REPO_PATH, REPO_MAIN_BRANCH,
REPO_TEST_EXCLUDED_DIRS, DATA_PATH, DA_COMMAND, DA_DEPENDENCIES_PATH, Caprese_RESULT_PATH,
}