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

SONARGO-91 Update README #59

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
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
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`.
Loading