Skip to content

Consistent, modern Delphi coding standards. Includes a curated .gitignore and a bilingual style guide (EN/DE).

License

Notifications You must be signed in to change notification settings

omonien/DelphiStandards

Repository files navigation

Delphi Standards

Lang-EN Lang-DE

Contributions in German or English are welcome. Language synchronization is handled by the maintainer no later than post-merge.

Overview

This repository provides a compact, battle-tested baseline for consistent Delphi code. It focuses on:

  • A clear, modern Delphi Style Guide (German and English)
  • A curated .gitignore tailored for Delphi
  • A Git Attributes template for EOL normalization and binary protection

Both help teams write consistent code and avoid common friction.

Why this matters

Teams frequently commit files that should not be versioned (IDE artifacts, build outputs, local settings). This leads to:

  • unnecessary diffs and merge conflicts
  • unstable builds due to local artifacts
  • unwanted side effects across the team

The curated, Delphi-specific .gitignore prevents exactly that. The Style Guide, in parallel, provides a shared understanding of structure, naming, and modern language features. Additionally, .gitattributes prevents false diffs due to line-ending mismatches (CRLF vs LF) and protects binary artifacts from accidental text filters/diff. See the contents section for details.

Beyond team settings, a consistent Style Guide also benefits solo developers over the long run. This guide follows proven, classic patterns seen in Delphi's RTL/VCL/FMX code, yet it is certainly opinionated. The most important thing is to agree on a style and apply it consistently across the codebase—consistency beats “perfect.”

Contents

Note: The style guide is maintained in German and English. Please keep both documents in sync (maintainer will handle synchronization post-merge if needed).

Quick Start

  1. Agree on the style guide in your team
  • Indentation: 2 spaces; line length: 120 chars (keep formatter/editor guideline in sync)
  • Naming conventions (A-/L-/F‑prefixes, components, constants, enums with SCOPEDENUMS)
  • Modern features: generics, anonymous methods, inline variables (10.3+), multiline strings (12+)
  1. Enable .gitignore
  • Copy "Delphi GitIgnore.txt" to the repo root and rename it to ".gitignore"
  • Add project-specific rules as needed
  1. Add Git Attributes
  • Copy "Delphi GitAttributes.txt" to the repo root and rename it to ".gitattributes".
  • It normalizes EOLs for Delphi sources (CRLF) and marks binary artifacts (.res, .ico, .dcu, .bpl, .dll, .exe) as binary.
  • If your project stores .dfm/.fmx as text (default), keep the text rules. If stored as binary, switch to the binary rules in the template.
  • For existing repos, after adding run: git add --renormalize . and commit the changes.

Build Automation

Universal DPROJ Build Script

The repository includes a universal PowerShell script for building Delphi projects from the command line. This is ideal for CI/CD pipelines, automated builds, or any scenario where you need to build Delphi projects without the IDE.

Features:

  • Auto-detects the latest installed Delphi version from Windows Registry
  • Supports all Delphi project files (.dproj)
  • Configurable build configuration (Debug/Release) and platform (Win32/Win64)
  • Colored console output for better readability
  • Verbose mode for detailed build information
  • No dependencies on specific projects - works with any Delphi project

Usage:

# Basic usage (auto-detects Delphi version, builds Debug/Win32)
.\DelphiBuildDPROJ.ps1 -ProjectFile "MyProject.dproj"

# Build Release for Win64
.\DelphiBuildDPROJ.ps1 -ProjectFile "MyProject.dproj" -Config Release -Platform Win64

# Use specific Delphi version with verbose output
.\DelphiBuildDPROJ.ps1 -ProjectFile "MyProject.dproj" -DelphiVersion "22.0" -VerboseOutput

Parameters:

  • -ProjectFile (required): Path to the .dproj file to build
  • -Config: Build configuration (default: "Debug")
  • -Platform: Target platform (default: "Win32")
  • -DelphiVersion: Delphi version to use (default: auto-detect latest)
  • -VerboseOutput: Enable verbose MSBuild output

Requirements:

  • Embarcadero Delphi installed
  • MSBuild available (Visual Studio Build Tools or full Visual Studio)

For more details, see the script documentation in DelphiBuildDPROJ.ps1.

Releases

Official releases are available in the release-assets/ directory. Each release includes:

  • PDF versions of the style guides (German and English)
  • Git templates (.gitignore and .gitattributes)
  • Documentation

For creating new releases, see release-tools/README.md.

Contributing

  • Issues and PRs are welcome
  • Single-language PRs (DE or EN) are fine; maintainer will sync the other language after merge

Ideas

  • Provide configuration templates for code formatters to implement this style guide (e.g., 2-space indentation, 120-char line length, synchronized vertical guideline)...
  • Shared project presets (.dproj) or IDE settings for teams

License

MIT License – see notices in the files

About

Consistent, modern Delphi coding standards. Includes a curated .gitignore and a bilingual style guide (EN/DE).

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published