Skip to content
This repository has been archived by the owner on Mar 1, 2022. It is now read-only.

Commit

Permalink
add dub.rootPackageBuildSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
WebFreak001 committed Jul 22, 2020
1 parent 1a40330 commit b4f4d1c
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions source/workspaced/com/dub.d
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,15 @@ class DubComponent : ComponentWrapper
return _dub.project.configurations;
}

PackageBuildSettings rootPackageBuildSettings() @property
{
auto pkg = _dub.project.rootPackage;
BuildSettings settings = pkg.getBuildSettings(_platform, _configuration);
return PackageBuildSettings(settings,
pkg.path.toString,
pkg.name);
}

/// Lists all build types defined in the package description AND the predefined ones from dub ("plain", "debug", "release", "release-debug", "release-nobounds", "unittest", "docs", "ddox", "profile", "profile-gc", "cov", "unittest-cov")
string[] buildTypes() @property
{
Expand Down Expand Up @@ -609,6 +618,52 @@ struct BuildIssue
bool cont;
}

/// returned by rootPackageBuildSettings
struct PackageBuildSettings
{
/// construct from dub build settings
this(BuildSettings dubBuildSettings, string packagePath, string packageName)
{
foreach (i, ref val; this.tupleof)
{
enum name = __traits(identifier, this.tupleof[i]);
static if (__traits(hasMember, dubBuildSettings, name))
val = __traits(getMember, dubBuildSettings, name);
}
this.packagePath = packagePath;
this.packageName = packageName;
}

string packagePath;
string packageName;

string targetPath; /// same as dub BuildSettings
string targetName; /// same as dub BuildSettings
string workingDirectory; /// same as dub BuildSettings
string mainSourceFile; /// same as dub BuildSettings
string[] dflags; /// same as dub BuildSettings
string[] lflags; /// same as dub BuildSettings
string[] libs; /// same as dub BuildSettings
string[] linkerFiles; /// same as dub BuildSettings
string[] sourceFiles; /// same as dub BuildSettings
string[] copyFiles; /// same as dub BuildSettings
string[] extraDependencyFiles; /// same as dub BuildSettings
string[] versions; /// same as dub BuildSettings
string[] debugVersions; /// same as dub BuildSettings
string[] versionFilters; /// same as dub BuildSettings
string[] debugVersionFilters; /// same as dub BuildSettings
string[] importPaths; /// same as dub BuildSettings
string[] stringImportPaths; /// same as dub BuildSettings
string[] importFiles; /// same as dub BuildSettings
string[] stringImportFiles; /// same as dub BuildSettings
string[] preGenerateCommands; /// same as dub BuildSettings
string[] postGenerateCommands; /// same as dub BuildSettings
string[] preBuildCommands; /// same as dub BuildSettings
string[] postBuildCommands; /// same as dub BuildSettings
string[] preRunCommands; /// same as dub BuildSettings
string[] postRunCommands; /// same as dub BuildSettings
}

private:

T toOr(T)(string s, T defaultValue)
Expand Down

0 comments on commit b4f4d1c

Please sign in to comment.