Skip to content

Commit

Permalink
Rearrange JS dependencies so we can build parseq-tracevis with Python…
Browse files Browse the repository at this point in the history
… 3+ (#337)

Pinning Python to 2.7 is not working anymore since GitHub dropped support for
Python 2.7. We originally pinned it to avoid an issue where `node-gyp` fails
when combined with Python 3.x during `npm install`. The reasons for this failure
are:

- `d3` depends either directly or transitively on `contextify`, a _really_ old
  library that needs native code from V8 to install.
- `contextify` builds native code via `node-gyp`.
- The version of `node-gyp` used does not play well with Python 3.x.

A proper path forward would be to update and modernize the entire JavaScript
stack used in `parseq-tracevis` -- which is a non-trivial amount of work.

As a workaround, we can use a pre-built version of `d3`. A local copy of `d3`
v3.x has been added to the local repository, and the dependency on `d3` has been
removed from `package.json`. Doing this avoids the need for building native
code, and thus the need for `node-gyp`. This allows us to build using Python 3.x
because now there is no conflict.
  • Loading branch information
zackthehuman authored Oct 13, 2023
1 parent 3e6e50b commit 51ce337
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@ jobs:
with:
# Need to fetch 2 commits for the PR (base commit and head merge commit) so we can compute the diff
fetch-depth: 2
- uses: actions/setup-python@v2
with:
python-version: '2.7.18'
- uses: actions/setup-java@v2
with:
distribution: zulu
java-version: ${{ matrix.java }}
cache: gradle
- run: ./.github/scripts/build.sh
- run: ./.github/scripts/build.sh
5 changes: 1 addition & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ jobs:
distribution: zulu
java-version: ${{ matrix.java }}
# Do NOT use caching, since we want to ensure published artifacts are fresh
- uses: actions/setup-python@v2
with:
python-version: '2.7.18'
- run: ./.github/scripts/publish.sh
env:
JFROG_USER: ${{ secrets.JFROG_USER }}
JFROG_KEY: ${{ secrets.JFROG_KEY }}
JFROG_KEY: ${{ secrets.JFROG_KEY }}
2 changes: 1 addition & 1 deletion subprojects/parseq-tracevis/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ task buildTracevisJS(type: Copy, dependsOn: ['buildModuleJS', 'buildModuleMinJS'
}

from(".") {
include 'node_modules/d3/d3.min.js'
include 'js/d3.v3.min.js'
include 'js/d3.slider.js'
include 'node_modules/svg-injector/dist/svg-injector.min.js'
include 'node_modules/svg-injector/dist/svg-injector.map.js'
Expand Down
5 changes: 5 additions & 0 deletions subprojects/parseq-tracevis/js/d3.v3.min.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion subprojects/parseq-tracevis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"uglify-js": "2.6.0"
},
"dependencies": {
"d3": "3.3.5",
"graphlib": "0.7.4",
"graphlib-dot": "0.4.9",
"sha1": "1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion subprojects/parseq-tracevis/trace.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ <h4 style="text-align: center;">ParSeq JSON Trace Viewer vX.X.X</h4>

<div id="resultView" class="row-fluid"/>

<script src="node_modules/d3/d3.js"></script>
<script src="js/d3.v3.min.js"></script>
<script src="build/parseq-tracevis.js"></script>
<script src="node_modules/svg-injector/svg-injector.js"></script>
<script src="node_modules/svg-pan-zoom/dist/svg-pan-zoom.js"></script>
Expand Down

0 comments on commit 51ce337

Please sign in to comment.