diff --git a/source/dub/compilers/compiler.d b/source/dub/compilers/compiler.d index 38b949f..8565a5b 100644 --- a/source/dub/compilers/compiler.d +++ b/source/dub/compilers/compiler.d @@ -92,8 +92,16 @@ interface Compiler { + /// Returns the canonical name of the compiler (e.g. "dmd"). @property string name() const; + /** Determines the build platform properties given a set of build settings. + + This will invoke the compiler to build a platform probe file, which + determines the target build platform's properties during compile-time. + + See_Also: `dub.compilers.utils.generatePlatformProbeFile` + */ BuildPlatform determinePlatform(ref BuildSettings settings, string compiler_binary, string arch_override = null); /// Replaces high level fields with low level fields and converts @@ -115,6 +123,11 @@ /// Convert linker flags to compiler format string[] lflagsToDFlags(in string[] lflags) const; + /** Runs a tool and provides common boilerplate code. + + This method should be used by `Compiler` implementations to invoke the + compiler or linker binary. + */ protected final void invokeTool(string[] args, void delegate(int, string) output_callback) { import std.string; diff --git a/source/dub/compilers/utils.d b/source/dub/compilers/utils.d index 0147e4c..8fda118 100644 --- a/source/dub/compilers/utils.d +++ b/source/dub/compilers/utils.d @@ -14,6 +14,13 @@ import std.algorithm : canFind; +/** + Given a set of build settings and a target platform, determines the target + binary file name. + + The returned string contains the file name, as well as the platform + specific file extension. The directory is not included. +*/ string getTargetFileName(in BuildSettings settings, in BuildPlatform platform) { assert(settings.targetName.length > 0, "No target name set."); @@ -44,6 +51,8 @@ /** Alters the build options to comply with the specified build requirements. + + And enabled options that do not comply will get disabled. */ void enforceBuildRequirements(ref BuildSettings settings) { @@ -60,6 +69,12 @@ } +/** + Determines if a specific file name has the extension of a linker file. + + Linker files include static/dynamic libraries, resource files, object files + and DLL definition files. +*/ bool isLinkerFile(string f) { import std.path; @@ -238,7 +253,11 @@ } -/// Generate a file that will give, at compile time, informations about the compiler (architecture, frontend version...) +/** + Generate a file that will give, at compile time, informations about the compiler (architecture, frontend version...) + + See_Also: `readPlatformProbe` +*/ Path generatePlatformProbeFile() { import dub.internal.vibecompat.core.file; @@ -353,6 +372,11 @@ return path; } +/** + Processes the output generated by compiling the platform probe file. + + See_Also: `generatePlatformProbeFile`. +*/ BuildPlatform readPlatformProbe(string output) { import std.algorithm : map;