From fe0eae405b73f7608d8c4fd0bf6b3b3bf06ce770 Mon Sep 17 00:00:00 2001 From: cjtim <47479090+cjtim@users.noreply.github.com> Date: Wed, 19 Apr 2023 14:50:35 +0700 Subject: [PATCH] Feat/sbt multiple file variable lookup (#2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(platform/bitbucket): use `uuid` instead of `username` for issues filter (#20960) * fix(config): migrate includeForks properly (#20965) * chore(deps): update actions/checkout action to v3.4.0 (#20970) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency rimraf to v4.4.0 (#20973) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix: Prevent uninitialized cacheProxy from being accessed in cleanup (#20975) * feat(manager/gradle): add support for plugins in inlined version catalogs (#20969) * fix: Add support for PAT in Bitbucket Server. Closes #14900 (#20974) * fix: Revert "fix: Add support for PAT in Bitbucket Server. Closes #14900" (#20979) * docs(platform/bitbucket-server): add Data Center (#20980) * feat(manager/bitbucket-pipelines): add support for docker-based pipes (#20938) Co-authored-by: Rhys Arkins * chore: change invalid to needs-discussion (#20997) * chore(deps): update dependency @types/node to v18.15.0 (#20999) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update node.js to 0359d0e (#20998) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(bitbucket): use correct case (#21002) * fix(auto-replace): handle missing depName or packageName values (#21005) * chore(deps): update dependency lint-staged to v13.2.0 (#21006) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update node.js to 85f7a97 (#21014) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency eslint to v8.36.0 (#21016) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update node.js to a016596 (#21018) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore: downgrade cached etag log to trace * docs(go modules): vendored major upgrades not supported (#21025) * feat(github): Don't store `updatedAt` field in GraphQL cache record (#21024) * chore(logs): lower lookup logging (#21027) * feat(presets): gitbeaker monorepo (#21028) * chore(deps): update dependency aws-sdk-client-mock to v2.1.1 (#21029) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * docs: clarify forkProcessing filename (#21021) * feat(manager/helmfile): Support kustomize (#20782) * refactor(git): cache list of branches per-sha per repo (#20839) * feat(manager/argocd): added support for argocd multisource (#20648) * feat(git): use rev-list count to determine behind base status (#21036) * refactor(test): use minimal config objects (#20773) * fix(platform/github): detect pr-edited if target changed (#21026) Co-authored-by: Rhys Arkins * refactor: exactOptionalPropertyTypes (#20761) Co-authored-by: Michael Kriese * docs: update references to renovate/renovate to v35.14.1 (#21040) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): lock file maintenance (#21041) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(asdf-pulumi): Extract version (#21038) * chore(deps): update dependency @types/node to v18.15.1 (#21042) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update actions/dependency-review-action action to v3.0.4 (#21043) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(data): automatic update of static data (#21030) Co-authored-by: Renovate Bot Co-authored-by: Jamie Magee * chore(deps): update dependency @types/node to v18.15.2 (#21053) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update node.js to 3c89fc4 (#21055) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update linters (#21054) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * build(deps): update opentelemetry-js monorepo (#21050) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Rhys Arkins * refactor: MergeConfidence types (#21058) * refactor: merge confidence default undefined (#21059) * chore(deps): update dependency @types/node to v18.15.3 (#21060) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: customize merge confidence host (#21061) Co-authored-by: Gabriel-Ladzaretti <97394622+Gabriel-Ladzaretti@users.noreply.github.com> * chore: improve bug issue template (#21051) Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * feat(replacements): support for replacement name templating (#20905) Co-authored-by: Sebastian Poxhofer * feat(packageRules): add merge confidence matcher (#21049) Co-authored-by: Rhys Arkins Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> Co-authored-by: Michael Kriese * fix: remove `pkg.version` from prFingerprintConfig (#21077) * docs(replacement): update examples (#21076) * docs(self-hosting examples): update renovate version references (#21067) * docs(config options): `improveprBodyTemplate` explanation (#20945) * docs(config options): rewrite `branchName` documention, redirect to discussion (#20949) * docs: fix `replacementNameTemplate` samples (#21085) * feat(presets): add containerbase workarounds (#21086) * feat(presets): add more containerbase replacements (#21084) * fix(manager/flux): the parsing of ocirepository (#21070) Co-authored-by: Michael Kriese * chore(deps): update github/codeql-action action to v2.2.8 (#21095) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(platform/github): don't retry merge when blocked by required status check (#21063) Co-authored-by: Rhys Arkins Co-authored-by: Sebastian Poxhofer * feat(cache): Fallback to older decorator results on error (#20795) * chore(deps): update dependency jest-mock-extended to v3.0.4 (#21112) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * build(deps): update dependency deepmerge to v4.3.1 (#21115) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(config): set subType=string for all arrays (#21118) * fix: remove traefik manual sourceUrl (#21117) * chore(deps): update actions/checkout action to v3.5.0 (#21120) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: Better defaults for Codespaces configuration (#21113) * chore(deps): update node.js to a396d1d (#21135) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * build(deps): update dependency semantic-release to v20.1.3 (#21139) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update node.js to dd071f0 (#21141) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update node.js to d0a1856 (#21142) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * docs(manager/velaci): Set displayName and url (#21143) * feat(config): multi-org secrets decrypt (#21147) * feat(manager/pyenv): specify "Python" for commitMessageTopic (#21145) * fix: perform pr-update when requested regardless of pr-cache state (#21148) * chore(deps): update node.js to cfdd74d (#21159) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(onboarding): improve preset description resolution (#21165) * chore(deps): replace node.js with ghcr.io/containerbase/node 18.15.0 (#21158) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(presets): use replacementNameTemplate for k8s-registry-move (#21103) * docs: encrypt CLI usage (#21162) Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * fix(manager/helmfile): Detect more local charts (#21093) * fix(merge-confidence): escape forward slashes in package names (#21168) * chore(deps): update dependency @types/eslint to v8.21.3 (#21171) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * build(deps): update dependency safe-stable-stringify to v2.4.3 (#21170) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update linters (#21172) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * docs: update references to renovate/renovate to v35.23.2 (#21175) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): lock file maintenance (#21176) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): lock file maintenance (#21177) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * docs: update references to renovate/renovate to v35.23.3 (#21178) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): lock file maintenance (#21179) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * build(deps): update dependency @renovatebot/ruby-semver to v2.1.10 (#21180) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * refactor(schema): Remove `looseObject` helper (#21164) * build(deps): update dependency prettier to v2.8.5 (#21189) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * build(deps): update dependency prettier to v2.8.7 (#21190) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(replacement): consolidate replacement rules (#21155) * feat(datasource/docker): support registry proxy for digest updates (#20777) Co-authored-by: Sebastian Poxhofer * build(deps): update dependency prettier to v2.8.7 (#21190) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * build(deps): update opentelemetry-js monorepo (#21197) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * build(deps): update dependency fs-extra to v11.1.1 (#21196) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update github/codeql-action action to v2.2.9 (#21198) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * build(deps): update dependency @renovatebot/osv-offline to v1.2.3 (#21199) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * build(deps): update dependency xmldoc to v1.3.0 (#21202) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency @types/node to v18.15.5 (#21201) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency @types/node to v18.15.10 (#21203) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(onboarding): force branch creation to prevent diff-check (#21200) * build(deps): update dependency cacache to v17.0.5 (#21214) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore: use `node:` protocol imports (#21181) * fix: merge config constraints over package file extracted constraints (#21207) * feat(manager/bitbucket-pipelines): support docker image object (#21102) * chore(deps): update dependency rimraf to v4.4.1 (#21240) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update node.js to cde49f8 (#21241) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * docs(automerge): add example monorepo package automerge (#21223) Co-authored-by: Rhys Arkins * fix(github-release-attachments): set token correctly (#21233) * chore(deps): update dependency @types/diff to v5.0.3 (#21253) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency type-fest to v3.7.0 (#21245) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(presets): Add tiptap monorepo (#21254) * fix(presets): name typo (#21064) * feat(bazel): Support for rules_oci / oci_pull (#21216) Co-authored-by: Michael Kriese * fix(manager/kubernetes): allow trailing comments (#21260) * feat(template): indentation capture group (#21193) * feat(issues): add jira http util (#21056) Co-authored-by: Michael Kriese * feat(presets): add storybook-react-native monorepo (#21273) * chore(deps): update dependency typescript to v5 (#21011) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jamie Magee * feat: autoclose PRs when repo disabled (#21263) Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * refactor: rename finalise to finalize (#21278) * build(deps): update dependency @renovatebot/osv-offline to v1.2.4 (#21277) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(yarn): detect already-updated for yarn 2/3 (#21285) * build(deps): update dependency nanoid to v3.3.6 (#21288) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * build(deps): update dependency slugify to v1.6.6 (#21289) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(cache): catch redis set value errors (#21290) * chore(deps): update dependency type-fest to v3.7.1 (#21291) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency type-fest to v3.7.2 (#21293) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * docs: update references to renovate/renovate to v35.31.4 (#21295) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(vulnerabilities): skip withdrawn security advisories (#21294) * chore(deps): lock file maintenance (#21296) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * docs: update references to renovate/renovate to v35.31.5 (#21303) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(asdf): Support sops asdf plugin (#21306) * chore(deps): update node.js to 9242d23 (#21312) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update linters to v5.57.0 (#21314) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update linters (#21315) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency @types/lodash to v4.14.192 (#21313) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * docs: update template capture group definitions (#21311) * fix(yarn): use yarn up -R for lock file updating (#21309) * fix(versioning/hashicorp): allow numbered unstable versions (#21334) * chore: improve user-facing label action comments (#21322) * test(vulnerabilities): add unit test to confirm package rule order (#21339) * chore(deps): update dependency @types/node to v18.15.11 (#21345) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * docs(issue labeling): add new labels (#21348) * feat(datasource/crate): add sparse registry support (#21187) Co-authored-by: Sam Co-authored-by: Rhys Arkins * feat: fetch changelogs for private Terraform Cloud modules (#21356) * fix(manager/gradle): handle dot as optional when parsing plugins in Kotlin DSL (#21362) * chore(deps): update github/codeql-action action to v2.2.10 (#21363) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(util/pretty-time): Ensure support for `years`, `months` and `weeks` (#21366) * refactor(dotnet-version): Fix schema for dates (#21367) * docs(rangeStrategy): clarify v35 `auto` behavior (#21372) * refactor(http): Enhanced integration with data schemas (#21338) * chore(deps): update github/codeql-action action to v2.2.11 (#21373) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * build(deps): update opentelemetry-js monorepo (#21374) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency typescript to v5.0.3 (#21375) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore: export poetry helper functions * feat(onboarding): use cache to check if repo is onboarded (#20733) Co-authored-by: Rhys Arkins * fix(manager/regex): set replaceString for digest-only matches (#21370) Co-authored-by: Michael Kriese * test(manager/regex): add replaceString to all non-snapshot based test assertions (#21380) * feat(schema-utils): Add JSON parsing functions (#21384) * chore(deps): update node.js to 4a703da (#21388) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix: update cache record TTL to not account for Daylight Saving time (#21389) * feat: RENOVATE_X_IGNORE_RE2 (#21391) * refactor: safely parse composer files (#21173) * chore(deps): update node.js to d8906c1 (#21397) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(presets): update pixijs repo urls (#21396) * chore(deps): update node.js to d7bd3e3 (#21398) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(template): add equals helper (#21385) * chore(deps): update dependency ts-jest to v29.1.0 (#21400) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * refactor(http): Don't use shallow copy for JSON results (#21401) * docs: update references to renovate/renovate to v35.40.0 (#21403) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): lock file maintenance (#21404) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * refactor(platform): add id for each platform (#21405) * test: jest isolation (#21406) * fix(platform/bitbucket): remove interactive text in issue should be read only (#21409) * fix(manager/gradle): resolve values when assigning symbols to variables (#21411) * build(deps): update dependency graph-data-structure to v3.3.0 (#21412) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency @types/luxon to v3.2.2 (#21417) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(http): Throw errors for schema mismatch (#21395) * refactor(datasource/npm): Remove unused fields from types (#21192) * refactor(datasource/deno): Add schema validation (#21329) * refactor(azure-bicep-resource): Refactor schema usage (#21402) Co-authored-by: Michael Kriese * chore(deps): update codecov/codecov-action action to v3.1.2 (#21430) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix: migrate hostType (#21432) * refactor(manager/gradle): split `extractAllPackageFiles` into multiple sub-methods (#21429) * refactor(dotnet-version): Refactor schemas (#21426) * chore(deps): update dependency @types/luxon to v3.3.0 (#21418) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: RahulGautamSingh * docs: add GitHub PAT hint for fetchReleaseNotes (#21443) * feat(manager/helmfile): Detect kustomization.yaml (#21111) Co-authored-by: Michael Kriese * fix(ansible-galaxy): space parsing (#20679) Co-authored-by: Rhys Arkins Co-authored-by: Michael Kriese * fix: Revert "refactor: safely parse composer files" (#21448) * build: export pipenv constraints * feat(datasource): rename `node` -> `node-version` (#21149) * refactor(platform): optional `getVulnerabilityAlerts` (#21449) * feat(fs): add `isValidLocalPath` function (#21433) * feat: support depth URL argument in Terraform modules (#21287) * feat(config): rename stabilityDays to minimumReleaseAge (#21376) Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * chore(deps): update actions/checkout action to v3.5.1 (#21464) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update node.js to 72fa4d2 (#21463) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency type-fest to v3.8.0 (#21466) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency eslint-import-resolver-typescript to v3.5.5 (#21465) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * refactor(vulnerabilities): rename fetchVulnerabilities to appendVulnerabilityPackageRules (#21468) * chore(deps): update linters (#21469) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update node.js to v18.16.0 (#21470) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update node.js to v18.16.0 (#21472) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * docs(pull requests): rewrite (#21440) Co-authored-by: Rhys Arkins * fix(fs): allow `@` inside paths (#21476) * chore(deps): update actions/stale action to v8 (#21479) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(fs): allow `+$` inside paths (#21482) * docs: refresh links around presets (#21484) * chore(deps): update actions/checkout action to v3.5.2 (#21487) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update peter-evans/create-pull-request action to v5 (#21477) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * build(deps): update dependency semantic-release to v21 (#21478) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * docs: Add Maintaining AUR packages with Renovate user story (#21413) * fix(cache): use UTC dates for cache strategy calculations (#21488) * feat: compare all branch authors when deciding if a branch is modified (#20739) * chore(deps): update github/codeql-action action to v2.2.12 (#21493) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency memfs to v3.5.0 (#21503) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix: Revert "feat: compare all branch authors when deciding if a branch is modified" (#21505) * docs: add restriction on matchCurrentVersion (#21485) Co-authored-by: Rhys Arkins * build: support more containerbase tools * chore(deps): update dependency lint-staged to v13.2.1 (#21518) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency typescript to v5.0.4 (#21526) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(manager/github-actions): allow dot `.` in reusable workflow repository name (#21519) * feat: add swc package to monorepo group (#21431) Co-authored-by: Michael Kriese * build: add java-maven install-tool support * fix(fs): allow `{}` inside paths (#21530) * chore(deps): update node.js to b6efb2a (#21528) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(maven): Support versions containing `+` sign (#21533) * docs: update references to renovate/renovate to v35.48.2 (#21542) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): lock file maintenance (#21543) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): lock file maintenance (#21544) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): lock file maintenance (#21545) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): lock file maintenance (#21546) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): lock file maintenance (#21547) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * refactor(gradle/manager): introduce method to resolve variables (#21531) * feat: disable setting COMPOSER_AUTH for gitlab (#20634) Co-authored-by: Rhys Arkins Co-authored-by: Michael Kriese * feat(schema): Better utility for JSON parsing (#21536) * chore(devcontainer): unpin docker image (#21553) * build(deps): update aws-sdk-js-v3 monorepo (#21549) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Michael Kriese * docs: explain how to use presets (#21534) Co-authored-by: Michael Kriese * init Signed-off-by: Jinna C * working variable lookup Signed-off-by: Jinna C * rename variable Signed-off-by: Jinna C --------- Signed-off-by: Jinna C Co-authored-by: Michael Kriese Co-authored-by: Rhys Arkins Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: John Daly Co-authored-by: Johannes Feichtner <343448+Churro@users.noreply.github.com> Co-authored-by: ​Faizaan Co-authored-by: Adam Setch Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> Co-authored-by: Sergei Zharinov Co-authored-by: Sullivan SENECHAL Co-authored-by: Nikolai Røed Kristiansen Co-authored-by: Youssef Dhraief Co-authored-by: RahulGautamSingh Co-authored-by: Liora Milbaum Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Renovate Bot Co-authored-by: Jamie Magee Co-authored-by: Gabriel-Ladzaretti <97394622+Gabriel-Ladzaretti@users.noreply.github.com> Co-authored-by: Sebastian Poxhofer Co-authored-by: Skyler Mäntysaari Co-authored-by: IKEDA Sho Co-authored-by: Florian Greinacher Co-authored-by: kegato <37505324+kegato@users.noreply.github.com> Co-authored-by: curtvict <96080054+curtvict@users.noreply.github.com> Co-authored-by: Sami Al-Dury <57627858+samialdury@users.noreply.github.com> Co-authored-by: Malte Poll <1780588+malt3@users.noreply.github.com> Co-authored-by: Jesse Simpson Co-authored-by: Sam <687928+samrogerson@users.noreply.github.com> Co-authored-by: Sam Co-authored-by: Johannes Grumböck Co-authored-by: David Straub Co-authored-by: Chuck Grindel Co-authored-by: Hikari Hayashi Co-authored-by: William Boman Co-authored-by: Philip <42116482+PhilipAbed@users.noreply.github.com> Co-authored-by: Björn Böing Co-authored-by: Nikolai Røed Kristiansen Co-authored-by: kechigon <43576135+kechigon@users.noreply.github.com> Co-authored-by: Vojta Polak Co-authored-by: Róbert Papp Co-authored-by: Alex Kessock Co-authored-by: Jeroen de Bruijn <62570005+jdbruijn@users.noreply.github.com> Co-authored-by: Daiki Nishikawa Co-authored-by: DjordyKoert --- .../sbt/__snapshots__/extract.spec.ts.snap | 640 ------------- lib/modules/manager/sbt/extract.spec.ts | 621 ------------- lib/modules/manager/sbt/extract.ts | 847 ++++++++---------- lib/modules/manager/sbt/index.ts | 8 +- lib/modules/manager/sbt/types.ts | 29 +- lib/workers/repository/updates/branchify.ts | 1 + 6 files changed, 388 insertions(+), 1758 deletions(-) diff --git a/lib/modules/manager/sbt/__snapshots__/extract.spec.ts.snap b/lib/modules/manager/sbt/__snapshots__/extract.spec.ts.snap index a8c31bc1a278b76..e69de29bb2d1d64 100644 --- a/lib/modules/manager/sbt/__snapshots__/extract.spec.ts.snap +++ b/lib/modules/manager/sbt/__snapshots__/extract.spec.ts.snap @@ -1,640 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`modules/manager/sbt/extract extractFile() extract deps from native scala file with private variables 1`] = ` -Object { - "deps": Array [ - Object { - "currentValue": "2.13.0-RC5", - "datasource": "maven", - "depName": "scala", - "packageName": "org.scala-lang:scala-library", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - ], - "separateMinorPatch": true, - }, - Object { - "currentValue": "0.7.1", - "datasource": "sbt-package", - "depName": "com.example:foo", - "fileReplacePosition": 9, - "packageName": "com.example:foo_2.13.0-RC5", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - ], - }, - Object { - "currentValue": "1.2.3", - "datasource": "sbt-package", - "depName": "com.abc:abc", - "editFile": undefined, - "fileReplacePosition": 7, - "groupName": "abcVersion", - "packageName": "com.abc:abc", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - ], - }, - ], - "packageFileVersion": undefined, - "scalaVersion": "2.13.0-RC5", -} -`; - -exports[`modules/manager/sbt/extract extractFile() extract deps from native scala file with variables 1`] = ` -Object { - "deps": Array [ - Object { - "currentValue": "2.13.0-RC5", - "datasource": "maven", - "depName": "scala", - "packageName": "org.scala-lang:scala-library", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - ], - "separateMinorPatch": true, - }, - Object { - "currentValue": "0.7.1", - "datasource": "sbt-package", - "depName": "com.example:foo", - "fileReplacePosition": 9, - "packageName": "com.example:foo_2.13.0-RC5", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - ], - }, - Object { - "currentValue": "1.2.3", - "datasource": "sbt-package", - "depName": "com.abc:abc", - "editFile": undefined, - "fileReplacePosition": 7, - "groupName": "abcVersion", - "packageName": "com.abc:abc", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - ], - }, - Object { - "currentValue": "1.2.3", - "datasource": "sbt-package", - "depName": "com.abc:abc-a", - "editFile": undefined, - "fileReplacePosition": 7, - "groupName": "abcVersion", - "packageName": "com.abc:abc-a", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - ], - }, - Object { - "currentValue": "1.2.3", - "datasource": "sbt-package", - "depName": "com.abc:abc-b", - "editFile": undefined, - "fileReplacePosition": 7, - "groupName": "abcVersion", - "packageName": "com.abc:abc-b", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - ], - }, - Object { - "currentValue": "1.2.3", - "datasource": "sbt-package", - "depName": "com.abc:abc-c", - "editFile": undefined, - "fileReplacePosition": 7, - "groupName": "abcVersion", - "packageName": "com.abc:abc-c", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - ], - }, - ], - "packageFileVersion": undefined, - "scalaVersion": "2.13.0-RC5", -} -`; - -exports[`modules/manager/sbt/extract extractFile() extracts addCompilerPlugin 1`] = ` -Object { - "deps": Array [ - Object { - "currentValue": "0.9.9", - "datasource": "sbt-plugin", - "depName": "org.spire-math:kind-projector", - "depType": "plugin", - "fileReplacePosition": 0, - "packageName": "org.spire-math:kind-projector", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://dl.bintray.com/sbt/sbt-plugin-releases", - ], - }, - ], - "packageFileVersion": undefined, - "scalaVersion": null, -} -`; - -exports[`modules/manager/sbt/extract extractFile() extracts addCompilerPlugin 2`] = ` -Object { - "deps": Array [ - Object { - "currentValue": "2.1.1", - "datasource": "sbt-plugin", - "depName": "org.scalamacros:paradise", - "depType": "plugin", - "fileReplacePosition": 0, - "packageName": "org.scalamacros:paradise", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://dl.bintray.com/sbt/sbt-plugin-releases", - ], - }, - ], - "packageFileVersion": undefined, - "scalaVersion": null, -} -`; - -exports[`modules/manager/sbt/extract extractFile() extracts deps for generic use-cases 1`] = ` -Object { - "deps": Array [ - Object { - "currentValue": "2.9.10", - "datasource": "maven", - "depName": "scala", - "packageName": "org.scala-lang:scala-library", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - "separateMinorPatch": true, - }, - Object { - "currentValue": "0.0.1", - "datasource": "sbt-package", - "depName": "org.example:foo", - "fileReplacePosition": 5, - "packageName": "org.example:foo", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - }, - Object { - "currentValue": "0.0.2", - "datasource": "sbt-package", - "depName": "org.example:bar", - "fileReplacePosition": 6, - "packageName": "org.example:bar_2.9.10", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - }, - Object { - "currentValue": "0.0.3", - "datasource": "sbt-package", - "depName": "org.example:baz", - "fileReplacePosition": 8, - "packageName": "org.example:baz_2.9.10", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - }, - Object { - "currentValue": "0.0.4", - "datasource": "sbt-package", - "depName": "org.example:qux", - "fileReplacePosition": 9, - "packageName": "org.example:qux", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - }, - Object { - "currentValue": "2.13.3", - "datasource": "sbt-package", - "depName": "org.scala-lang:scala-library", - "depType": "sources", - "fileReplacePosition": 11, - "packageName": "org.scala-lang:scala-library", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - }, - Object { - "currentValue": "0.0.5", - "datasource": "sbt-package", - "depName": "org.example:quux", - "fileReplacePosition": 13, - "packageName": "org.example:quux", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - }, - Object { - "currentValue": "0.0.6", - "datasource": "sbt-package", - "depName": "org.example:quuz", - "depType": "test", - "fileReplacePosition": 20, - "packageName": "org.example:quuz_2.9.10", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - }, - Object { - "currentValue": "0.0.7", - "datasource": "sbt-package", - "depName": "org.example:corge", - "depType": "Provided", - "fileReplacePosition": 21, - "packageName": "org.example:corge", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - }, - Object { - "currentValue": "0.0.8", - "datasource": "sbt-package", - "depName": "org.example:grault", - "depType": "Test", - "editFile": undefined, - "fileReplacePosition": 17, - "groupName": "versionExample", - "packageName": "org.example:grault", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - }, - Object { - "currentValue": "0.0.9", - "datasource": "sbt-plugin", - "depName": "org.example:waldo", - "depType": "plugin", - "fileReplacePosition": 34, - "packageName": "org.example:waldo", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - "https://dl.bintray.com/sbt/sbt-plugin-releases", - ], - }, - Object { - "currentValue": "(,8.4.0]", - "datasource": "sbt-package", - "depName": "org.example:fred", - "fileReplacePosition": 36, - "packageName": "org.example:fred", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - }, - ], - "packageFileVersion": "1.0", - "scalaVersion": "2.9.10", -} -`; - -exports[`modules/manager/sbt/extract extractFile() extracts deps when scala version is defined in a variable 1`] = ` -Object { - "deps": Array [ - Object { - "currentValue": "2.12.10", - "datasource": "maven", - "depName": "scala", - "packageName": "org.scala-lang:scala-library", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - "separateMinorPatch": true, - }, - Object { - "currentValue": "0.0.1", - "datasource": "sbt-package", - "depName": "org.example:foo", - "fileReplacePosition": 8, - "packageName": "org.example:foo", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - }, - Object { - "currentValue": "0.0.2", - "datasource": "sbt-package", - "depName": "org.example:bar", - "fileReplacePosition": 9, - "packageName": "org.example:bar_2.12", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - }, - Object { - "currentValue": "0.0.3", - "datasource": "sbt-package", - "depName": "org.example:baz", - "fileReplacePosition": 11, - "packageName": "org.example:baz_2.12", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - }, - Object { - "currentValue": "0.0.4", - "datasource": "sbt-package", - "depName": "org.example:qux", - "fileReplacePosition": 12, - "packageName": "org.example:qux", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - }, - Object { - "currentValue": "0.0.5", - "datasource": "sbt-package", - "depName": "org.example:quux", - "fileReplacePosition": 15, - "packageName": "org.example:quux", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - }, - Object { - "currentValue": "0.0.6", - "datasource": "sbt-package", - "depName": "org.example:quuz", - "depType": "test", - "fileReplacePosition": 21, - "packageName": "org.example:quuz_2.12", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - }, - Object { - "currentValue": "0.0.7", - "datasource": "sbt-package", - "depName": "org.example:corge", - "depType": "Provided", - "fileReplacePosition": 22, - "packageName": "org.example:corge", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - }, - Object { - "currentValue": "0.0.8", - "datasource": "sbt-package", - "depName": "org.example:grault", - "depType": "Test", - "editFile": undefined, - "fileReplacePosition": 1, - "groupName": "versionExample", - "packageName": "org.example:grault", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - ], - }, - Object { - "currentValue": "0.0.9", - "datasource": "sbt-plugin", - "depName": "org.example:waldo", - "depType": "plugin", - "fileReplacePosition": 35, - "packageName": "org.example:waldo", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - "https://example.com/repos/1/", - "https://example.com/repos/2/", - "https://example.com/repos/3/", - "https://example.com/repos/4/", - "https://example.com/repos/5/", - "https://dl.bintray.com/sbt/sbt-plugin-releases", - ], - }, - ], - "packageFileVersion": "3.2.1", - "scalaVersion": "2.12", -} -`; - -exports[`modules/manager/sbt/extract extractFile() extracts deps when scala version is defined in a variable with ThisBuild scope 1`] = ` -Object { - "deps": Array [ - Object { - "currentValue": "2.12.10", - "datasource": "maven", - "depName": "scala", - "packageName": "org.scala-lang:scala-library", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - ], - "separateMinorPatch": true, - }, - Object { - "currentValue": "0.0.2", - "datasource": "sbt-package", - "depName": "org.example:bar", - "fileReplacePosition": 3, - "packageName": "org.example:bar_2.12", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - ], - }, - ], - "packageFileVersion": undefined, - "scalaVersion": "2.12", -} -`; - -exports[`modules/manager/sbt/extract extractFile() extracts deps when scala version is defined in a variable with a trailing comma 1`] = ` -Object { - "deps": Array [ - Object { - "currentValue": "2.12.10", - "datasource": "maven", - "depName": "scala", - "packageName": "org.scala-lang:scala-library", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - ], - "separateMinorPatch": true, - }, - Object { - "currentValue": "0.0.2", - "datasource": "sbt-package", - "depName": "org.example:bar", - "fileReplacePosition": 5, - "packageName": "org.example:bar_2.12", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - ], - }, - ], - "packageFileVersion": undefined, - "scalaVersion": "2.12", -} -`; - -exports[`modules/manager/sbt/extract extractFile() extracts deps when scala version is defined with ThisBuild scope 1`] = ` -Object { - "deps": Array [ - Object { - "currentValue": "2.12.10", - "datasource": "maven", - "depName": "scala", - "packageName": "org.scala-lang:scala-library", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - ], - "separateMinorPatch": true, - }, - Object { - "currentValue": "0.0.2", - "datasource": "sbt-package", - "depName": "org.example:bar", - "fileReplacePosition": 2, - "packageName": "org.example:bar_2.12", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - ], - }, - ], - "packageFileVersion": undefined, - "scalaVersion": "2.12", -} -`; - -exports[`modules/manager/sbt/extract extractFile() extracts deps when scala version is defined with a trailing comma 1`] = ` -Object { - "deps": Array [ - Object { - "currentValue": "2.12.10", - "datasource": "maven", - "depName": "scala", - "packageName": "org.scala-lang:scala-library", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - ], - "separateMinorPatch": true, - }, - Object { - "currentValue": "0.0.2", - "datasource": "sbt-package", - "depName": "org.example:bar", - "fileReplacePosition": 4, - "packageName": "org.example:bar_2.12", - "registryUrls": Array [ - "https://repo.maven.apache.org/maven2", - ], - }, - ], - "packageFileVersion": undefined, - "scalaVersion": "2.12", -} -`; diff --git a/lib/modules/manager/sbt/extract.spec.ts b/lib/modules/manager/sbt/extract.spec.ts index 37d339cad08d74c..e69de29bb2d1d64 100644 --- a/lib/modules/manager/sbt/extract.spec.ts +++ b/lib/modules/manager/sbt/extract.spec.ts @@ -1,621 +0,0 @@ -import { Fixtures } from '../../../../test/fixtures'; -import { GlobalConfig } from '../../../config/global'; -import type { RepoGlobalConfig } from '../../../config/types'; -import type { ExtractConfig, PackageFile } from '../types'; -import { extractFile } from './extract'; -import { extractAllPackageFiles } from '.'; - -const fixturesDir = 'lib/modules/manager/sbt/__fixtures__'; - -const sbt = Fixtures.get(`sample.sbt`); -const sbtScalaVersionVariable = Fixtures.get(`scala-version-variable.sbt`); -const sbtMissingScalaVersion = Fixtures.get(`missing-scala-version.sbt`); -const sbtDependencyFile = Fixtures.get(`dependency-file.scala`); -const sbtPrivateVariableDependencyFile = Fixtures.get( - `private-variable-dependency-file.scala` -); - -describe('modules/manager/sbt/extract', () => { - describe('extractFile()', () => { - it('returns null for empty', () => { - expect(extractFile('')).toBeNull(); - expect(extractFile('non-sense')).toBeNull(); - expect( - extractFile('libraryDependencies += "foo" % "bar" % ???') - ).toBeNull(); - expect( - extractFile('libraryDependencies += "foo" % "bar" %% "baz"') - ).toBeNull(); - expect( - extractFile('libraryDependencies += ??? % "bar" % "baz"') - ).toBeNull(); - expect( - extractFile('libraryDependencies += "foo" % ??? % "baz"') - ).toBeNull(); - - expect(extractFile('libraryDependencies += ')).toBeNull(); - expect(extractFile('libraryDependencies += "foo"')).toBeNull(); - expect(extractFile('libraryDependencies += "foo" % "bar" %')).toBeNull(); - expect( - extractFile('libraryDependencies += "foo" % "bar" % "baz" %%') - ).toBeNull(); - }); - - it('extracts deps for generic use-cases', () => { - expect(extractFile(sbt)).toMatchSnapshot({ - deps: [ - { - packageName: 'org.scala-lang:scala-library', - currentValue: '2.9.10', - }, - { packageName: 'org.example:foo', currentValue: '0.0.1' }, - { packageName: 'org.example:bar_2.9.10', currentValue: '0.0.2' }, - { packageName: 'org.example:baz_2.9.10', currentValue: '0.0.3' }, - { packageName: 'org.example:qux', currentValue: '0.0.4' }, - { - packageName: 'org.scala-lang:scala-library', - currentValue: '2.13.3', - }, - { packageName: 'org.example:quux', currentValue: '0.0.5' }, - { packageName: 'org.example:quuz_2.9.10', currentValue: '0.0.6' }, - { packageName: 'org.example:corge', currentValue: '0.0.7' }, - { packageName: 'org.example:grault', currentValue: '0.0.8' }, - { packageName: 'org.example:waldo', currentValue: '0.0.9' }, - { packageName: 'org.example:fred', currentValue: '(,8.4.0]' }, - ], - packageFileVersion: '1.0', - }); - }); - - it('extracts addCompilerPlugin', () => { - expect( - extractFile( - `addCompilerPlugin(("org.spire-math" % "kind-projector" % "0.9.9").cross(CrossVersion.binary))` - ) - ).toMatchSnapshot({ - deps: [ - { - packageName: 'org.spire-math:kind-projector', - currentValue: '0.9.9', - }, - ], - }); - expect( - extractFile( - `addCompilerPlugin(("org.scalamacros" % "paradise" % "2.1.1").cross(CrossVersion.full))` - ) - ).toMatchSnapshot({ - deps: [ - { - packageName: 'org.scalamacros:paradise', - currentValue: '2.1.1', - }, - ], - }); - }); - - it('extracts deps when scala version is defined in a variable', () => { - expect(extractFile(sbtScalaVersionVariable)).toMatchSnapshot({ - deps: [ - { - packageName: 'org.scala-lang:scala-library', - currentValue: '2.12.10', - }, - { packageName: 'org.example:foo', currentValue: '0.0.1' }, - { packageName: 'org.example:bar_2.12', currentValue: '0.0.2' }, - { packageName: 'org.example:baz_2.12', currentValue: '0.0.3' }, - { packageName: 'org.example:qux', currentValue: '0.0.4' }, - { packageName: 'org.example:quux', currentValue: '0.0.5' }, - { packageName: 'org.example:quuz_2.12', currentValue: '0.0.6' }, - { packageName: 'org.example:corge', currentValue: '0.0.7' }, - { packageName: 'org.example:grault', currentValue: '0.0.8' }, - { packageName: 'org.example:waldo', currentValue: '0.0.9' }, - ], - - packageFileVersion: '3.2.1', - }); - }); - - it('skips deps when scala version is missing', () => { - expect(extractFile(sbtMissingScalaVersion)).toEqual({ - deps: [ - { - currentValue: '3.0.0', - datasource: 'sbt-package', - depName: 'org.scalatest:scalatest', - fileReplacePosition: 3, - packageName: 'org.scalatest:scalatest', - registryUrls: ['https://repo.maven.apache.org/maven2'], - }, - { - currentValue: '1.0.11', - datasource: 'sbt-plugin', - depName: 'com.github.gseitz:sbt-release', - depType: 'plugin', - editFile: undefined, - fileReplacePosition: 6, - groupName: 'sbtReleaseVersion', - packageName: 'com.github.gseitz:sbt-release', - registryUrls: [ - 'https://repo.maven.apache.org/maven2', - 'https://dl.bintray.com/sbt/sbt-plugin-releases', - ], - }, - ], - packageFileVersion: '1.0.1', - scalaVersion: null, - }); - }); - - it('extract deps from native scala file with variables', () => { - expect(extractFile(sbtDependencyFile)).toMatchSnapshot({ - deps: [ - { - packageName: 'org.scala-lang:scala-library', - currentValue: '2.13.0-RC5', - }, - { - packageName: 'com.example:foo_2.13.0-RC5', - currentValue: '0.7.1', - }, - { packageName: 'com.abc:abc', currentValue: '1.2.3' }, - { packageName: 'com.abc:abc-a', currentValue: '1.2.3' }, - { packageName: 'com.abc:abc-b', currentValue: '1.2.3' }, - { packageName: 'com.abc:abc-c', currentValue: '1.2.3' }, - ], - }); - }); - - it('extracts deps when scala version is defined with a trailing comma', () => { - const content = ` - lazy val commonSettings = Seq( - scalaVersion := "2.12.10", - ) - libraryDependencies += "org.example" %% "bar" % "0.0.2" - `; - expect(extractFile(content)).toMatchSnapshot({ - deps: [ - { - packageName: 'org.scala-lang:scala-library', - currentValue: '2.12.10', - }, - { - packageName: 'org.example:bar_2.12', - currentValue: '0.0.2', - }, - ], - }); - }); - - it('extracts deps when scala version is defined in a variable with a trailing comma', () => { - const content = ` - val ScalaVersion = "2.12.10" - lazy val commonSettings = Seq( - scalaVersion := ScalaVersion, - ) - libraryDependencies += "org.example" %% "bar" % "0.0.2" - `; - expect(extractFile(content)).toMatchSnapshot({ - deps: [ - { - packageName: 'org.scala-lang:scala-library', - currentValue: '2.12.10', - }, - { packageName: 'org.example:bar_2.12', currentValue: '0.0.2' }, - ], - }); - }); - - it('extracts deps when scala version is defined with ThisBuild scope', () => { - const content = ` - ThisBuild / scalaVersion := "2.12.10" - libraryDependencies += "org.example" %% "bar" % "0.0.2" - `; - expect(extractFile(content)).toMatchSnapshot({ - deps: [ - { - packageName: 'org.scala-lang:scala-library', - currentValue: '2.12.10', - }, - { - packageName: 'org.example:bar_2.12', - currentValue: '0.0.2', - }, - ], - }); - }); - - it('extracts deps when scala version is defined in a variable with ThisBuild scope', () => { - const content = ` - val ScalaVersion = "2.12.10" - ThisBuild / scalaVersion := ScalaVersion - libraryDependencies += "org.example" %% "bar" % "0.0.2" - `; - expect(extractFile(content)).toMatchSnapshot({ - deps: [ - { - packageName: 'org.scala-lang:scala-library', - currentValue: '2.12.10', - }, - { - packageName: 'org.example:bar_2.12', - currentValue: '0.0.2', - }, - ], - }); - }); - - it('extract deps from native scala file with private variables', () => { - expect(extractFile(sbtPrivateVariableDependencyFile)).toMatchSnapshot({ - deps: [ - { - packageName: 'org.scala-lang:scala-library', - currentValue: '2.13.0-RC5', - }, - { - packageName: 'com.example:foo_2.13.0-RC5', - currentValue: '0.7.1', - }, - { - packageName: 'com.abc:abc', - currentValue: '1.2.3', - }, - ], - packageFileVersion: undefined, - }); - }); - - it('extract deps when they are defined in a new line', () => { - const content = ` - name := "service" - scalaVersion := "2.13.8" - - lazy val compileDependencies = - Seq( - "com.typesafe.scala-logging" %% "scala-logging" % "3.9.4", - "ch.qos.logback" % "logback-classic" % "1.2.10" - ) - - libraryDependencies ++= compileDependencies`; - expect(extractFile(content)).toMatchObject({ - deps: [ - { - registryUrls: ['https://repo.maven.apache.org/maven2'], - datasource: 'maven', - depName: 'scala', - packageName: 'org.scala-lang:scala-library', - currentValue: '2.13.8', - separateMinorPatch: true, - }, - { - registryUrls: ['https://repo.maven.apache.org/maven2'], - depName: 'com.typesafe.scala-logging:scala-logging', - packageName: 'com.typesafe.scala-logging:scala-logging_2.13', - currentValue: '3.9.4', - datasource: 'sbt-package', - }, - { - registryUrls: ['https://repo.maven.apache.org/maven2'], - depName: 'ch.qos.logback:logback-classic', - packageName: 'ch.qos.logback:logback-classic', - currentValue: '1.2.10', - datasource: 'sbt-package', - }, - ], - packageFileVersion: undefined, - }); - }); - - it('extract deps line with force withSource exclude excludeAll', () => { - const content = ` - name := "renovatebot-sbt-example" - - scalaVersion := "2.13.8" - - libraryDependencies ++= Seq( - "com.lightbend.akka" %% "akka-stream-alpakka-csv" % "2.0.0" excludeAll ExclusionRule(organization = "com.typesafe.akka"), - "com.lightbend.akka" %% "akka-stream-alpakka-s3" % "2.0.1" force(), - )`; - expect(extractFile(content)).toMatchObject({ - deps: [ - { - registryUrls: ['https://repo.maven.apache.org/maven2'], - datasource: 'maven', - depName: 'scala', - packageName: 'org.scala-lang:scala-library', - currentValue: '2.13.8', - separateMinorPatch: true, - }, - { - registryUrls: ['https://repo.maven.apache.org/maven2'], - depName: 'com.lightbend.akka:akka-stream-alpakka-csv', - fileReplacePosition: 6, - packageName: 'com.lightbend.akka:akka-stream-alpakka-csv_2.13', - currentValue: '2.0.0', - datasource: 'sbt-package', - }, - { - registryUrls: ['https://repo.maven.apache.org/maven2'], - depName: 'com.lightbend.akka:akka-stream-alpakka-s3', - packageName: 'com.lightbend.akka:akka-stream-alpakka-s3_2.13', - currentValue: '2.0.1', - datasource: 'sbt-package', - }, - ], - packageFileVersion: undefined, - }); - }); - }); - - describe('extractAllPackageFiles()', () => { - const config: ExtractConfig = {}; - - afterEach(() => { - GlobalConfig.reset(); - }); - - it('extract simple-project with Versions.scala variable file', async () => { - const adminConfig: RepoGlobalConfig = { - localDir: `${fixturesDir}/simple-project`, - }; - GlobalConfig.set(adminConfig); - const registryUrls = ['https://repo.maven.apache.org/maven2']; - expect( - await extractAllPackageFiles(config, [ - `build.sbt`, - `project/plugins.sbt`, - `project/Versions.scala`, - `submodule/build.sbt`, - ]) - ).toEqual([ - { - deps: [ - { - currentValue: '2.13.8', - datasource: 'maven', - depName: 'scala', - packageName: 'org.scala-lang:scala-library', - registryUrls, - separateMinorPatch: true, - }, - { - currentValue: '1.2.11', - datasource: 'sbt-package', - depName: 'ch.qos.logback:logback-classic', - fileReplacePosition: 35, - packageName: 'ch.qos.logback:logback-classic', - registryUrls, - }, - ], - packageFile: 'build.sbt', - }, - { - deps: [ - { - currentValue: '0.13.0', - datasource: 'sbt-package', - depName: 'io.circe:circe-generic', - editFile: `project/Versions.scala`, - fileReplacePosition: 7, - groupName: 'Versions.circe', - packageName: 'io.circe:circe-generic_2.13', - registryUrls, - }, - { - currentValue: '10.2.6', - datasource: 'sbt-package', - depName: 'com.typesafe.akka:akka-http', - editFile: `project/Versions.scala`, - fileReplacePosition: 3, - groupName: 'Versions.akkaHttp', - packageName: 'com.typesafe.akka:akka-http_2.13', - registryUrls, - }, - { - currentValue: '2.6.18', - datasource: 'sbt-package', - depName: 'com.typesafe.akka:akka-stream', - editFile: `project/Versions.scala`, - fileReplacePosition: 2, - groupName: 'Versions.akka', - packageName: 'com.typesafe.akka:akka-stream_2.13', - registryUrls, - }, - { - currentValue: '1.3.1', - datasource: 'sbt-package', - depName: 'org.sangria-graphql:sangria-circe', - editFile: `project/Versions.scala`, - fileReplacePosition: 6, - groupName: 'Versions.sangriacirce', - packageName: 'org.sangria-graphql:sangria-circe_2.13', - registryUrls, - }, - { - currentValue: '3.2.11', - datasource: 'sbt-package', - depName: 'org.scalatest:scalatest-wordspec', - depType: 'Test', - editFile: `project/Versions.scala`, - fileReplacePosition: 13, - groupName: 'Versions.Tests.scalaTest', - packageName: 'org.scalatest:scalatest-wordspec_2.13', - registryUrls, - }, - { - currentValue: '3.2.11', - datasource: 'sbt-package', - depName: 'org.scalatest:scalatest-funsuite', - depType: 'Test', - editFile: `project/Versions.scala`, - fileReplacePosition: 13, - groupName: 'Versions.Tests.scalaTest', - packageName: 'org.scalatest:scalatest-funsuite_2.13', - registryUrls, - }, - { - currentValue: '1.17.5', - datasource: 'sbt-package', - depName: 'org.mockito:mockito-scala-scalatest', - depType: 'Test', - editFile: `project/Versions.scala`, - fileReplacePosition: 14, - groupName: 'Versions.Tests.mockito', - packageName: 'org.mockito:mockito-scala-scalatest_2.13', - registryUrls, - }, - { - currentValue: '3.1.9', - datasource: 'sbt-package', - depName: - 'com.softwaremill.sttp.client3:async-http-client-backend-future', - depType: 'Test', - editFile: `project/Versions.scala`, - fileReplacePosition: 4, - groupName: 'Versions.sttp', - packageName: - 'com.softwaremill.sttp.client3:async-http-client-backend-future_2.13', - registryUrls, - }, - ], - packageFile: `project/Versions.scala`, - }, - { - deps: [ - { - currentValue: '1.9.3', - datasource: 'sbt-plugin', - depName: 'org.scoverage:sbt-scoverage', - depType: 'plugin', - fileReplacePosition: 2, - packageName: 'org.scoverage:sbt-scoverage', - registryUrls: [ - ...registryUrls, - 'https://dl.bintray.com/sbt/sbt-plugin-releases', - ], - }, - { - currentValue: '1.0.1', - datasource: 'sbt-plugin', - depName: 'com.typesafe:sbt-mima-plugin', - depType: 'plugin', - fileReplacePosition: 3, - packageName: 'com.typesafe:sbt-mima-plugin_2.13', - registryUrls: [ - ...registryUrls, - 'https://dl.bintray.com/sbt/sbt-plugin-releases', - ], - }, - { - currentValue: '0.4.3', - datasource: 'sbt-plugin', - depName: 'pl.project13.scala:sbt-jmh', - depType: 'plugin', - fileReplacePosition: 4, - packageName: 'pl.project13.scala:sbt-jmh', - registryUrls: [ - ...registryUrls, - 'https://dl.bintray.com/sbt/sbt-plugin-releases', - ], - }, - ], - packageFile: 'project/plugins.sbt', - }, - ] as PackageFile[]); - }); - - it('extract simple-project with maven resolver', async () => { - const adminConfig: RepoGlobalConfig = { - localDir: `${fixturesDir}/simple-project-with-resolver`, - }; - GlobalConfig.set(adminConfig); - - const registryUrls = [ - 'https://repo.maven.apache.org/maven2', - 'https://example.org.com/internal-maven', - ]; - expect( - await extractAllPackageFiles(config, [ - `build.sbt`, - `project/plugins.sbt`, - `project/Versions.scala`, - `submodule/build.sbt`, - ]) - ).toEqual([ - { - deps: [ - { - currentValue: '2.13.5', - datasource: 'maven', - depName: 'scala', - packageName: 'org.scala-lang:scala-library', - registryUrls, - separateMinorPatch: true, - }, - { - currentValue: '1.2.11', - datasource: 'sbt-package', - depName: 'ch.qos.logback:logback-classic', - fileReplacePosition: 35, - packageName: 'ch.qos.logback:logback-classic', - registryUrls, - }, - ], - packageFile: `build.sbt`, - }, - { - deps: [ - { - currentValue: '0.13.0', - datasource: 'sbt-package', - depName: 'io.circe:circe-generic', - editFile: `project/Versions.scala`, - fileReplacePosition: 5, - groupName: 'Versions.circe', - packageName: 'io.circe:circe-generic_2.13', - registryUrls, - }, - { - currentValue: '10.2.6', - datasource: 'sbt-package', - depName: 'com.typesafe.akka:akka-http', - editFile: `project/Versions.scala`, - fileReplacePosition: 3, - groupName: 'Versions.akkaHttp', - packageName: 'com.typesafe.akka:akka-http_2.13', - registryUrls, - }, - { - currentValue: '2.6.18', - datasource: 'sbt-package', - depName: 'com.typesafe.akka:akka-stream', - editFile: `project/Versions.scala`, - fileReplacePosition: 2, - groupName: 'Versions.akka', - packageName: 'com.typesafe.akka:akka-stream_2.13', - registryUrls, - }, - ], - packageFile: `project/Versions.scala`, - }, - { - deps: [ - { - currentValue: '1.9.5', - datasource: 'sbt-plugin', - depName: 'org.scoverage:sbt-scoverage', - depType: 'plugin', - fileReplacePosition: 2, - packageName: 'org.scoverage:sbt-scoverage', - registryUrls: [ - ...registryUrls, - 'https://dl.bintray.com/sbt/sbt-plugin-releases', - ], - }, - ], - packageFile: `project/plugins.sbt`, - }, - ] as PackageFile[]); - }); - }); -}); diff --git a/lib/modules/manager/sbt/extract.ts b/lib/modules/manager/sbt/extract.ts index 93f30fbe92918d3..c62e379e208aa74 100644 --- a/lib/modules/manager/sbt/extract.ts +++ b/lib/modules/manager/sbt/extract.ts @@ -1,520 +1,413 @@ +import { lang, query as q } from 'good-enough-parser'; import upath from 'upath'; import { logger } from '../../../logger'; import { readLocalFile } from '../../../util/fs'; -import { newlineRegex, regEx } from '../../../util/regex'; +import { regEx } from '../../../util/regex'; +import { parseUrl } from '../../../util/url'; +import { GithubReleasesDatasource } from '../../datasource/github-releases'; import { MavenDatasource } from '../../datasource/maven'; -import { MAVEN_REPO } from '../../datasource/maven/common'; import { SbtPackageDatasource } from '../../datasource/sbt-package'; import { + SBT_PLUGINS_REPO, SbtPluginDatasource, - defaultRegistryUrls as sbtPluginDefaultRegistries, } from '../../datasource/sbt-plugin'; import { get } from '../../versioning'; import * as mavenVersioning from '../../versioning/maven'; +import * as semverVersioning from '../../versioning/semver'; +import { REGISTRY_URLS } from '../gradle/parser/common'; import type { ExtractConfig, PackageDependency, PackageFile } from '../types'; import type { GroupFilenameContent, - ParseContext, ParseOptions, VariableContext, + Variables, } from './types'; +import { normalizeScalaVersion } from './util'; -const stripComment = (str: string): string => - str.replace(regEx(/(^|\s+)\/\/.*$/), '').replace(regEx(/\/\*\*.*\*\*\//), ''); +// type Vars = Record; -const isSingleLineDep = (str: string): boolean => - regEx(/^\s*(libraryDependencies|dependencyOverrides)\s*\+=\s*/).test(str); +interface Ctx { + globalVars: Variables; + localVars: Variables; + deps: PackageDependency[]; + registryUrls: string[]; + + scalaVersion?: string; + packageFileVersion?: string; -const isDepsBegin = (str: string): boolean => - regEx(/^\s*(libraryDependencies|dependencyOverrides)\s*\+\+=\s*/).test(str) || - regEx(/\s*Seq\(\s*$/).test(str); + groupId?: string; + artifactId?: string; + currentValue?: string; + currentValueInfo?: VariableContext; -const isPluginDep = (str: string): boolean => - regEx(/^\s*(addSbtPlugin|addCompilerPlugin)\s*\(.*\)\s*$/).test(str); + currentVarName?: string; + depType?: string; + useScalaVersion?: boolean; + variableName?: string; + + packageFile: string; +} -const isStringLiteral = (str: string): boolean => regEx(/^"[^"]*"$/).test(str); +const scala = lang.createLang('scala'); + +const sbtVersionRegex = regEx( + 'sbt\\.version *= *(?\\d+\\.\\d+\\.\\d+)' +); + +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type +const nestedVariableLiteral = (handler: q.SymMatcherHandler) => + q.sym(handler).alt(q.many(q.op('.').sym(handler))); + +const scalaVersionMatch = q + .sym('scalaVersion') + .op(':=') + .alt( + q.str((ctx, { value: scalaVersion }) => ({ ...ctx, scalaVersion })), + nestedVariableLiteral((ctx, { value: varName }) => { + const scalaVersion = ctx.localVars[varName] ?? ctx.globalVars[varName]; + if (scalaVersion) { + ctx.scalaVersion = scalaVersion.val; + } + return ctx; + }) + ) + .handler((ctx) => { + if (ctx.scalaVersion) { + const version = get(mavenVersioning.id); + + let packageName = 'org.scala-lang:scala-library'; + if (version.getMajor(ctx.scalaVersion) === 3) { + packageName = 'org.scala-lang:scala3-library_3'; + } -const isScalaVersion = (str: string): boolean => - regEx(/^\s*(?:ThisBuild\s*\/\s*)?scalaVersion\s*:=\s*"[^"]*"[\s,]*$/).test( - str + const dep: PackageDependency = { + datasource: MavenDatasource.id, + depName: 'scala', + packageName, + currentValue: ctx.scalaVersion, + separateMinorPatch: true, + }; + ctx.scalaVersion = normalizeScalaVersion(ctx.scalaVersion); + ctx.deps.push(dep); + } + return ctx; + }); + +const packageFileVersionMatch = q + .sym('version') + .op(':=') + .alt( + q.str((ctx, { value: packageFileVersion }) => ({ + ...ctx, + packageFileVersion, + })), + nestedVariableLiteral((ctx, { value: varName }) => { + const packageFileVersion = + ctx.localVars[varName] ?? ctx.globalVars[varName]; + if (packageFileVersion) { + ctx.packageFileVersion = packageFileVersion.val; + } + return ctx; + }) // support var1, var1.var2.var3 ); -const getScalaVersion = (str: string): string => - str - .replace(regEx(/^\s*(?:ThisBuild\s*\/\s*)?scalaVersion\s*:=\s*"/), '') - .replace(regEx(/"[\s,]*$/), ''); - -const isPackageFileVersion = (str: string): boolean => - regEx(/^(version\s*:=\s*).*$/).test(str); - -const getPackageFileVersion = (str: string): string => - str - .replace(regEx(/^\s*version\s*:=\s*/), '') - .replace(regEx(/[\s,]*$/), '') - .replace(regEx(/"/g), ''); - -/* - https://www.scala-sbt.org/release/docs/Cross-Build.html#Publishing+conventions - */ -const normalizeScalaVersion = (str: string): string => { - // istanbul ignore if - if (!str) { - return str; - } - const versioning = get(mavenVersioning.id); - if (versioning.isVersion(str)) { - // Do not normalize unstable versions - if (!versioning.isStable(str)) { - return str; +const variableNameMatch = q + .sym((ctx, { value: varName }) => ({ + ...ctx, + currentVarName: varName, + })) + .opt(q.op(':').sym('String')); + +const variableValueMatch = q.str((ctx, { value, line }) => { + ctx.localVars[ctx.currentVarName!] = { + val: value, + sourceFile: ctx.packageFile, + lineIndex: line - 1, + }; + delete ctx.currentVarName; + return ctx; +}); + +const assignmentMatch = q.sym('val').join(variableNameMatch).op('='); + +const variableDefinitionMatch = q + .alt( + q.sym('lazy').join(assignmentMatch), + assignmentMatch, + variableNameMatch.op(':=') + ) + .join(variableValueMatch); + +const groupIdMatch = q.alt( + nestedVariableLiteral((ctx, { value: varName }) => { + const currentGroupId = ctx.localVars[varName] ?? ctx.globalVars[varName]; + if (currentGroupId) { + ctx.groupId = currentGroupId.val; } - // Do not normalize versions prior to 2.10 - if (!versioning.isGreaterThan(str, '2.10.0')) { - return str; + return ctx; + }), + q.str((ctx, { value: groupId }) => ({ ...ctx, groupId })) +); + +const artifactIdMatch = q.alt( + nestedVariableLiteral((ctx, { value: varName }) => { + const artifactId = ctx.localVars[varName] ?? ctx.globalVars[varName]; + if (artifactId) { + ctx.artifactId = artifactId.val; } + return ctx; + }), + q.str((ctx, { value: artifactId }) => ({ ...ctx, artifactId })) +); + +const resolveVariable: q.SymMatcherHandler = (ctx, { value: varName }) => { + const currentValue = ctx.localVars[varName] ?? ctx.globalVars[varName]; + if (currentValue) { + ctx.currentValue = currentValue.val; + ctx.currentValueInfo = currentValue; + ctx.variableName = varName; } - if (regEx(/^\d+\.\d+\.\d+$/).test(str)) { - return str.replace(regEx(/^(\d+)\.(\d+)\.\d+$/), '$1.$2'); - } - // istanbul ignore next - return str; -}; - -const isScalaVersionVariable = (str: string): boolean => - regEx( - /^\s*(?:ThisBuild\s*\/\s*)?scalaVersion\s*:=\s*[_a-zA-Z][_a-zA-Z0-9]*[\s,]*$/ - ).test(str); - -const getScalaVersionVariable = (str: string): string => - str - .replace(regEx(/^\s*(?:ThisBuild\s*\/\s*)?scalaVersion\s*:=\s*/), '') - .replace(regEx(/[\s,]*$/), ''); - -const isResolver = (str: string): boolean => - regEx( - /^\s*(resolvers\s*\+\+?=\s*((Seq|List|Stream)\()?)?"[^"]*"\s*at\s*"[^"]*"[\s,)]*$/ - ).test(str); -const getResolverUrl = (str: string): string => - str - .replace( - regEx( - /^\s*(resolvers\s*\+\+?=\s*((Seq|List|Stream)\()?)?"[^"]*"\s*at\s*"/ - ), - '' - ) - .replace(regEx(/"[\s,)]*$/), ''); - -const isVarDependency = (str: string): boolean => - regEx( - /^\s*(private\s*)?(lazy\s*)?val\s[_a-zA-Z][_a-zA-Z0-9]*\s*=.*(%%?).*%.*/ - ).test(str); - -const isVarDef = (str: string): boolean => - regEx( - /^\s*(private\s*)?(lazy\s*)?val\s+[_a-zA-Z][_a-zA-Z0-9]*\s*=\s*"[^"]*"\s*$/ - ).test(str); - -/** - * - * Check if variable definition is referencing another variable - * @param str line - * @returns {boolean} - */ -const isVarDefRefVar = (str: string): boolean => - regEx( - /^\s*(private\s*)?(lazy\s*)?val\s+[_a-zA-Z][_a-zA-Z0-9]*\s*=\s*[_a-zA-Z][_a-zA-Z0-9]*(\.[_a-zA-Z][_a-zA-Z0-9]*)*\s*$/ - ).test(str); - -const isVarSeqSingleLine = (str: string): boolean => - regEx( - /^\s*(private\s*)?(lazy\s*)?val\s+[_a-zA-Z][_a-zA-Z0-9]*\s*=\s*(Seq|List|Stream)\(.*\).*\s*$/ - ).test(str); - -const isVarSeqMultipleLine = (str: string): boolean => - regEx( - /^\s*(private\s*)?(lazy\s*)?val\s+[_a-zA-Z][_a-zA-Z0-9]*\s*=\s*(Seq|List|Stream)\(.*[^)]*.*$/ - ).test(str); - -const isObjectLine = (str: string): boolean => - regEx(/object\s+(\w+)\s+{/).test(str); - -const isObjectEndedLine = (str: string): boolean => - regEx(/^\s*}\s*$/).test(str); - -const getVarName = (str: string): string => - str.replace( - regEx(/^\s*(private\s*)?(lazy\s*)?val\s+([_a-zA-Z][_a-zA-Z0-9]*)\s*=.*$/), - '$3' - ); - -const isVarName = (str: string): boolean => - // allow dot annotation - regEx(/^[_a-zA-Z][_a-zA-Z0-9]*(\.[_a-zA-Z][_a-zA-Z0-9]*)*$/).test(str); - -const getVarInfo = ( - str: string, - { lookupVariableFile, lineIndex }: ParseContext -): VariableContext => { - const rightPart = str.replace( - regEx(/^\s*(private\s*)?(lazy\s*)?val\s+[_a-zA-Z][_a-zA-Z0-9]*\s*=\s*"/), - '' - ); - const val = rightPart.replace(regEx(/"\s*$/), ''); - return { val, sourceFile: lookupVariableFile!, lineIndex }; + return ctx; }; -function parseDepExpr( - expr: string, - ctx: ParseContext -): PackageDependency | null { +const versionMatch = q.alt( + nestedVariableLiteral(resolveVariable), // support var1, var1.var2.var3 + q.str((ctx, { value: currentValue }) => ({ ...ctx, currentValue })) // String literal "1.23.4" +); + +const simpleDependencyMatch = groupIdMatch + .op('%') + .join(artifactIdMatch) + .op('%') + .join(versionMatch); + +const versionedDependencyMatch = groupIdMatch + .op('%%') + .join(artifactIdMatch) + .handler((ctx) => ({ ...ctx, useScalaVersion: true })) + .op('%') + .join(versionMatch); + +const crossDependencyMatch = groupIdMatch + .op('%%%') + .join(artifactIdMatch) + .handler((ctx) => ({ ...ctx, useScalaVersion: true })) + .op('%') + .join(versionMatch); + +function depHandler(ctx: Ctx): Ctx { const { scalaVersion, - variables, - lineIndex, - globalVariables, - localVariables, + groupId, + artifactId, + currentValue, + useScalaVersion, + depType, + variableName, + currentValueInfo, } = ctx; - let { depType } = ctx; - - const isValidToken = (str: string): boolean => - isStringLiteral(str) || - (isVarName(str) && - (Boolean(localVariables[str]) || - Boolean(variables[str]) || - Boolean(globalVariables[str]))); - - const resolveToken = (str: string): string => { - if (isStringLiteral(str)) { - return str.replace(regEx(/^"/), '').replace(regEx(/"$/), ''); - } - if (localVariables[str]) { - ctx.lookupVariableFile = variables[str]?.sourceFile || ''; - return localVariables[str].val; - } - if (variables[str]) { - ctx.lookupVariableFile = variables[str]?.sourceFile || ''; - return variables[str].val; - } - if (globalVariables[str]) { - ctx.lookupVariableFile = globalVariables[str]?.sourceFile || ''; - return globalVariables[str].val; - } - return str; - }; - const tokens = expr - .trim() - .split(regEx(/("[^"]*")/g)) - .map((x) => (regEx(/"[^"]*"/).test(x) ? x : x.replace(regEx(/[()]+/g), ''))) - .join('') - .split(regEx(/\s*(%%?)\s*|\s*classifier\s*/)); - - const [ - rawGroupId, - groupOp, - rawArtifactId, - artifactOp, - rawVersion, - scopeOp, - rawScope, - ] = tokens; - - if (!rawGroupId) { - return null; - } - if (!isValidToken(rawGroupId)) { - return null; - } + delete ctx.groupId; + delete ctx.artifactId; + delete ctx.currentValue; + delete ctx.useScalaVersion; + delete ctx.depType; + delete ctx.variableName; + delete ctx.currentValueInfo; - if (!rawArtifactId) { - return null; - } - if (!isValidToken(rawArtifactId)) { - return null; - } - if (artifactOp !== '%') { - return null; - } - - if (!rawVersion) { - return null; - } - if (!isValidToken(rawVersion)) { - return null; - } - - if (scopeOp && scopeOp !== '%') { - return null; - } - const groupId = resolveToken(rawGroupId); - const depName = `${groupId}:${resolveToken(rawArtifactId)}`; - const artifactId = - groupOp === '%%' && scalaVersion - ? `${resolveToken(rawArtifactId)}_${scalaVersion}` - : resolveToken(rawArtifactId); - const packageName = `${groupId}:${artifactId}`; - const currentValue = resolveToken(rawVersion); - - if (!depType && rawScope) { - depType = rawScope.replace(regEx(/^"/), '').replace(regEx(/"$/), ''); - } + const depName = `${groupId!}:${artifactId!}`; - const result: PackageDependency = { + const dep: PackageDependency = { + datasource: SbtPackageDatasource.id, depName, - packageName, + packageName: + scalaVersion && useScalaVersion ? `${depName}_${scalaVersion}` : depName, currentValue, - fileReplacePosition: lineIndex, }; - const varDep = - localVariables[rawVersion] || - variables[rawVersion] || - globalVariables[rawVersion]; - if (varDep) { - result.groupName = `${rawVersion}`; - result.fileReplacePosition = varDep.lineIndex; - result.editFile = varDep.sourceFile; + if (depType) { + dep.depType = depType; + } + + if (depType === 'plugin') { + dep.datasource = SbtPluginDatasource.id; } - if (depType) { - result.depType = depType; + if (variableName) { + dep.groupName = variableName; + dep.variableName = variableName; + if (currentValueInfo) { + dep.fileReplacePosition = currentValueInfo.lineIndex; + dep.editFile = currentValueInfo.sourceFile; + } } - return result; + ctx.deps.push(dep); + + return ctx; } -function parseSbtLine( - acc: PackageFile & ParseOptions, - line: string, - lineIndex: number, - lines: string[] -): PackageFile & ParseOptions { - const { deps, registryUrls = [], variables = {}, globalVariables = {} } = acc; +function depTypeHandler(ctx: Ctx, { value: depType }: { value: string }): Ctx { + return { ...ctx, depType }; +} - let { - isMultiDeps, - scalaVersion, - packageFileVersion, - variableParentKey = '', - localVariables = {}, - } = acc; +const sbtPackageMatch = q + .opt(q.opt(q.sym('lazy')).sym('val').sym().op('=')) + .alt(crossDependencyMatch, simpleDependencyMatch, versionedDependencyMatch) + .opt( + q.alt( + q.sym('classifier').str(depTypeHandler), + q.op('%').sym(depTypeHandler), + q.op('%').str(depTypeHandler) + ) + ) + .handler(depHandler); + +const sbtPluginMatch = q + .sym(regEx(/^(?:addSbtPlugin|addCompilerPlugin)$/)) + .tree({ + type: 'wrapped-tree', + maxDepth: 1, + search: q + .begin() + .alt(simpleDependencyMatch, versionedDependencyMatch) + .end(), + }) + .handler((ctx) => ({ ...ctx, depType: 'plugin' })) + .handler(depHandler); + +const resolverMatch = q + .str() + .sym('at') + .str((ctx, { value }) => { + if (parseUrl(value)) { + ctx.registryUrls.push(value); + } + return ctx; + }); + +const addResolverMatch = q.sym('resolvers').alt( + q.op('+=').join(resolverMatch), + q.op('++=').sym('Seq').tree({ + type: 'wrapped-tree', + maxDepth: 1, + search: resolverMatch, + }) +); + +function registryUrlHandler(ctx: Ctx): Ctx { + for (const dep of ctx.deps) { + dep.registryUrls = [...ctx.registryUrls]; + if (dep.depType === 'plugin') { + dep.registryUrls.push(SBT_PLUGINS_REPO); + } + } + return ctx; +} - const ctx: ParseContext = { +const query = q.tree({ + type: 'root-tree', + maxDepth: 32, + search: q.alt( + scalaVersionMatch, + packageFileVersionMatch, + sbtPackageMatch, + sbtPluginMatch, + addResolverMatch, + variableDefinitionMatch + ), + postHandler: registryUrlHandler, +}); + +// Extract 1 file +export function extractPackageFile( + content: string, + { + packageFile, + registryUrls, + localVars, + globalVars, scalaVersion, - variables, - lookupVariableFile: acc.packageFile!, - lineIndex, - globalVariables, - localVariables, - }; + }: PackageFile & ParseOptions +): Ctx | null { + if ( + packageFile && + (packageFile === 'project/build.properties' || + packageFile.endsWith('/project/build.properties')) + ) { + const regexResult = sbtVersionRegex.exec(content); + const sbtVersion = regexResult?.groups?.version; + const matchString = regexResult?.[0]; + if (sbtVersion) { + const sbtDependency: PackageDependency = { + datasource: GithubReleasesDatasource.id, + depName: 'sbt/sbt', + packageName: 'sbt/sbt', + versioning: semverVersioning.id, + currentValue: sbtVersion, + replaceString: matchString, + extractVersion: '^v(?\\S+)', + editFile: packageFile, + }; - let dep: PackageDependency | null = null; - let scalaVersionVariable: string | null = null; - if (line !== '') { - if (isScalaVersion(line)) { - isMultiDeps = false; - const rawScalaVersion = getScalaVersion(line); - scalaVersion = normalizeScalaVersion(rawScalaVersion); - dep = { - datasource: MavenDatasource.id, - depName: 'scala', - packageName: 'org.scala-lang:scala-library', - currentValue: rawScalaVersion, - separateMinorPatch: true, + return { + deps: [sbtDependency], + globalVars: {}, + localVars: {}, + packageFile, + registryUrls: [REGISTRY_URLS.mavenCentral], }; - } else if (isScalaVersionVariable(line)) { - isMultiDeps = false; - scalaVersionVariable = getScalaVersionVariable(line); - const scalaVar = - localVariables[scalaVersionVariable] ?? - variables[scalaVersionVariable] ?? - globalVariables[scalaVersionVariable]; - if (scalaVar) { - scalaVersion = normalizeScalaVersion(scalaVar.val); - dep = { - datasource: MavenDatasource.id, - depName: 'scala', - packageName: 'org.scala-lang:scala-library', - currentValue: scalaVar.val, - separateMinorPatch: true, - }; - } - } else if (isPackageFileVersion(line)) { - packageFileVersion = getPackageFileVersion(line); - } else if (isResolver(line)) { - isMultiDeps = false; - const url = getResolverUrl(line); - registryUrls.push(url); - } else if (isVarSeqSingleLine(line)) { - isMultiDeps = false; - const depExpr = line - .replace(regEx(/^.*(Seq|List|Stream)\(\s*/), '') - .replace(regEx(/\).*$/), ''); - dep = parseDepExpr(depExpr, { - ...ctx, - }); - } else if (isVarSeqMultipleLine(line)) { - isMultiDeps = true; - const depExpr = line.replace(regEx(/^.*(Seq|List|Stream)\(\s*/), ''); - dep = parseDepExpr(depExpr, { - ...ctx, - }); - } else if (isObjectLine(line)) { - const objectName = line.replace(regEx(/object\s+(\w+)\s+{/), '$1'); - variableParentKey = - variableParentKey === '' - ? objectName - : `${variableParentKey}.${objectName.trim()}`; - } else if (isObjectEndedLine(line)) { - variableParentKey = variableParentKey.split('.').slice(0, -1).join('.'); - localVariables = {}; - } else if (isVarDef(line)) { - const key = variableParentKey === '' ? '' : `${variableParentKey}.`; - localVariables[getVarName(line)] = getVarInfo(line, ctx); - variables[key + getVarName(line)] = getVarInfo(line, ctx); - } else if (isVarDefRefVar(line)) { - const rightPart = line - .replace( - regEx( - /^\s*(private\s*)?(lazy\s*)?val\s+[_a-zA-Z][_a-zA-Z0-9]*\s*=\s*(.*)\s*$/ - ), - '$3' - ) - .trim(); - const isVarExist = variables[rightPart] || globalVariables[rightPart]; - if (isVarExist) { - const key = - (variableParentKey === '' ? '' : `${variableParentKey}.`) + - getVarName(line); - variables[key] = isVarExist; - } - } else if (isVarDependency(line)) { - isMultiDeps = false; - const depExpr = line - .replace( - regEx( - /^\s*(private\s*)?(lazy\s*)?val\s[_a-zA-Z][_a-zA-Z0-9]*\s*=\s*/ - ), - '' - ) - .replace(/\s*(force|withSources|exclude(All)?).*$/, ''); - dep = parseDepExpr(depExpr, { - ...ctx, - }); - } else if (isSingleLineDep(line)) { - isMultiDeps = false; - const depExpr = line.replace(regEx(/^.*\+=\s*/), ''); - dep = parseDepExpr(depExpr, { - ...ctx, - }); - } else if (isPluginDep(line)) { - isMultiDeps = false; - const depExpr = line.replace( - regEx( - /^\s*(addSbtPlugin|addCompilerPlugin)\s*\(+(.*(%%?).*(%)\s*(\w+|".*")\s*)\)+.*/ - ), - '$2' - ); - dep = parseDepExpr(depExpr, { - ...ctx, - depType: 'plugin', - }); - } else if (isDepsBegin(line)) { - isMultiDeps = true; - } else if (isMultiDeps) { - const rightPart = line.replace(regEx(/^[\s,]*/), ''); - const depExpr = rightPart - .replace(regEx(/[\s,]*$/), '') - .replace(/\s*(force|withSources|exclude(All)?).*$/, ''); - dep = parseDepExpr(depExpr, { - ...ctx, - }); + } else { + return null; } } - if (dep) { - if (!dep.datasource) { - if (dep.depType === 'plugin') { - dep.datasource = SbtPluginDatasource.id; - dep.registryUrls = [...registryUrls, ...sbtPluginDefaultRegistries]; - } else { - dep.datasource = SbtPackageDatasource.id; - } - } - deps.push({ - registryUrls, - ...dep, + let parsedResult: Ctx | null = null; + + try { + parsedResult = scala.query(content, query, { + globalVars, + localVars, + deps: [], + registryUrls: [REGISTRY_URLS.mavenCentral, ...(registryUrls ?? [])], + packageFile, + scalaVersion, }); + } catch (err) /* istanbul ignore next */ { + logger.warn({ err, packageFile }, 'Sbt parsing error'); } - if (lineIndex + 1 < lines.length) { - return { - ...acc, - isMultiDeps, - variableParentKey, - scalaVersion: - scalaVersion || - (scalaVersionVariable && - variables[scalaVersionVariable] && - normalizeScalaVersion(variables[scalaVersionVariable].val)), - packageFileVersion, - }; - } - return { - deps, - packageFileVersion, - scalaVersion, - }; -} - -export function extractFile( - content: string, - defaultAcc?: PackageFile & ParseOptions -): (PackageFile & ParseOptions) | null { - if (!content) { + if (!parsedResult) { return null; } - const equalsToNewLineRe = regEx(/=\s*\n/, 'gm'); - const goodContentForParsing = content.replace(equalsToNewLineRe, '='); - const lines = goodContentForParsing.split(newlineRegex).map(stripComment); - - const acc: PackageFile & ParseOptions = { - registryUrls: [MAVEN_REPO], - deps: [], - isMultiDeps: false, - scalaVersion: null, - variables: {}, - globalVariables: {}, - localVariables: {}, - ...defaultAcc, - }; - // TODO: needs major refactoring? - const res = lines.reduce(parseSbtLine, acc); - return res.deps.length ? res : null; + return parsedResult; } function prepareLoadPackageFiles( packageFilesContent: { packageFile: string; content: string }[] ): { - globalVariables: ParseOptions['variables']; + globalVars: ParseOptions['globalVars']; registryUrls: string[]; scalaVersion: ParseOptions['scalaVersion']; } { // Return variable - let globalVariables: ParseOptions['variables'] = {}; - const registryUrls: string[] = [MAVEN_REPO]; - let scalaVersion: string | null = null; + let globalVars: Variables = {}; + const registryUrls: string[] = [REGISTRY_URLS.mavenCentral]; + let scalaVersion: string | undefined = undefined; for (const { packageFile, content } of packageFilesContent) { const acc: PackageFile & ParseOptions = { - registryUrls, deps: [], - variables: globalVariables, + registryUrls, + localVars: globalVars, + globalVars: {}, packageFile, }; - const res = extractFile(content, acc); + const res = extractPackageFile(content, acc); + if (res) { - globalVariables = { ...globalVariables, ...res.variables }; + globalVars = { ...globalVars, ...res.localVars }; if (res.registryUrls) { registryUrls.push(...res.registryUrls); } @@ -525,7 +418,7 @@ function prepareLoadPackageFiles( } return { - globalVariables, + globalVars, registryUrls, scalaVersion, }; @@ -540,22 +433,22 @@ export async function extractAllPackageFiles( const groupPackageFileContent: GroupFilenameContent = {}; for (const packageFile of packageFiles) { const content = await readLocalFile(packageFile, 'utf8'); - if (content) { - const group = upath.dirname(packageFile); - groupPackageFileContent[group] ??= []; - groupPackageFileContent[group].push({ packageFile, content }); + if (!content) { + logger.trace({ packageFile }, 'packageFile has no content'); + continue; } - logger.trace({ packageFile }, 'packageFile has no content'); + const group = upath.dirname(packageFile); + groupPackageFileContent[group] ??= []; + groupPackageFileContent[group].push({ packageFile, content }); } // 1. globalVariables from project/ and root package file // 2. registry from all package file // 3. Project's scalaVersion - use in parseDepExpr to add suffix eg. "_2.13" - const { globalVariables, registryUrls, scalaVersion } = - prepareLoadPackageFiles([ - ...(groupPackageFileContent['project'] ?? []), // in project/ folder - ...(groupPackageFileContent['.'] ?? []), // root - ]); + const { globalVars, registryUrls, scalaVersion } = prepareLoadPackageFiles([ + ...(groupPackageFileContent['project'] ?? []), // in project/ folder + ...(groupPackageFileContent['.'] ?? []), // root + ]); const mapDepsToPackageFile: Record = {}; // Start extract all package files @@ -563,29 +456,20 @@ export async function extractAllPackageFiles( // Extract package file by its group // local variable is share within its group for (const { packageFile, content } of packageFileContents) { - const res = extractFile(content, { + const res = extractPackageFile(content, { registryUrls, deps: [], packageFile, scalaVersion, - globalVariables, + localVars: {}, + globalVars, }); - - if (res?.deps) { - for (const dep of res.deps) { - // "dep?.editFile" is the source of variable that package version is referecing with - // "packageFile" is where package usage was found - const variableSourceFile = dep?.editFile ?? packageFile; - dep.registryUrls = [...new Set(dep.registryUrls)]; - if (!mapDepsToPackageFile[variableSourceFile]) { - mapDepsToPackageFile[variableSourceFile] = []; - } - const isExist = mapDepsToPackageFile[variableSourceFile].find( - (val) => - val.packageName === dep.packageName && - val.currentValue === dep.currentValue - ); - if (!isExist) { + if (res) { + if (res?.deps) { + for (const dep of res.deps) { + const variableSourceFile = dep?.editFile ?? packageFile; + dep.registryUrls = [...new Set(dep.registryUrls)]; + mapDepsToPackageFile[variableSourceFile] ??= []; mapDepsToPackageFile[variableSourceFile].push(dep); } } @@ -593,14 +477,25 @@ export async function extractAllPackageFiles( } } - // Format from Record - // to {packageFile:string, deps: Dependency[]}[] - const formatedDeps = Object.entries(mapDepsToPackageFile).map( + // Filter unique package + // As we merge all package to single package file + // Packages are counted in submodule but it's the same one + // by packageName and currentValue + const finalPackages = Object.entries(mapDepsToPackageFile).map( ([packageFile, deps]) => ({ packageFile, - deps, + deps: deps.filter( + (val, idx, self) => + idx === + self.findIndex( + (dep) => + dep.packageName === val.packageName && + dep.currentValue === val.currentValue + ) + ), }) ); + logger.debug('finalPackages ' + JSON.stringify(finalPackages)); - return formatedDeps.length ? formatedDeps : null; + return finalPackages.length > 0 ? finalPackages : null; } diff --git a/lib/modules/manager/sbt/index.ts b/lib/modules/manager/sbt/index.ts index 4e215ba727b83cb..aa14ed079975c6d 100644 --- a/lib/modules/manager/sbt/index.ts +++ b/lib/modules/manager/sbt/index.ts @@ -1,3 +1,4 @@ +import { GithubReleasesDatasource } from '../../datasource/github-releases'; import { MavenDatasource } from '../../datasource/maven'; import { SbtPackageDatasource } from '../../datasource/sbt-package'; import { SbtPluginDatasource } from '../../datasource/sbt-plugin'; @@ -10,9 +11,14 @@ export const supportedDatasources = [ MavenDatasource.id, SbtPackageDatasource.id, SbtPluginDatasource.id, + GithubReleasesDatasource.id, // For sbt itself ]; export const defaultConfig = { - fileMatch: ['\\.sbt$', 'project/[^/]*.scala$'], + fileMatch: [ + '\\.sbt$', + 'project/[^/]*\\.scala$', + 'project/build\\.properties$', + ], versioning: ivyVersioning.id, }; diff --git a/lib/modules/manager/sbt/types.ts b/lib/modules/manager/sbt/types.ts index b6b8f7806a65bf4..d44e334a430e4b9 100644 --- a/lib/modules/manager/sbt/types.ts +++ b/lib/modules/manager/sbt/types.ts @@ -3,28 +3,17 @@ export type VariableContext = { sourceFile: string; lineIndex: number; }; -type Variables = Record; - -export interface ParseContext { - scalaVersion?: string | null; - localVariables: Variables; // variable within "object" scope ex.scalaVersion - variables: Variables; // variable that can be use outside scope ex."Versions.ScalaVersion" - lineIndex: number; - lookupVariableFile?: string; - depType?: string; - readonly globalVariables: Variables; // variable from root and project/ folder -} - -export interface ParseOptions { - variableParentKey?: string; - isMultiDeps?: boolean; - scalaVersion?: string | null; - variables?: Variables; - localVariables?: Variables; - readonly globalVariables?: Variables; -} +export type Variables = Record; export type GroupFilenameContent = Record< string, { packageFile: string; content: string }[] >; + +export interface ParseOptions { + packageFile?: string; + isMultiDeps?: boolean; + scalaVersion?: string; + localVars: Variables; + readonly globalVars: Variables; +} diff --git a/lib/workers/repository/updates/branchify.ts b/lib/workers/repository/updates/branchify.ts index 4401fb4341640d5..189513a6c2216de 100644 --- a/lib/workers/repository/updates/branchify.ts +++ b/lib/workers/repository/updates/branchify.ts @@ -19,6 +19,7 @@ export async function branchifyUpgrades( packageFiles: Record ): Promise { logger.debug('branchifyUpgrades'); + logger.debug(JSON.stringify(packageFiles)); const updates = await flattenUpdates(config, packageFiles); logger.debug( `${updates.length} flattened updates found: ${updates