Kait.Tool
0.0.4
See the version list below for details.
dotnet tool install --global Kait.Tool --version 0.0.4
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local Kait.Tool --version 0.0.4
#tool dotnet:?package=Kait.Tool&version=0.0.4
nuke :add-package Kait.Tool --version 0.0.4
kait
.NET tool to determine changed projects in a git repository, heavily inspired by dotnet-affected. Think of it as a more opinionated version with less features, less tests and more bugs.
Description:
Usage:
kait [<directory>] [options]
Arguments:
<directory> Directory to operate on, if not specified current directory will be used. [default: {CurrentDirectory}]
Options:
--base, --base-reference <base-reference>
--format <Json|Plain|Slnf|Traversal> Format of the output file
--out, --output <output> Path to output file, if not specified stdout will be used.
--loglevel <Critical|Debug|Error|Information|None|Trace|Warning> [default: Warning]
--project <project> Project or solution to derive entrypoints from
--relative-output Output paths should be relative to current directory or output file if specified
--version Show version information
-?, -h, --help Show help and usage information
Examples
I want to know which projects in a folder would be affected by changes in working tree / index
kait
I want to publish all changed projects in solution
kait --project=<SOLUTION>.sln --output=affected.proj
dotnet publish affected.proj
I want to publish all projects that have changed since previous commit
kait --project=<Solution>.sln --output=affected.slnf --base=HEAD~1
dotnet publish affected.slnf --target=PublishContainerImage
I want to test all projects that are affected by changes in a pull request
Specify --base to the target branch of the pull request
- name: Calculate affected projects
run: kait --base={{ github.base_ref }}--out /tmp/affected.proj
- name: Test affected projects
run: dotnet test /tmp/affected.proj
But I'm using Azure DevOps
When building in Azure DevOps using branch policies an automatic merge commit is created. We can use this to calculate the affected projects (probably)
script: kait --base=HEAD~1 --out /tmp/affected.proj
displayName: Calculate affected projects
But I've merged my pull request and I want changed projects to be built/publish/tested/packed
Cool. What you probably want to do is calculate the last successful run and use that as a base to calculate which projects have been affected. You could PROBABLY use nrwl/nx-set-shas to do this, but I really don't know.
If you're on Azure Pipelines you should be able to query the Azure DevOps REST API using az to get the last successful run of a pipeline. e.g.
BASE_REF=$(az pipelines build list --branch $(Build.SourceBranchName) --definition-ids $(System.DefinitionId) --result succeeded --top 1 --query "[0].triggerInfo.\"ci.sourceSha\""))
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
This package has no dependencies.