-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
194 lines (159 loc) · 6.46 KB
/
Copy pathMakefile
File metadata and controls
194 lines (159 loc) · 6.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
.PHONY: help build test clean restore format lint pack publish docker-build docker-run docs
# Default target
.DEFAULT_GOAL := help
# Variables
DOTNET := dotnet
CONFIG := Release
OUTPUT_DIR := ./build
PACK_OUTPUT := ./nupkg
VERSION := 1.2.0
help: ## Display this help message
@echo "dotnet-plugin-engine - Build and development commands"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
clean: ## Remove build artifacts and output directories
@echo "🧹 Cleaning build artifacts..."
@$(DOTNET) clean -c $(CONFIG) || true
@rm -rf $(OUTPUT_DIR) $(PACK_OUTPUT) bin obj coverage
@echo "✓ Clean complete"
restore: ## Restore NuGet packages
@echo "📦 Restoring packages..."
@$(DOTNET) restore
@echo "✓ Restore complete"
build: restore ## Build the project
@echo "🔨 Building project ($(CONFIG))..."
@$(DOTNET) build -c $(CONFIG) --no-restore
@echo "✓ Build complete"
build-debug: restore ## Build in Debug configuration
@echo "🔨 Building in Debug..."
@$(DOTNET) build -c Debug --no-restore
@echo "✓ Debug build complete"
test: build ## Run unit tests
@echo "🧪 Running tests..."
@$(DOTNET) test -c $(CONFIG) --no-build --verbosity normal
@echo "✓ Tests passed"
test-coverage: ## Run tests with code coverage
@echo "📊 Running tests with coverage..."
@$(DOTNET) test -c $(CONFIG) /p:CollectCoverage=true /p:CoverageFormat=opencover
@echo "✓ Coverage report generated"
format: ## Format code using dotnet format
@echo "🎨 Formatting code..."
@$(DOTNET) format
@echo "✓ Format complete"
format-check: ## Check if code is properly formatted
@echo "🎨 Checking code format..."
@$(DOTNET) format --verify-no-changes --verbosity diagnostic
@echo "✓ Code is properly formatted"
lint: format-check ## Run code linting
@echo "🔍 Linting code..."
@$(DOTNET) build -c $(CONFIG) /p:TreatWarningsAsErrors=true --no-restore
@echo "✓ No linting issues"
pack: build ## Create NuGet package
@echo "📦 Creating NuGet package..."
@$(DOTNET) pack -c $(CONFIG) -o $(PACK_OUTPUT)
@echo "✓ Package created: $(PACK_OUTPUT)"
pack-version: build ## Create NuGet package with specific version
@echo "📦 Creating NuGet package v$(VERSION)..."
@$(DOTNET) pack -c $(CONFIG) -o $(PACK_OUTPUT) /p:PackageVersion=$(VERSION)
@echo "✓ Package created: $(PACK_OUTPUT)"
publish: ## Publish to NuGet (requires NUGET_API_KEY environment variable)
@echo "🚀 Publishing to NuGet..."
@if [ -z "$$NUGET_API_KEY" ]; then echo "❌ NUGET_API_KEY not set"; exit 1; fi
@$(DOTNET) nuget push $(PACK_OUTPUT)/*.nupkg --api-key $$NUGET_API_KEY --source https://api.nuget.org/v3/index.json
@echo "✓ Published to NuGet"
docs: ## Generate documentation (if docfx installed)
@echo "📚 Generating documentation..."
@if command -v docfx &> /dev/null; then docfx docfx.json; else echo "⚠ docfx not found, skipping"; fi
@echo "✓ Documentation generated"
watch: ## Watch for file changes and rebuild
@echo "👀 Watching for changes..."
@$(DOTNET) watch -p src/PluginEngine build -c Debug
ci: clean restore build format-check test lint ## Full CI pipeline
@echo "✅ CI pipeline passed"
docker-build: ## Build Docker image
@echo "🐳 Building Docker image..."
@docker build -t dotnet-plugin-engine:$(VERSION) .
@docker tag dotnet-plugin-engine:$(VERSION) dotnet-plugin-engine:latest
@echo "✓ Docker image built"
docker-run: docker-build ## Run Docker container
@echo "🐳 Running Docker container..."
@docker run -it --name plugin-engine-demo \
-p 5000:5000 \
-v $$PWD/plugins:/app/plugins \
-v $$PWD/logs:/app/logs \
dotnet-plugin-engine:latest
@echo "✓ Container running"
docker-clean: ## Remove Docker image and container
@echo "🧹 Cleaning Docker..."
@docker rm -f plugin-engine-demo || true
@docker rmi dotnet-plugin-engine:latest || true
@echo "✓ Docker cleanup complete"
examples: build ## Run examples
@echo "▶️ Running examples..."
@echo "Available examples:"
@echo " - BasicPluginHost"
@echo " - HotReloadExample"
@echo " - DependencyResolutionExample"
@echo " - ErrorHandlingExample"
example-basic: build ## Run BasicPluginHost example
@echo "▶️ Running BasicPluginHost..."
@$(DOTNET) run --project examples --args "BasicPluginHost"
bench: build ## Run benchmarks (if BenchmarkDotNet installed)
@echo "⚡ Running benchmarks..."
@$(DOTNET) run -c Release --project benchmarks
@echo "✓ Benchmarks complete"
info: ## Display project information
@echo "dotnet-plugin-engine v$(VERSION)"
@echo ""
@echo "🔧 Build Environment:"
@$(DOTNET) --version
@$(DOTNET) --info | grep "OS Platform"
@echo ""
@echo "📦 Project Structure:"
@ls -la src/PluginEngine/PluginEngine.csproj
@echo ""
@echo "📚 Documentation:"
@echo " - README.md"
@echo " - docs/getting-started.md"
@echo " - docs/architecture.md"
@echo " - docs/api-reference.md"
@echo " - docs/alc-isolation-guide.md"
@echo " - docs/deployment.md"
@echo " - docs/faq.md"
# Development targets
dev: ## Set up development environment
@echo "🛠️ Setting up development environment..."
@$(DOTNET) tool restore
@echo "✓ Development environment ready"
version: ## Display current version
@echo "Version: $(VERSION)"
# Advanced targets
analyze: build ## Run static code analysis
@echo "🔍 Running static analysis..."
@$(DOTNET) build -c $(CONFIG) /p:EnforceCodeStyleInBuild=true
security-scan: ## Scan for security vulnerabilities
@echo "🔒 Scanning for vulnerabilities..."
@$(DOTNET) list package --vulnerable
@echo "✓ Security scan complete"
update-packages: ## Update NuGet packages to latest versions
@echo "📦 Updating packages..."
@$(DOTNET) list package --outdated
@echo "Run: dotnet package update to apply updates"
benchmark-report: bench ## Generate benchmark report
@echo "📊 Benchmark report generated in BenchmarkDotNet.Artifacts/"
# Cleanup targets
distclean: clean docker-clean ## Deep clean (removes all generated files)
@echo "🧹 Deep clean complete"
# Installation targets
install-tools: ## Install required dotnet tools
@echo "🛠️ Installing dotnet tools..."
@$(DOTNET) tool install -g dotnet-format
@$(DOTNET) tool install -g dotnet-coverage
@$(DOTNET) tool install -g dotnet-outdated-tool
@echo "✓ Tools installed"
# Release targets
release: ci pack-version ## Create a release build
@echo "🎉 Release build complete"
@echo "Package location: $(PACK_OUTPUT)"
pre-commit: format lint test ## Run pre-commit checks
@echo "✅ Pre-commit checks passed"