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

chore(dep-resolution): update dep-resolution RPC interface to support lockfiles #312

Merged
merged 5 commits into from
Nov 15, 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
58 changes: 50 additions & 8 deletions semgrep_output_v1.atd
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ type raw_json <ocaml module="Yojson.Basic" t="t"> = abstract
(*****************************************************************************)

(* File path. less: could convert directly to Path class of pathlib library for Python *)
type fpath <ocaml attr="deriving show"> <python decorator="dataclass(frozen=True)">= string wrap <ocaml module="ATD_string_wrap.Fpath">
type fpath <ocaml attr="deriving show, eq"> <python decorator="dataclass(frozen=True)">= string wrap <ocaml module="ATD_string_wrap.Fpath">

type uri = string wrap <ocaml module="ATD_string_wrap.Uri">

Expand Down Expand Up @@ -1857,6 +1857,27 @@ type format_context
is_using_registry: bool;
}

type lockfile_kind
<ocaml attr="deriving show, eq, yojson">
<python decorator="dataclass(frozen=True)"> = [
| PipRequirementsTxt
| PoetryLock
| PipfileLock
| NpmPackageLockJson
| YarnLock
| PnpmLock
| GemfileLock
| GoMod
| CargoLock
| MavenDepTree (* Not a real lockfile *)
| GradleLockfile
| ComposerLock
| NugetPackagesLockJson
| PubspecLock
| SwiftPackageResolved (* not a real lockfile *)
| MixLock
] <ocaml repr="classic">

type manifest_kind
<ocaml attr="deriving show, eq, yojson">
<python decorator="dataclass(frozen=True)"> = [
Expand All @@ -1872,7 +1893,10 @@ type manifest_kind
| PomXml
(* A Maven pom.xml manifest file - https://maven.apache.org/guides/introduction/introduction-to-the-pom.html *)
| BuildGradle
(* A Gradle build.gradle build file - https://docs.gradle.org/current/userguide/build_file_basics.html *)
(* A Gradle build.gradle build file - https://docs.gradle.org/current/userguide/build_file_basics.html *)
| SettingsGradle
(* A Gradle settings.gradle file - https://docs.gradle.org/current/userguide/settings_file_basics.html.
* Multi-project builds are defined by settings.gradle rather than build.gradle: https://docs.gradle.org/current/userguide/multi_project_builds.html#multi_project_builds *)
| ComposerJson (* composer.json - https://getcomposer.org/doc/04-schema.md *)
| NugetManifestJson
(* manifest for nuget - could not find a reference; this may not actually exist *)
Expand All @@ -1887,11 +1911,27 @@ type manifest_kind
]

type manifest
<ocaml attr="deriving show, eq">
<python decorator="dataclass(frozen=True)"> = {
kind: manifest_kind;
path: fpath;
}

type lockfile
<ocaml attr="deriving show, eq">
<python decorator="dataclass(frozen=True)"> = {
kind: lockfile_kind;
path: fpath;
}

type dependency_source
<ocaml attr="deriving show">
<python decorator="dataclass(frozen=True)"> = [
| ManifestOnlyDependencySource of manifest
| LockfileOnlyDependencySource of lockfile
| ManifestLockfileDependencySource of (manifest * lockfile)
] <ocaml repr="classic">

type resolution_error
<ocaml attr="deriving show">
<python decorator="dataclass(frozen=True)"> = [
Expand All @@ -1908,11 +1948,13 @@ type resolution_cmd_failed
message: string;
}

(* Resolution can either succeed or fail, but in either case errors can be produced
(e.g. one resolution method might fail while a worse one succeeds, lockfile parsing
might partially fail but recover and still produce results)
*)
type resolution_result = [
(* dependency_relationship items each reference an id from found_dependency.id
and the IDs of the dependencies that that item depends on *)
| ResolutionOk of found_dependency list
| ResolutionError of resolution_error
| ResolutionOk of (found_dependency list * resolution_error list)
| ResolutionError of resolution_error list
]

type dump_rule_partitions_params = {
Expand All @@ -1936,7 +1978,7 @@ type function_call
the RPC pipe.
*)
| CallValidate of fpath
| CallResolveDependencies of manifest list
| CallResolveDependencies of dependency_source list
| CallDumpRulePartitions of dump_rule_partitions_params
]

Expand All @@ -1952,7 +1994,7 @@ type function_return
| RetContributions of contributions
| RetFormatter of string
| RetValidate of bool
| RetResolveDependencies of (manifest * resolution_result) list
| RetResolveDependencies of (dependency_source * resolution_result) list
| RetDumpRulePartitions of bool
]

Expand Down
90 changes: 86 additions & 4 deletions semgrep_output_v1.jsonschema

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion semgrep_output_v1.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading