From 24efd235d1794ec18d25c3ece6fbdf50e02d1b49 Mon Sep 17 00:00:00 2001 From: Peter Trifanov Date: Fri, 20 Dec 2024 10:22:41 +0100 Subject: [PATCH] Update README --- README.md | 10 ++++++-- sonar-go-to-slang/README.md | 47 +++++++++++++++++++++++++++---------- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 584517bd..3525a132 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/sonar-go-to-slang/README.md b/sonar-go-to-slang/README.md index 30832381..10ca13ae 100644 --- a/sonar-go-to-slang/README.md +++ b/sonar-go-to-slang/README.md @@ -4,23 +4,38 @@ 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: @@ -28,9 +43,9 @@ Creating the symbolic link by hand solves this problem: * 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 @@ -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`.