+ All Categories
Home > Documents > Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell...

Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell...

Date post: 26-Jun-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
52
Modern Build Automation for C#/.NET - Matthias Koch @matkoch87 @nukebuildnet
Transcript
Page 1: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Modern Build Automation for C#/.NET- Matthias Koch

@matkoch87@nukebuildnet

Page 2: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Background● Used MSBuild

○ But XML isn’t very handy

● Used PowerShell○ Lots of unknown unknowns

● Skipped FAKE○ Learning curve of new language

● Used CAKE○ Still scripting

Page 3: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

10 Ingredients for an

AKEless* Build System

© Nikolai Norman Andersen

Page 4: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

ingredients[0] =

"Console Application"

Page 5: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions
Page 6: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

ingredients[1] =

"CLI Tool Support"

Page 7: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions
Page 8: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Fluent API

Page 9: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Specification

Page 10: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Composition I

Page 11: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Composition II

Page 12: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions
Page 13: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Lightweight Resolution

Page 14: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Lightweight Resolution

Page 15: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Tool Dependencies

Page 16: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

ingredients[2] =

"Path Handling"

Page 17: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Division Operator Magic

Page 18: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

ingredients[3] =

"Value Auto-Injection"

Page 19: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions
Page 20: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions
Page 21: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions
Page 22: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

ingredients[4] =

"Target Model"

Page 23: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Target Definitions● Compile depends on Restore

○ DependsOn(Restore)

○ DependentFor(Compile)

● Restore must run after Clean○ Before(Restore)

○ After(Clean)

● Publish triggers Announce○ Triggers(Announce)

○ TriggeredBy(Publish)

● Cleanup must always run○ AssuredAfterFailure()

● Announce must not stop execution○ ProceedAfterFailure()

● Conditions○ OnlyWhenStatic(() => true)

○ OnlyWhenDynamic(() => false)

● Skip behavior○ WhenSkipped(Behavior.Skip)

○ WhenSkipped(Behavior.Execute)

Page 24: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Dependency Graph

Page 25: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

ingredients[5] =

"CI Integration"

Page 26: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Collapsing

Page 27: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Configuration Generation

Page 28: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions
Page 29: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Artifacts

Page 30: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Artifacts

Page 31: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Parameters

Page 32: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Partitioning

Page 33: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions
Page 34: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions
Page 35: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

ingredients[6] =

"IDE Extensions"

Page 36: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions
Page 37: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions
Page 38: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions
Page 39: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions
Page 40: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions
Page 41: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

ingredients[7] =

"Global Tool"

Page 42: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

$ dotnet tool install Nuke.GlobalTool --global

Page 43: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions
Page 44: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Applied changes (after setup)

Page 45: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions
Page 46: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

ingredients[8] =

"Build Sharing"

Page 47: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Strategies● Git Submodules

● NuGet Packages

● External Files

● .NET Global Tools

● Default Interface Members?

Page 48: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Global Tools

dotnet pack

_build.csproj _build.nupkg

Page 49: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

External Files

Build.tmp

Build.cs.ext

Build.cs

nuke

Page 50: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

ingredients[9] =

"Community"❤

Page 51: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions
Page 52: Modern Build Automation for C#/Background Used MSBuild But XML isn’t very handy Used PowerShell Lots of unknown unknowns Skipped FAKE Learning curve of new language Target Definitions

Ask Me Anything


Recommended