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

Adding support for Cargo projects #229

Open
wants to merge 46 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
f5ca7c8
Update extractors
omerzi Mar 2, 2023
3a63fa3
Merge branch 'dev'
omerzi Mar 2, 2023
9b6f2ec
Merge remote-tracking branch 'origin/dev' into main
Mar 16, 2023
40746ff
Merge remote-tracking branch 'origin/dev' into main
Mar 30, 2023
f82eb2a
Merge remote-tracking branch 'origin/dev' into main
Apr 5, 2023
1b55b8e
Added the Frogbot badge to the README (#149)
eyalbe4 Apr 17, 2023
b43d10a
Merge remote-tracking branch 'origin/dev' into main
Apr 19, 2023
3dbcb66
Merge remote-tracking branch 'origin/dev'
May 2, 2023
a6ed2e8
Update build-info.json file
May 2, 2023
ba63a12
Merge branch 'dev'
eyalbe4 May 16, 2023
d5f085c
Merge remote-tracking branch 'origin/dev'
May 17, 2023
f8c55ae
Update build-info.json file
May 17, 2023
fd423d1
Merge remote-tracking branch 'origin/dev'
May 21, 2023
cfa0fbe
Update build-info.json file
May 21, 2023
e9d7384
Merge branch 'dev'
eyalbe4 Aug 3, 2023
3ba95cb
Merge branch 'dev'
eyalbe4 Aug 23, 2023
f59e207
Merge remote-tracking branch 'origin/dev'
Aug 28, 2023
47163a1
Update build-info.json file
Aug 28, 2023
2d262ac
Merge remote-tracking branch 'origin/dev'
Sep 10, 2023
3840bf7
Update build-info.json file
Sep 10, 2023
18a9764
Merge remote-tracking branch 'origin/dev'
Oct 2, 2023
c1806a1
Update build-info.json file
Oct 2, 2023
5c81687
Merge remote-tracking branch 'origin/dev'
Oct 3, 2023
724a12d
Update build-info.json file
Oct 3, 2023
b7da476
Merge remote-tracking branch 'origin/dev'
Oct 17, 2023
acedab0
Update build-info.json file
Oct 17, 2023
8baba5b
Merge remote-tracking branch 'origin/dev'
Oct 22, 2023
9974f77
Update build-info.json file
Oct 22, 2023
72ee49f
Merge remote-tracking branch 'origin/dev'
Nov 8, 2023
a3859fa
Update build-info.json file
Nov 8, 2023
4e0249b
Merge remote-tracking branch 'origin/dev'
Nov 30, 2023
22352c3
Update build-info.json file
Nov 30, 2023
be08b3b
Merge remote-tracking branch 'origin/dev'
Dec 14, 2023
ce06f3a
Update build-info.json file
Dec 14, 2023
b32f822
Merge branch 'dev'
eyalbe4 Dec 20, 2023
b4e5f37
Merge remote-tracking branch 'origin/dev'
Dec 27, 2023
b562564
Update build-info.json file
Dec 27, 2023
bbe54b3
Merge remote-tracking branch 'origin/dev'
Jan 7, 2024
52d39ac
Update build-info.json file
Jan 7, 2024
e23873e
Merge branch 'main' into dev
eyalbe4 Jan 21, 2024
6d8e360
Merge branch 'dev'
eyalbe4 Jan 21, 2024
42699eb
added cargo support
shimib Jan 31, 2024
b5ac289
Adding Cargo Support
shimib Jan 31, 2024
63f154c
fixing code style
shimib Jan 31, 2024
ce48e0a
Adding Cargo test
shimib Jan 31, 2024
82fa8c1
until figuring how cargo is easily installed with github actions on w…
shimib Jan 31, 2024
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
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,12 @@ bi dotnet [Dotnet command] [command options]
bi nuget [Nuget command] [command options]
```

#### Cargo

```shell
bi cargo [Cargo command] [command options]
```

#### Conversion to CycloneDX

You can generate build-info and have it converted into the CycloneDX format by adding to the
Expand Down Expand Up @@ -527,6 +533,15 @@ nugetModule, err := bld.AddNugetModules(nugetProjectPath)
err = nugetModule.CalcDependencies()
```

#### Cargo

```go
// You can pass an empty string as an argument, if the root of the Cargo project is the working directory.
cargoModule, err := bld.AddCargoModules(cargoProjectPath)
// Calculate the dependencies used by this module, and store them in the module struct.
err = cargoModule.CalcDependencies()
```

### Collecting Environment Variables

Using `CollectEnv()` you can collect environment variables and attach them to the build.
Expand Down
351 changes: 351 additions & 0 deletions build-info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,351 @@
{
"name": "go-build",
"number": "1",
"agent": {},
"buildAgent": {
"name": "GENERIC"
},
"modules": [
{
"type": "go",
"id": "github.com/jfrog/build-info-go",
"dependencies": [
{
"id": "github.com/buger/jsonparser:v1.1.1",
"type": "zip",
"requestedBy": [
[
"github.com/jfrog/build-info-go"
]
],
"sha1": "e0c54d96564262a70bc7ed33fb3ee2b15596f68f",
"md5": "7ab77d10951f73b96b9c19a6cca51bb1",
"sha256": "be17ef1b44c22eac645eeac80f0e26cdfc70d77262e631358e00c2aa817eab8c"
},
{
"id": "github.com/urfave/cli/v2:v2.25.7",
"type": "zip",
"requestedBy": [
[
"github.com/jfrog/build-info-go"
]
],
"sha1": "c93f96a6feceef906da4bdb4d337ad5fa9e5048d",
"md5": "b5bbdbfb52f8f83b451200a216b6d504",
"sha256": "10941b24689d7c953a78b6d196a03e04274e012d27d4f297fe844cf58221a86c"
},
{
"id": "github.com/cpuguy83/go-md2man/v2:v2.0.2",
"type": "zip",
"requestedBy": [
[
"github.com/jfrog/build-info-go"
],
[
"github.com/urfave/cli/v2:v2.25.7",
"github.com/jfrog/build-info-go"
]
],
"sha1": "cab8c09415bb3aa49892aac866a2732980d44c95",
"md5": "86a066c9aaad807da54f481b8286f8ce",
"sha256": "70a7e609809cf2a92c5535104db5eb82d75c54bfcfed2d224e87dd2fd9729f62"
},
{
"id": "github.com/minio/sha256-simd:v1.0.1",
"type": "zip",
"requestedBy": [
[
"github.com/jfrog/build-info-go"
]
],
"sha1": "c6b381b6f945ddea88df93edebf185f29c7fc477",
"md5": "89452597fdd0efbda45051a98284f8cd",
"sha256": "e8805d8f0438b7fa0286c0cb160180ad8fc726e06bca1eabcd59c142523c625c"
},
{
"id": "github.com/jfrog/gofrog:v1.4.1",
"type": "zip",
"requestedBy": [
[
"github.com/jfrog/build-info-go"
]
],
"sha1": "0461da8f5992650adfed08958b6128ccf762ad19",
"md5": "b99ca543f9b6f8978e9e7013c5154493",
"sha256": "2d527597437427ca2b1ca1da5d29123cfaf0b64a916565647b788f7ee7ded5ab"
},
{
"id": "github.com/xeipuuv/gojsonpointer:v0.0.0-20180127040702-4e3ac2762d5f",
"type": "zip",
"requestedBy": [
[
"github.com/CycloneDX/cyclonedx-go:v0.7.2",
"github.com/jfrog/build-info-go"
],
[
"github.com/jfrog/build-info-go"
],
[
"github.com/xeipuuv/gojsonschema:v1.2.0",
"github.com/CycloneDX/cyclonedx-go:v0.7.2",
"github.com/jfrog/build-info-go"
],
[
"github.com/xeipuuv/gojsonschema:v1.2.0",
"github.com/jfrog/build-info-go"
]
],
"sha1": "c00ffab826fdd7e3aa1284ed3a0918cbdf2ec095",
"md5": "812aaf45e505b2953d31a75ce668e46e",
"sha256": "5b1a4bcc8e003f214c92b3fa52959d9eb0e3af1c0c529efa55815db951146e48"
},
{
"id": "github.com/russross/blackfriday/v2:v2.1.0",
"type": "zip",
"requestedBy": [
[
"github.com/jfrog/build-info-go"
],
[
"github.com/cpuguy83/go-md2man/v2:v2.0.2",
"github.com/jfrog/build-info-go"
],
[
"github.com/cpuguy83/go-md2man/v2:v2.0.2",
"github.com/urfave/cli/v2:v2.25.7",
"github.com/jfrog/build-info-go"
],
[
"github.com/urfave/cli/v2:v2.25.7",
"github.com/jfrog/build-info-go"
]
],
"sha1": "b733cda2c795193ad2a65e13dcd7529b93bf04e9",
"md5": "eea4411c54002a5fb7d0db351270eefe",
"sha256": "7852750d58a053ce38b01f2c203208817564f552ebf371b2b630081d7004c6ae"
},
{
"id": "github.com/davecgh/go-spew:v1.1.1",
"type": "zip",
"requestedBy": [
[
"github.com/CycloneDX/cyclonedx-go:v0.7.2",
"github.com/jfrog/build-info-go"
],
[
"github.com/jfrog/build-info-go"
],
[
"github.com/jfrog/gofrog:v1.4.1",
"github.com/jfrog/build-info-go"
],
[
"github.com/stretchr/testify:v1.8.4",
"github.com/CycloneDX/cyclonedx-go:v0.7.2",
"github.com/jfrog/build-info-go"
],
[
"github.com/stretchr/testify:v1.8.4",
"github.com/jfrog/build-info-go"
]
],
"sha1": "0f9760bda0c6ccacac5e57f62d0f5ad9c7dab03f",
"md5": "feef6644bd69286382139b28be3f0b91",
"sha256": "6b44a843951f371b7010c754ecc3cabefe815d5ced1c5b9409fb2d697e8a890d"
},
{
"id": "github.com/klauspost/cpuid/v2:v2.2.3",
"type": "zip",
"requestedBy": [
[
"github.com/jfrog/build-info-go"
],
[
"github.com/minio/sha256-simd:v1.0.1",
"github.com/jfrog/build-info-go"
]
],
"sha1": "6429461f86edd94bb679272748c522f41f6453df",
"md5": "1bbcae037201b315dccd6e535b20bca0",
"sha256": "f68ff82caa807940fee615b4898d428365761eeb36861959ca8b91a034bd0e7e"
},
{
"id": "github.com/!burnt!sushi/toml:v1.3.2",
"type": "zip",
"requestedBy": [
[
"github.com/jfrog/build-info-go"
],
[
"github.com/urfave/cli/v2:v2.25.7",
"github.com/jfrog/build-info-go"
]
],
"sha1": "a0fc876bb92fdbe9ad75c300588f2c63e954985c",
"md5": "e06df9631c9e1897912dfa92a40b4928",
"sha256": "5de246a0cb4c256f3fd5d0db8a08a114f58af0c2e193bbf0ad9012104adbb6b2"
},
{
"id": "github.com/xrash/smetrics:v0.0.0-20201216005158-039620a65673",
"type": "zip",
"requestedBy": [
[
"github.com/urfave/cli/v2:v2.25.7",
"github.com/jfrog/build-info-go"
],
[
"github.com/jfrog/build-info-go"
]
],
"sha1": "79a771d85bf5b4df5b583c8435343b323f52995e",
"md5": "b5a17afb05c11c10713e33e390729bd7",
"sha256": "bbebb9a00f44ff3e27bec16111effdcf2706d727821a4833ec8da19aad96e26d"
},
{
"id": "github.com/!cyclone!d!x/cyclonedx-go:v0.7.2",
"type": "zip",
"requestedBy": [
[
"github.com/jfrog/build-info-go"
]
],
"sha1": "ca3fae95bf1b898f1dff98f4ea7c2de175f4d4ff",
"md5": "e6c907f90de64339ee4d4222a3de7f1a",
"sha256": "0ec9a7c538af92e884d7caed88c62890d5eaadc3d0bb0e2e0e0d7c5d0cb5fdbb"
},
{
"id": "github.com/xeipuuv/gojsonschema:v1.2.0",
"type": "zip",
"requestedBy": [
[
"github.com/CycloneDX/cyclonedx-go:v0.7.2",
"github.com/jfrog/build-info-go"
],
[
"github.com/jfrog/build-info-go"
]
],
"sha1": "e1529901eb2cf8c9ff2b1fbf504cb08d05d3d578",
"md5": "ebbf84ea1a07065b100c33e2736e6d03",
"sha256": "55c8ce068257aa0d263aad7470113dafcd50f955ee754fc853c2fdcd31ad096f"
},
{
"id": "github.com/xeipuuv/gojsonreference:v0.0.0-20180127040603-bd5ef7bd5415",
"type": "zip",
"requestedBy": [
[
"github.com/CycloneDX/cyclonedx-go:v0.7.2",
"github.com/jfrog/build-info-go"
],
[
"github.com/jfrog/build-info-go"
],
[
"github.com/xeipuuv/gojsonschema:v1.2.0",
"github.com/CycloneDX/cyclonedx-go:v0.7.2",
"github.com/jfrog/build-info-go"
],
[
"github.com/xeipuuv/gojsonschema:v1.2.0",
"github.com/jfrog/build-info-go"
]
],
"sha1": "133e9c4987a455db1a748f79522b79e95bd395ff",
"md5": "1355152ef669012354342f3f0a133987",
"sha256": "7ec98f4df894413f4dc58c8df330ca8b24ff425b05a8e1074c3028c99f7e45e7"
},
{
"id": "gopkg.in/yaml.v3:v3.0.1",
"type": "zip",
"requestedBy": [
[
"github.com/CycloneDX/cyclonedx-go:v0.7.2",
"github.com/jfrog/build-info-go"
],
[
"github.com/jfrog/gofrog:v1.4.1",
"github.com/jfrog/build-info-go"
],
[
"github.com/stretchr/testify:v1.8.4",
"github.com/CycloneDX/cyclonedx-go:v0.7.2",
"github.com/jfrog/build-info-go"
],
[
"github.com/stretchr/testify:v1.8.4",
"github.com/jfrog/build-info-go"
],
[
"github.com/urfave/cli/v2:v2.25.7",
"github.com/jfrog/build-info-go"
],
[
"github.com/jfrog/build-info-go"
]
],
"sha1": "65825246447882d6f2bddb3f89ac4b9abc2612ef",
"md5": "292e318d64256fb05395c45c176c94c2",
"sha256": "aab8fbc4e6300ea08e6afe1caea18a21c90c79f489f52c53e2f20431f1a9a015"
},
{
"id": "github.com/pmezard/go-difflib:v1.0.0",
"type": "zip",
"requestedBy": [
[
"github.com/CycloneDX/cyclonedx-go:v0.7.2",
"github.com/jfrog/build-info-go"
],
[
"github.com/jfrog/gofrog:v1.4.1",
"github.com/jfrog/build-info-go"
],
[
"github.com/jfrog/build-info-go"
],
[
"github.com/stretchr/testify:v1.8.4",
"github.com/CycloneDX/cyclonedx-go:v0.7.2",
"github.com/jfrog/build-info-go"
],
[
"github.com/stretchr/testify:v1.8.4",
"github.com/jfrog/build-info-go"
]
],
"sha1": "f200e2a5211b527ef2d2ff301718ccc4ad5c705b",
"md5": "fb72df530a7f3fca56ccc192c9f30a58",
"sha256": "de04cecc1a4b8d53e4357051026794bcbc54f2e6a260cfac508ce69d5d6457a0"
},
{
"id": "github.com/stretchr/testify:v1.8.4",
"type": "zip",
"requestedBy": [
[
"github.com/CycloneDX/cyclonedx-go:v0.7.2",
"github.com/jfrog/build-info-go"
],
[
"github.com/jfrog/build-info-go"
]
],
"sha1": "874d98aac38304b0ac3e046475fb39f11219d5c0",
"md5": "7bbb2058ef66c6829ebd3b652aff5296",
"sha256": "e206daaede0bd03de060bdfbeb984ac2c49b83058753fffc93fe0c220ea87532"
},
{
"id": "golang.org/x/exp:v0.0.0-20230905200255-921286631fa9",
"type": "zip",
"requestedBy": [
[
"github.com/jfrog/build-info-go"
]
],
"sha1": "34532361e43d59695caabf5248d0464aae3561b9",
"md5": "a351a01d700150d778eeae97bd6859d0",
"sha256": "e789921a203695edf0d1bffc98b0f76b5f9a264c2f88ef084a2ea9a768081f85"
}
]
}
],
"started": "2024-01-07T11:48:00.759+0000"
}
5 changes: 5 additions & 0 deletions build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ func (b *Build) AddGoModule(srcPath string) (*GoModule, error) {
return newGoModule(srcPath, b)
}

// AddCargoModule adds a Go module to this Build. Pass srcPath as an empty string if the root of the Cargo project is the working directory.
func (b *Build) AddCargoModule(srcPath string) (*CargoModule, error) {
return newCargoModule(srcPath, b)
}

// AddMavenModule adds a Maven module to this Build. Pass srcPath as an empty string if the root of the Maven project is the working directory.
func (b *Build) AddMavenModule(srcPath string) (*MavenModule, error) {
return newMavenModule(b, srcPath)
Expand Down
Loading
Loading