How gematik/openhealth-requirements works
Project type and purpose
• This is a modular Kotlin/Gradle project providing a requirement‑extraction engine (core), exposed both as a standalone CLI tool and as a Gradle plugin.
• Purpose: scan source files for structured “REQ‑BEGIN/REQ‑END” annotations and produce a CSV of requirement IDs, specs, descriptions, file paths, and line ranges.
File structure
• Top‑level Gradle multi‑module build (settings.gradle.kts, build.gradle.kts, gradle.properties).
• core module: houses the extraction logic (RequirementExtractor, RequirementMapper) and its tests.
• cli module: implements a Main.kt that invokes the core extractor via command‑line options.
• gradle-plugin module: registers a Gradle plugin (RequirementExtractorPlugin) that delegates to core when the extractRequirements task runs.
• Common config files: GitHub Actions workflow, Gradle wrapper, versions TOML.
README for additional insights
• Confirms dual‑mode availability (CLI vs plugin).
• Describes input parameters (--base-path, --comment-prefix, etc.) and output CSV format.
a. Main components
• User Interfaces
• CLI Executable (cli.jar with Main.kt)
• Gradle Plugin (de.gematik.openhealth.requirements task)
• Core Extraction Engine (RequirementExtractor, RequirementMapper in core module)
• File System (source code files scanned, output CSV)
• Build System (Gradle, plugin registry, plugin classpath)
b. Relationships & interactions
• User → CLI/Gradle Plugin (invocation)
• CLI/Plugin → Core Engine (API call)
• Core Engine → File System (reads source files, writes CSV)
• Gradle Plugin → Gradle API (task registration & execution)
c. Architectural patterns & design principles
• Modular layering:
• Presentation layer: CLI and Plugin modules
• Business logic layer: Core module
• Plugin architecture: Gradle plugin uses Gradle’s plugin API to hook into the build lifecycle.
• Separation of concerns: extraction logic is independent of how it’s invoked.
d. Key technologies & libraries
• Kotlin/JVM
• Gradle Kotlin DSL for build scripts
• Gradle Plugin API
• Standard file I/O and CSV generation
• JUnit/Kotlin test framework for core tests