Skip to content

Commit

Permalink
cmd: Move binary under new scip/ subdirectory (#191)
Browse files Browse the repository at this point in the history
## Test plan

Covered by existing tests
  • Loading branch information
varungandhi-src authored Jul 24, 2023
1 parent 720091e commit 860dae2
Show file tree
Hide file tree
Showing 81 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
sha256sum: true
project_path: cmd
project_path: cmd/scip
binary_name: scip
ldflags: "-X 'main.Reproducible=true'"
asset_name: scip-${{ matrix.goos }}-${{ matrix.goarch }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reprolang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ jobs:
- uses: ./.github/actions/asdf
with:
js: true
- run: ./cmd/tests/reprolang/generate-tree-sitter-parser.sh
- run: ./cmd/scip/tests/reprolang/generate-tree-sitter-parser.sh
- run: git diff --exit-code
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
- run: cargo check
working-directory: bindings/rust
- run: cargo check
working-directory: cmd/tests/reprolang
working-directory: cmd/scip/tests/reprolang
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
*.test

# CLI binary
cmd/cmd
cmd/scip
/scip

# Output of the go coverage tool, specifically when used with LiteIDE
Expand Down
18 changes: 9 additions & 9 deletions Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
functionality, such as for converting a SCIP index into an LSIF index.
This is used by the CLI below as well as the
[Sourcegraph CLI](https://github.com/sourcegraph/src-cli).
- [cmd/](./cmd/): CLI for SCIP.
- [cmd/tests/](./cmd/tests/): Test data and packages for SCIP.
- [cmd/tests/reprolang/](./cmd/tests/reprolang/): A verbose, small language
- [cmd/scip](./cmd/scip): CLI for SCIP.
- [cmd/scip/tests/](./cmd/scip/tests/): Test data and packages for SCIP.
- [cmd/scip/tests/reprolang/](./cmd/scip/tests/reprolang/): A verbose, small language
which consists of declarations, references, imports and other minor bits
of functionality, which is used to test the SCIP CLI. The language is
defined using a [tree-sitter grammar](cmd/tests/reprolang/grammar.js).
defined using a [tree-sitter grammar](cmd/scip/tests/reprolang/grammar.js).
This functionality not meant for use outside of this repository.
- [docs/](./docs/): Auto-generated documentation.

Expand All @@ -33,11 +33,11 @@
For the Haskell bindings, see `bindings/haskell/README.md`.
2. Regenerating snapshots after making changes to the CLI.
```
go test ./cmd -update-snapshots
go test ./cmd/scip -update-snapshots
```
3. Regenerating parser for Repro after editing its grammar.
```
cd cmd/tests/reprolang
cd cmd/scip/tests/reprolang
./generate-tree-sitter-parser.sh
```

Expand Down Expand Up @@ -76,19 +76,19 @@ To do this, add a test file (and implement any new functionality) first.
Then, regenerate the LSIF index with absolute paths.

```bash
go test ./cmd -update-snapshots -debug-snapshot-abspaths
go test ./cmd/scip -update-snapshots -debug-snapshot-abspaths
```

The LSIF index can be uploaded to a local Sourcegraph instance using:

```bash
PACKAGE=MY_PACKAGE_NAME SRC_ACCESS_TOKEN=MY_TOKEN SRC_ENDPOINT=https://sourcegraph.test:3443 src code-intel upload -file="cmd/tests/snapshots/output/$PACKAGE/dump.lsif" -root="cmd/tests/snapshots/input/$PACKAGE"
PACKAGE=MY_PACKAGE_NAME SRC_ACCESS_TOKEN=MY_TOKEN SRC_ENDPOINT=https://sourcegraph.test:3443 src code-intel upload -file="cmd/scip/tests/snapshots/output/$PACKAGE/dump.lsif" -root="cmd/scip/tests/snapshots/input/$PACKAGE"
```

## Release a new version

First, add release notes to the [CHANGELOG](CHANGELOG.md).
Next, update the version in `cmd/version.txt`.
Next, update the version in `cmd/scip/version.txt`.

After landing a commit with those two changes, run the release script:
(requires the [GitHub CLI](https://cli.github.com/))
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ You can also compile a binary locally using:
```sh
git clone https://github.com/sourcegraph/scip.git --depth=1
cd scip
go build -o scip ./cmd
go build ./cmd/scip
```

You can consult the [CLI reference](docs/CLI.md) or `--help` for usage information.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions cmd/main_test.go → cmd/scip/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

"github.com/sourcegraph/scip/bindings/go/scip"
"github.com/sourcegraph/scip/bindings/go/scip/testutil"
"github.com/sourcegraph/scip/cmd/tests/reprolang/bindings/go/repro"
"github.com/sourcegraph/scip/cmd/scip/tests/reprolang/bindings/go/repro"
)

func TestMain(m *testing.M) {
Expand All @@ -25,7 +25,7 @@ func TestMain(m *testing.M) {

func TestCLIReferenceInSync(t *testing.T) {
app := scipApp()
readmeBytes, err := os.ReadFile(filepath.Join("..", "docs", "CLI.md"))
readmeBytes, err := os.ReadFile(filepath.Join("..", "..", "docs", "CLI.md"))
require.Nil(t, err)
readme := string(readmeBytes)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "tree-sitter-repro"
description = "repro grammar for the tree-sitter parsing library"
version = "0.1.0"
repository = "https://github.com/sourcegraph/scip/cmd/tests/reprolang"
repository = "https://github.com/sourcegraph/scip/cmd/scip/tests/reprolang"
edition = "2021"
license = "Apache-2.0"

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package repro

import (
"context"
reproGrammar "github.com/sourcegraph/scip/cmd/tests/reprolang/src"
reproGrammar "github.com/sourcegraph/scip/cmd/scip/tests/reprolang/src"

sitter "github.com/smacker/go-tree-sitter"

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd "$SCRIPT_DIR"
yarn install
./node_modules/.bin/tree-sitter generate
yarn --cwd ../../.. run prettier
yarn --cwd ../../../.. run prettier
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions dev/publish-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ if ! grep -q "## v$NEW_VERSION" CHANGELOG.md; then
exit 1
fi

if ! grep -q "$NEW_VERSION" cmd/version.txt; then
echo "error: SCIP version in cmd/version.txt doesn't match NEW_VERSION=$NEW_VERSION"
if ! grep -q "$NEW_VERSION" cmd/scip/version.txt; then
echo "error: SCIP version in cmd/scip/version.txt doesn't match NEW_VERSION=$NEW_VERSION"
exit 1
fi

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"workspaces": {
"packages": [
"cmd/tests/reprolang",
"cmd/scip/tests/reprolang",
"bindings/typescript"
]
},
Expand Down

0 comments on commit 860dae2

Please sign in to comment.