mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Merge pull request #2332 from WallucePinkham/main
Handling multiple outputs from dotnet pack
This commit is contained in:
commit
ecd7363676
8 changed files with 101 additions and 15 deletions
|
|
@ -59,22 +59,19 @@ def install_environment(
|
||||||
|
|
||||||
# Determine tool from the packaged file <tool_name>.<version>.nupkg
|
# Determine tool from the packaged file <tool_name>.<version>.nupkg
|
||||||
build_outputs = os.listdir(os.path.join(prefix.prefix_dir, build_dir))
|
build_outputs = os.listdir(os.path.join(prefix.prefix_dir, build_dir))
|
||||||
if len(build_outputs) != 1:
|
for output in build_outputs:
|
||||||
raise NotImplementedError(
|
tool_name = output.split('.')[0]
|
||||||
f"Can't handle multiple build outputs. Got {build_outputs}",
|
|
||||||
)
|
|
||||||
tool_name = build_outputs[0].split('.')[0]
|
|
||||||
|
|
||||||
# Install to bin dir
|
# Install to bin dir
|
||||||
helpers.run_setup_cmd(
|
helpers.run_setup_cmd(
|
||||||
prefix,
|
prefix,
|
||||||
(
|
(
|
||||||
'dotnet', 'tool', 'install',
|
'dotnet', 'tool', 'install',
|
||||||
'--tool-path', os.path.join(envdir, BIN_DIR),
|
'--tool-path', os.path.join(envdir, BIN_DIR),
|
||||||
'--add-source', build_dir,
|
'--add-source', build_dir,
|
||||||
tool_name,
|
tool_name,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Clean the git dir, ignoring the environment dir
|
# Clean the git dir, ignoring the environment dir
|
||||||
clean_cmd = ('git', 'clean', '-ffxd', '-e', f'{ENVIRONMENT_DIR}-*')
|
clean_cmd = ('git', 'clean', '-ffxd', '-e', f'{ENVIRONMENT_DIR}-*')
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
- id: dotnet-example-hook
|
||||||
|
name: Test Project 1
|
||||||
|
description: Test Project 1
|
||||||
|
entry: proj1
|
||||||
|
language: dotnet
|
||||||
|
stages: [commit]
|
||||||
|
- id: proj2
|
||||||
|
name: Test Project 2
|
||||||
|
description: Test Project 2
|
||||||
|
entry: proj2
|
||||||
|
language: dotnet
|
||||||
|
stages: [commit]
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.30114.105
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "proj1", "proj1\proj1.csproj", "{38A939C3-DEA4-47D7-9B75-0418C4249662}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "proj2", "proj2\proj2.csproj", "{4C9916CB-165C-4EF5-8A57-4CB6794C1EBF}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{38A939C3-DEA4-47D7-9B75-0418C4249662}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{38A939C3-DEA4-47D7-9B75-0418C4249662}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{38A939C3-DEA4-47D7-9B75-0418C4249662}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{38A939C3-DEA4-47D7-9B75-0418C4249662}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{4C9916CB-165C-4EF5-8A57-4CB6794C1EBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4C9916CB-165C-4EF5-8A57-4CB6794C1EBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4C9916CB-165C-4EF5-8A57-4CB6794C1EBF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4C9916CB-165C-4EF5-8A57-4CB6794C1EBF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
12
testing/resources/dotnet_hooks_combo_repo/proj1/Program.cs
Normal file
12
testing/resources/dotnet_hooks_combo_repo/proj1/Program.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace proj1
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.Write("Hello from dotnet!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
testing/resources/dotnet_hooks_combo_repo/proj1/proj1.csproj
Normal file
12
testing/resources/dotnet_hooks_combo_repo/proj1/proj1.csproj
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
|
||||||
|
<PackAsTool>true</PackAsTool>
|
||||||
|
<ToolCommandName>proj1</ToolCommandName>
|
||||||
|
<PackageOutputPath>./nupkg</PackageOutputPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
12
testing/resources/dotnet_hooks_combo_repo/proj2/Program.cs
Normal file
12
testing/resources/dotnet_hooks_combo_repo/proj2/Program.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace proj2
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Hello World!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
testing/resources/dotnet_hooks_combo_repo/proj2/proj2.csproj
Normal file
12
testing/resources/dotnet_hooks_combo_repo/proj2/proj2.csproj
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
|
||||||
|
<PackAsTool>true</PackAsTool>
|
||||||
|
<ToolCommandName>proj2</ToolCommandName>
|
||||||
|
<PackageOutputPath>./nupkg</PackageOutputPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -1042,6 +1042,7 @@ def test_local_perl_additional_dependencies(store):
|
||||||
(
|
(
|
||||||
'dotnet_hooks_csproj_repo',
|
'dotnet_hooks_csproj_repo',
|
||||||
'dotnet_hooks_sln_repo',
|
'dotnet_hooks_sln_repo',
|
||||||
|
'dotnet_hooks_combo_repo',
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
def test_dotnet_hook(tempdir_factory, store, repo):
|
def test_dotnet_hook(tempdir_factory, store, repo):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue