Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
petertrr committed Dec 20, 2024
1 parent 813a5a4 commit 24efd23
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 15 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ To provide feedback (request a feature, report a bug, etc.) use the [SonarQube C

### Setup

If you are on Windows, read the [sonar-go-to-slang/README.md](sonar-go-to-slang/README.md) instructions.
To configure build dependencies, run the following command:

```shell
git submodule update --init -- build-logic
```

Additionally, if you are on Windows, read the [sonar-go-to-slang/README.md](sonar-go-to-slang/README.md) instructions.


### Build
Expand All @@ -35,7 +41,7 @@ If you want to run them, you need first to retrieve the related projects which a
git submodule update --init
```

Then build and run the Integration Tests using the `its` property:
Then build and run the Integration Tests using the `integrationTest` task:

```shell
./gradlew integrationTest --info --no-daemon
Expand Down
47 changes: 34 additions & 13 deletions sonar-go-to-slang/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,48 @@ Generate slang serialized AST in JSON from a go source file.

## Building

The entire build process can be done with the `make.sh` script. The following command will
download Go of the required version and build the project:

```shell
./make.sh build
```

Individual build steps are described below.

To generate `goparser_generated.go` file in current directory, run:

go generate
```shell
go generate
```

To create `sonar-go-to-slang` executable in current directory, run:

go build
```shell
go build
```

To create `sonar-go-to-slang` executable in `$GOPATH/bin`, run:

go install

```shell
go install
```

### Building on Windows

When trying to build `sonar-go-to-slang` on Windows, the build may fail with the following error:

> Create symbolic link at [...]\slang\sonar-go-to-slang\.gogradle\project_gopath\src\github.com\SonarSource\slang\sonar-go-to-slang failed
> Create symbolic link at [...]\slang\sonar-go-to-slang\.gogradle\project_gopath\src\github.com\SonarSource\slang\sonar-go-to-slang failed
Creating the symbolic link by hand solves this problem:

* (Eventually enable [developer mode in Windows](https://docs.microsoft.com/en-us/windows/uwp/get-started/enable-your-device-for-development))

* Run (in `sonar-go-to-slang` folder):


```shell
mklink /D ".gogradle\project_gopath\src\github.com\SonarSource\slang\sonar-go-to-slang" "Absolute\Path\To\slang\sonar-go-to-slang"

```

## Running

Expand All @@ -40,16 +55,22 @@ Run with `-h` or `-help` or `--help` to get usage help.

Print the SLANG Json tree for some `source.go`:

sonar-go-to-slang source.go
```shell
sonar-go-to-slang source.go
```

Dump the native raw AST for some `source.go`:

sonar-go-to-slang -d source.go

```shell
sonar-go-to-slang -d source.go
```

## Testing

To perform the tests, run:

go test

To update expected test data, use the method `fix_all_go_files_test_automatically` in `goparser_test.go`
```shell
go test
```

To update expected test data, use the method `fix_all_go_files_test_automatically` in `goparser_test.go`.

0 comments on commit 24efd23

Please sign in to comment.