dotnet builder function

This commit is contained in:
Wryn Wagner 2021-06-28 11:26:34 -06:00
parent 3ce04cbafd
commit 3ed9e45a6b

View File

@ -77,13 +77,26 @@ function DotnetTest(filter = '')
call TmuxTest(l:command)
endfunction
function DotnetBuild()
let l:command =
\ 'cd ' . GetDotnetProjectLocation()
\ . ';' . 'dotnet build -clp:ErrorsOnly'
call TmuxTest(l:command)
endfunction
function GetDotnetProjectLocation(test = 0)
let l:projectRoot = substitute(expand(getcwd()), '/code.*', '/code', '')
let l:projectName = substitute(expand(getcwd()), l:projectRoot . '/\([^/]*\).*', '\1', '')
if a:test
let l:testPath = system('ls ' . l:projectRoot . '/**/*.csproj | grep Test | head -1')
else
if l:projectName != ''
let l:testPath = l:projectRoot . '/' . l:projectName
else
let l:testPath = system('ls ' . l:projectRoot . '/**/*.csproj | grep -v Test | head -1')
endif
endif
return substitute(l:testPath, '\(.*\)/.*.csproj.*', '\1', '')
endfunction