Skip to content

Commit 812a409

Browse files
authored
Emit index.scip instead of dump.lsif-typed (#135)
* Emit index.scip instead of dump.lsif-typed * Fix Sourcegraph upload job
1 parent 162b120 commit 812a409

File tree

6 files changed

+15
-17
lines changed

6 files changed

+15
-17
lines changed

.github/workflows/sourcegraph.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ jobs:
1212
- run: yarn install
1313
- run: yarn global add ts-node
1414
- run: ts-node src/main.ts index
15-
- name: Convert LSIF Typed into LSIF Graph
15+
- run: cp index.scip dump.lsif-typed
16+
- name: Install src-cli
1617
run: |
17-
curl -Lo lsif-typed https://github.com/sourcegraph/lsif-typescript/releases/download/v0.1.8/lsif-typed && chmod +x lsif-typed
18-
./lsif-typed dump.lsif-typed > dump.lsif
19-
- name: Upload LSIF data
20-
uses: sourcegraph/lsif-upload-action@master
21-
with:
22-
github_token: ${{ secrets.GITHUB_TOKEN }}
18+
curl -L https://sourcegraph.com/.api/src-cli/src_linux_amd64 -o src-cli
19+
chmod +x ./src-cli
20+
- run: ./src-cli lsif upload -file=dump.lsif-typed "-commit=${GITHUB_SHA}" "-github-token=${GITHUB_TOKEN}"
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Generate snapshots and update.
2525
```sh
2626
cd /path/to/dir
2727
DIR=/path/to/scip-typescript "$DIR/node_modules/.bin/ts-node" "$DIR/src/main.ts" index # add --yarn-workspaces if applicable
28-
lsif-typed dump.lsif-typed > dump.lsif # from github.com/sourcegraph/sourcegraph/lib/codeintel/tools/lsif-typed
28+
lsif-typed index.scip > dump.lsif # from github.com/sourcegraph/sourcegraph/lib/codeintel/tools/lsif-typed
2929
lsif-java snapshot-lsif # from github.com/sourcegraph/lsif-java
3030
```
3131

Dockerfile.autoindex

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM sourcegraph/src-cli:3.39.1@sha256:418225d34348a80613a6a20c6c0203d95a74a33adc6fb6e6f45af84ff60beff0 AS src-cli
1+
FROM sourcegraph/src-cli:3.40.0
22

33
# Keep in sync with default Dockerfile
44
FROM node:17.7.1-alpine3.14@sha256:cbb62fa2f740959b173b180e4806a5e479fbbd7a20072c3d6b4283bf2b9951d1
@@ -9,9 +9,7 @@ RUN apk add --no-cache git bash curl ca-certificates python3 make libstdc++ libg
99

1010
COPY --from=src-cli /usr/bin/src /usr/bin
1111

12-
RUN curl -Lo /usr/bin/lsif-typed https://github.com/sourcegraph/lsif-typescript/releases/download/v0.1.13/lsif-typed && chmod +x /usr/bin/lsif-typed
13-
14-
RUN echo 'scip-typescript "$@" --no-progress-bar && lsif-typed dump.lsif-typed > dump.lsif' > /usr/bin/scip-typescript-autoindex && chmod +x /usr/bin/scip-typescript-autoindex
12+
RUN echo 'scip-typescript "$@" --no-progress-bar' > /usr/bin/scip-typescript-autoindex && chmod +x /usr/bin/scip-typescript-autoindex
1513

1614
RUN npm install --global n@latest @sourcegraph/scip-typescript@latest
1715

src/CommandLineOptions.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ checkIndexParser([], {
2727
progressBar: true,
2828
cwd: process.cwd(),
2929
inferTsconfig: false,
30-
output: 'dump.lsif-typed',
30+
output: 'index.scip',
3131
yarnWorkspaces: false,
3232
})
3333

src/CommandLineOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function mainCommand(
4040
"whether to infer the tsconfig.json file, if it's missing",
4141
false
4242
)
43-
.option('--output <path>', 'path to the output file', 'dump.lsif-typed')
43+
.option('--output <path>', 'path to the output file', 'index.scip')
4444
.option('--no-progress-bar', 'whether to disable the progress bar')
4545
.argument('[projects...]')
4646
.action((parsedProjects, parsedOptions) => {

src/main.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ for (const snapshotDirectory of snapshotDirectories) {
4545
) as PackageJson
4646
const tsconfigJsonPath = path.join(inputRoot, 'tsconfig.json')
4747
const inferTsconfig = !fs.existsSync(tsconfigJsonPath)
48-
const output = path.join(inputRoot, 'dump.lsif-typed')
48+
const output = path.join(inputRoot, 'index.scip')
4949
indexCommand([], {
5050
cwd: inputRoot,
5151
inferTsconfig,
@@ -58,10 +58,10 @@ for (const snapshotDirectory of snapshotDirectories) {
5858
fs.rmSync(tsconfigJsonPath)
5959
}
6060
const index = lsif.lib.codeintel.lsiftyped.Index.deserializeBinary(
61-
fs.readFileSync(path.join(inputRoot, 'dump.lsif-typed'))
61+
fs.readFileSync(path.join(inputRoot, 'index.scip'))
6262
)
6363
fs.mkdirSync(outputRoot, { recursive: true })
64-
fs.renameSync(output, path.join(outputRoot, 'dump.lsif-typed'))
64+
fs.renameSync(output, path.join(outputRoot, 'index.scip'))
6565
if (index.documents.length === 0) {
6666
throw new Error('empty LSIF index')
6767
}

0 commit comments

Comments
 (0)