GiantCroissant.Lunar.Build.Configuration 0.1.1-ci.90

This is a prerelease version of GiantCroissant.Lunar.Build.Configuration.
dotnet add package GiantCroissant.Lunar.Build.Configuration --version 0.1.1-ci.90
                    
NuGet\Install-Package GiantCroissant.Lunar.Build.Configuration -Version 0.1.1-ci.90
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GiantCroissant.Lunar.Build.Configuration" Version="0.1.1-ci.90" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GiantCroissant.Lunar.Build.Configuration" Version="0.1.1-ci.90" />
                    
Directory.Packages.props
<PackageReference Include="GiantCroissant.Lunar.Build.Configuration" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GiantCroissant.Lunar.Build.Configuration --version 0.1.1-ci.90
                    
#r "nuget: GiantCroissant.Lunar.Build.Configuration, 0.1.1-ci.90"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package GiantCroissant.Lunar.Build.Configuration@0.1.1-ci.90
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GiantCroissant.Lunar.Build.Configuration&version=0.1.1-ci.90&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=GiantCroissant.Lunar.Build.Configuration&version=0.1.1-ci.90&prerelease
                    
Install as a Cake Tool

Configuration Components

This directory contains shared configuration interfaces and implementations for NUKE build automation.

Components

IWrapperPath (replaces IWrapperPathComponent)

A simplified, reusable interface that provides wrapper script integration for location-independent builds with priority-based path resolution and smart configuration discovery.

Deprecation: IWrapperPathComponent has been replaced by IWrapperPath. Please migrate any remaining references.

Overview

The IWrapperPath solves the common problem of JSON configuration discovery in multi-project workspaces by providing:

  • Priority-based parameter resolution: Script parameters → Environment variables → Auto-detection
  • Location-independent builds: Execute builds from any directory without fragile relative paths
  • Smart configuration discovery: Automatically find project-specific build-config.json files
  • Cross-platform compatibility: Works with both PowerShell and CMD wrapper scripts
Features
  • 🎯 Parameter Priority System: Script parameters take precedence over environment variables
  • 📍 Auto-detection: Automatically detect project root from script location
  • 🔍 Smart Config Discovery: Find project-specific configuration files using validation patterns
  • 🏗️ Location Independence: Execute builds from any working directory
  • 🛠️ Debug Support: Built-in DebugWrapper target for troubleshooting
Implementation

To use IWrapperPath in your build class:

partial class Build : 
    NukeBuild, 
    IGeneralizedBuildComponent,
    IWrapperPath           // Add this interface
{
    // 1. Define project-specific configuration identifiers
    public string[] ProjectConfigIdentifiers => new[]
    {
        "com.yourcompany.yourproject",
        "scoped-1234",
        "Your Project Name"
    };

    // 2. Add wrapper parameter properties with NUKE Parameter attributes
    [Parameter("NUKE root directory override from wrapper script", Name = "wrapper-nuke-root")]
    readonly string? _wrapperNukeRootParam;
    
    [Parameter("Config path override from wrapper script", Name = "wrapper-config-path")] 
    readonly string? _wrapperConfigPathParam;
    
    [Parameter("Script directory from wrapper script", Name = "wrapper-script-dir")]
    readonly string? _wrapperScriptDirParam;
    
    // 3. Implement interface properties
    public string? WrapperNukeRootParam => _wrapperNukeRootParam;
    public string? WrapperConfigPathParam => _wrapperConfigPathParam; 
    public string? WrapperScriptDirParam => _wrapperScriptDirParam;

    // 4. Use WrapperNukeRoot/WrapperConfigPath for path resolution
    private IBuildConfigurationProvider ConfigProvider
    {
        get
        {
            if (_configProvider == null)
            {
                _configProvider = new BuildConfigurationProvider();
                var root = WrapperNukeRoot; // From interface
                var configPath = WrapperConfigPath; // From interface
                _configProvider.LoadConfiguration(root, configPath);
            }
            return _configProvider;
        }
    }
}
Wrapper Script Integration

