Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update instructions for ArkAnalyzer #306

Merged
merged 2 commits into from
Feb 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion jacodb-ets/ARKANALYZER.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ npm run build

The `npm run build` command will generate the `out` directory, which contains the compiled code.

### Usage of forked ArkAnalyzer

Most probably, you will have to use our fork of ArkAnalyzer (https://gitee.com/Lipenx/arkanalyzer) and checkout a specific branch that is consistent with the current state of jacodb.
For this, replace the repo url in the commands above and use `git switch <branch>` to checkout the desired branch.

> Latest supported AA branch is `neo/2025-02-13`.

## Serialize TS to JSON

To serialize ArkIR to JSON for TypeScript files/projects, use the `serializeArkIR.ts` script:
Expand All @@ -35,11 +42,34 @@ Options:
-h, --help display help for command
```

You can also use `node <out>/serializeArkIR.js` directly (note the `.js` extension here!) instead of `npx`. Remember to run `npm run build` beforehand.
You can also use `node <out>/serializeArkIR.js` directly (note the `.js` extension here!) instead of `npx ts-node`.
Remember to run `npm run build` beforehand.

For example, to serialize ArkIR for all TS files in `resources/ts/` into the corresponding JSON files in `resources/ir/`, run:

```shell
cd .../resources
npx ts-node ~/dev/arkanalyzer/out/src/save/serializeArkIR.ts -m ts ir
```

## Serialize sample projects and test the deserialization

To test the serialization/deserialization pipeline in jacodb, first prepare and serialize the projects using `prepare_repos.sh` (pulls repos with sources) and `prepare_projects.sh` (serializes all projects) scripts:

```shell
cd jacodb-ets/src/test/resources
bash prepare_repos.sh
bash prepare_projects.sh
```

(Use `-f` flag for `prepare_projects.sh` to force re-serialization, that is, override already existing folders.)

Then, to test the serialization, run jacodb tests devoted to the serialization:

```shell

The, run jacodb tests devoted to the deserialization:

```shell
gw :jacodb-ets:test --tests "org.jacodb.ets.test.EtsFromJsonTest"
```