diff --git a/src/cli/install-tool/index.ts b/src/cli/install-tool/index.ts index 6619a1fc58..33fdf31d90 100644 --- a/src/cli/install-tool/index.ts +++ b/src/cli/install-tool/index.ts @@ -17,6 +17,7 @@ import { DockerInstallService } from '../tools/docker'; import { BuildxInstallService } from '../tools/docker/buildx'; import { DockerComposeInstallService } from '../tools/docker/compose'; import { DotnetInstallService } from '../tools/dotnet'; +import { PaketInstallService } from '../tools/dotnet/paket'; import { ErlangInstallService } from '../tools/erlang'; import { ElixirInstallService } from '../tools/erlang/elixir'; import { FlutterInstallService } from '../tools/flutter'; @@ -143,6 +144,7 @@ async function prepareInstallContainer(): Promise { container.bind(INSTALL_TOOL_TOKEN).to(MavenInstallService); container.bind(INSTALL_TOOL_TOKEN).to(NixInstallService); container.bind(INSTALL_TOOL_TOKEN).to(NodeInstallService); + container.bind(INSTALL_TOOL_TOKEN).to(PaketInstallService); container.bind(INSTALL_TOOL_TOKEN).to(PhpInstallService); container.bind(INSTALL_TOOL_TOKEN).to(PixiInstallService); container.bind(INSTALL_TOOL_TOKEN).to(PowershellInstallService); diff --git a/src/cli/tools/dotnet/paket.ts b/src/cli/tools/dotnet/paket.ts new file mode 100644 index 0000000000..e66bdc93a7 --- /dev/null +++ b/src/cli/tools/dotnet/paket.ts @@ -0,0 +1,34 @@ +import { join } from 'node:path'; +import { execa } from 'execa'; +import { injectFromHierarchy, injectable } from 'inversify'; +import { BaseInstallService } from '../../install-tool/base-install.service'; + +@injectable() +@injectFromHierarchy() +export class PaketInstallService extends BaseInstallService { + readonly name = 'paket'; + + override async install(version: string): Promise { + const toolPath = this.pathSvc.toolPath(this.name); + + const dotnet = join(this.pathSvc.toolPath('dotnet'), 'dotnet'); + await execa(dotnet, [ + 'tool', + 'install', + '--tool-path', + toolPath, + this.name, + '--version', + version, + ]); + } + + override async link(_version: string): Promise { + const src = this.pathSvc.toolPath(this.name); + await this.shellwrapper({ srcDir: src, extraToolEnvs: ['dotnet'] }); + } + + override async test(_version: string): Promise { + await execa(this.name, ['--version'], { stdio: ['inherit', 'inherit', 1] }); + } +} diff --git a/src/cli/tools/index.ts b/src/cli/tools/index.ts index 7f901ebff8..e8a1752a22 100644 --- a/src/cli/tools/index.ts +++ b/src/cli/tools/index.ts @@ -29,6 +29,7 @@ export const NoPrepareTools = [ 'maven', 'nix', 'npm', + 'paket', 'pdm', 'pip-tools', 'pipenv', diff --git a/test/dotnet/Dockerfile b/test/dotnet/Dockerfile index a75c534bc1..f9d1a06a9e 100644 --- a/test/dotnet/Dockerfile +++ b/test/dotnet/Dockerfile @@ -129,6 +129,19 @@ RUN set -ex; \ dotnet add package Newtonsoft.Json --version 12.0.3; \ dotnet restore --force-evaluate +#-------------------------------------- +# test: paket +#-------------------------------------- +FROM build AS test-others + +# renovate: datasource=nuget packageName=Paket +RUN install-tool paket 9.0.2 + +WORKDIR /test +RUN set -ex; \ + ls -la; env; \ + paket init + #-------------------------------------- # final #-------------------------------------- @@ -138,3 +151,4 @@ COPY --from=testa /.dummy /.dummy COPY --from=testb /.dummy /.dummy COPY --from=testc /.dummy /.dummy COPY --from=testd /.dummy /.dummy +COPY --from=test-others /.dummy /.dummy diff --git a/test/dotnet/Dockerfile.arm64 b/test/dotnet/Dockerfile.arm64 index b7113c12b7..4eb8229bbd 100644 --- a/test/dotnet/Dockerfile.arm64 +++ b/test/dotnet/Dockerfile.arm64 @@ -40,9 +40,26 @@ FROM base AS test-dotnet # renovate: datasource=dotnet packageName=dotnet-sdk RUN install-tool dotnet 10.0.100 +#-------------------------------------- +# test: paket +#-------------------------------------- +FROM base AS test-others + +# renovate: datasource=dotnet packageName=dotnet-sdk +RUN install-tool dotnet 10.0.100 + +# renovate: datasource=nuget packageName=Paket +RUN install-tool paket 9.0.2 + +WORKDIR /test +RUN set -ex; \ + ls -la; env; \ + paket init + #-------------------------------------- # Image: final #-------------------------------------- FROM base COPY --from=test-dotnet /.dummy /.dummy +COPY --from=test-others /.dummy /.dummy