Create wrapper scripts in your project's build/nuke/scripts/ directory:

PowerShell: build-with-root.ps1

[CmdletBinding()]
Param(
    [Parameter(Mandatory=$false)]
    [string]$NukeRoot,
    
    [Parameter(Mandatory=$false)]
    [string]$ConfigPath,
    
    [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
    [string[]]$BuildArguments
)

# Set environment variables and parameters
if ($NukeRoot) {
    $env:WRAPPER_NUKE_ROOT = $NukeRoot
}

if ($ConfigPath) {
    $env:WRAPPER_CONFIG_PATH = $ConfigPath  
}

if ($PSScriptRoot) {
    $env:WRAPPER_SCRIPT_DIR = $PSScriptRoot
}

# Auto-detect project root (3 levels up from scripts/)
if (-not $NukeRoot -and $PSScriptRoot) {
    $DetectedRoot = Split-Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) -Parent
    $env:WRAPPER_NUKE_ROOT = $DetectedRoot
}

# Build final arguments with wrapper parameters
$FinalBuildArguments = @()

if ($NukeRoot) {
    $FinalBuildArguments += "--wrapper-nuke-root=$NukeRoot"
}

if ($ConfigPath) {
    $FinalBuildArguments += "--wrapper-config-path=$ConfigPath"
}

if ($PSScriptRoot) {
    $FinalBuildArguments += "--wrapper-script-dir=$PSScriptRoot"
}

if ($env:WRAPPER_NUKE_ROOT) {
    $FinalBuildArguments += "--root=$($env:WRAPPER_NUKE_ROOT)"
}

if ($BuildArguments) {
    $FinalBuildArguments += $BuildArguments
}

# Change to project root and execute build
$BuildScript = Join-Path (Split-Path $PSScriptRoot -Parent) "build.ps1"
$OriginalLocation = Get-Location

if ($env:WRAPPER_NUKE_ROOT -and (Test-Path $env:WRAPPER_NUKE_ROOT)) {
    Set-Location $env:WRAPPER_NUKE_ROOT
}

try {
    & $BuildScript @FinalBuildArguments
    $exitCode = $LASTEXITCODE
} finally {
    Set-Location $OriginalLocation
}

exit $exitCode

CMD: build-with-root.cmd

@echo off
setlocal

REM Auto-detect project root from script location
for %%I in (%~dp0..) do set "NUKE_DIR=%%~fI"
for %%I in (%NUKE_DIR%\..) do set "BUILD_DIR=%%~fI"  
for %%I in (%BUILD_DIR%\..) do set "PROJECT_ROOT=%%~fI"

REM Set environment variables
set WRAPPER_SCRIPT_DIR=%~dp0
set WRAPPER_NUKE_ROOT=%PROJECT_ROOT%

REM Change to project root and execute build
cd /d "%PROJECT_ROOT%"
call "%NUKE_DIR%\build.cmd" --wrapper-script-dir="%WRAPPER_SCRIPT_DIR%" --root="%PROJECT_ROOT%" %*
Usage Examples

From Project Root:

# Using PowerShell wrapper
./build/nuke/scripts/build-with-root.ps1 BuildAll

# Using CMD wrapper  
./build/nuke/scripts/build-with-root.cmd BuildAll

From Any Directory:

# Explicit paths
./build-with-root.ps1 -NukeRoot "C:\my-project" -ConfigPath "C:\my-project\build\nuke\build-config.json" BuildAll

# Auto-detection (script automatically detects project root)
./build-with-root.ps1 BuildAll

Debug Wrapper Functionality:

./build-with-root.ps1 DebugWrapper
Path Resolution Priority

The component uses a 3-level priority system:

  1. Script Parameters (Highest Priority)

    • --wrapper-nuke-root=<path>
    • --wrapper-config-path=<path>
    • --wrapper-script-dir=<path>
  2. Environment Variables (Medium Priority)

    • WRAPPER_NUKE_ROOT
    • WRAPPER_CONFIG_PATH
    • WRAPPER_SCRIPT_DIR
  3. Auto-detection (Fallback)

    • Project root: 3 levels up from script directory
    • Config path: ../build-config.json relative to script directory
    • Assembly location-based discovery
