feat(ort-config): Extract a generic GitPackageCurationProvider#11941
Conversation
931a564 to
ba9faac
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11941 +/- ##
=========================================
Coverage 58.43% 58.43%
Complexity 1809 1809
=========================================
Files 361 361
Lines 13499 13499
Branches 1383 1383
=========================================
Hits 7888 7888
Misses 5115 5115
Partials 496 496
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| private val repositoryDir by lazy { | ||
| // Use a stable cache path to clone the repository to speed up subsequent runs. | ||
| (ortDataDirectory / "cache" / "git-package-curation-provider" / config.repositoryUrl.fileSystemEncode()).also { |
There was a problem hiding this comment.
Not sure about "cache" here. Should we put Git working directories into a more specifically named directory? Which BTW makes me wonder why DefaultWorkingTreeCache uses val dir = createOrtTempDir() instead.
There was a problem hiding this comment.
I just want some stable directory because it's a nice optimization when running ORT locally. "cache" made sense to me to signal that this can be deleted without causing problems (even though there is no automatic cleanup). Do you have any specific proposals for alternatives? It can also easily be changed later, if needed.
Which BTW makes me wonder why DefaultWorkingTreeCache uses val dir = createOrtTempDir() instead.
IIRC this is because the cache was made specifically for the requirements of the scanner and you would not want to permanently archive the source code of all scanned packages when running ORT locally.
There was a problem hiding this comment.
Do you have any specific proposals for alternatives?
Well, maybe any of "git", "worktree", "clone", "plugin"... but you can also keep it at "cache".
There was a problem hiding this comment.
I kind of like "plugin" because it clarifies the scope, should I change it? Or maybe we can revisit this when doing the same change for the package configuration provider.
There was a problem hiding this comment.
Or maybe we can revisit this when doing the same change for the package configuration provider.
Yes, let's do that.
| val revision: String?, | ||
|
|
||
| /** The path that contains the package curations. */ | ||
| @OrtPluginOption(defaultValue = "curations") |
There was a problem hiding this comment.
Not sure if this should really be the default, or just something that OrtConfigPackageCurationProvider sets.
There was a problem hiding this comment.
I chose it because it seems people generally use the ort-config repo as template, so why not make their lives a bit easier.
ba9faac to
58aa459
Compare
Extract a generic `GitPackageCurationProvider` from the `OrtConfigPackageCurationProvider` and make the latter inherit from the new one. The new provider allows to use any Git repository as a source for package curation files. For now, the provider requires the same file layout as the `OrtConfigPackageCurationProvider`, this could be made configurable if required later on. Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@doubleopen.io>
Rename the module that contains the `GitPackageCurationProvider` and the `OrtConfigPackageCurationProvider` from `ort-config` to `git` to align with the more generic provider. Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@doubleopen.io>
58aa459 to
4d54d8c
Compare
| import io.kotest.core.annotation.Tags | ||
| import io.kotest.core.spec.style.WordSpec | ||
| import io.kotest.matchers.collections.beEmpty | ||
| import io.kotest.matchers.should |
Extract a generic
GitPackageCurationProviderfrom theOrtConfigPackageCurationProviderand make the latter inherit from the new one. The new provider allows to use any Git repository as a source for package curation files.For now, the provider requires the same file layout as the
OrtConfigPackageCurationProvider, this could be made configurable if required later on.