Configuration Discovery

The component automatically discovers project-specific build-config.json files using:

  1. Explicit Config Path: Use WrapperConfigPath if provided and valid
  2. Script-based Discovery: Auto-detect from script directory location
  3. Assembly-based Search: Search up directory tree from build assembly location
  4. Smart Validation: Only accept configs containing ProjectConfigIdentifiers patterns
Benefits

Before (Project-specific Implementation):

  • ~200 lines of duplicated wrapper code per project
  • Manual parameter handling and path resolution
  • Inconsistent discovery logic across projects
  • Difficult to maintain and update

After (IWrapperPath Interface):

  • ~50 lines per project (just parameter declarations and interface implementation)
  • Centralized, tested wrapper functionality
  • Consistent behavior across all projects
  • Single location for improvements and bug fixes
Migration Guide

To migrate existing wrapper implementations to use IWrapperPath:

  1. Add Interface: Implement IWrapperPath in your build class
  2. Remove Duplicated Code: Delete local wrapper implementation methods
  3. Update Properties: Use interface properties (WrapperNukeRoot, WrapperConfigPath)
  4. Define Identifiers: If needed by downstream logic
  5. Test: Verify wrapper functionality with DebugWrapper target
Troubleshooting

Config Not Found:

  • Check ProjectConfigIdentifiers match your build-config.json content
  • Verify script directory structure (scripts should be 3 levels down from project root)
  • Use DebugWrapper target to see path resolution details

Environment Variables Not Working:

  • Ensure wrapper scripts set environment variables before calling NUKE
  • Check parameter priority - script parameters override environment variables
  • Verify working directory is set correctly in wrapper scripts

Build Failures:

  • Confirm .nuke directory exists in project root
  • Check that build-config.json exists and contains valid JSON
  • Verify project structure matches expected layout

Architecture Benefits

The IWrapperPath provides:

  • Code Reuse: Eliminates ~800 lines of duplicated wrapper code across 4 projects
  • Maintainability: Single source of truth for wrapper functionality
  • Consistency: Uniform behavior across all consuming projects
  • Location Independence: Execute builds from any directory without path issues
  • Smart Discovery: Automatic configuration file detection with validation
  • Cross-platform: Works with PowerShell, CMD, and bash wrapper scripts
Product Compatible and additional computed target framework versions.
.NET 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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (7)

Showing the top 5 NuGet packages that depend on GiantCroissant.Lunar.Build.Configuration:

Package Downloads
GiantCroissant.Lunar.Build.NuGet

NuGet packaging and repository management components for Nuke build system. Includes NuGet package building, repository management, and publishing workflows.

GiantCroissant.Lunar.Build.Mobile

Base mobile build components for iOS and Android development with shared interfaces and patterns

GiantCroissant.Lunar.Build.CodeQuality

Code quality and analysis components for Nuke build system. Includes Roslynator CLI integration, ReSharper CLI integration, and comprehensive code quality workflows.

GiantCroissant.Lunar.Build.Mobile.iOS

RFC021: iOS build component with comprehensive iOS build support including Xcode integration, code signing, TestFlight deployment, and Firebase App Distribution

GiantCroissant.Lunar.Build.Mobile.Android

RFC020: Android Build Integration - Comprehensive Android build support with Gradle, signing, and deployment capabilities

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.1-ci.90 40 9/8/2025
0.1.1-ci.40 88 9/6/2025
0.1.1-ci.21 148 9/4/2025
0.1.1-ci.20 130 9/3/2025
0.1.1-chore-ci-pack-mobile-... 27 9/4/2025

RFC029: Massive simplification - eliminated ComponentDiscoveryService, ComponentRegistry, and 15+ exception types. Replaced with clean NUKE-native interface composition.