Skip to content

Commit

Permalink
Forward to the runtime implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
atilaneves committed Jun 20, 2024
1 parent 07c9acf commit a46c6f6
Showing 1 changed file with 1 addition and 52 deletions.
53 changes: 1 addition & 52 deletions payload/reggae/rules/dub/external.d
Original file line number Diff line number Diff line change
Expand Up @@ -50,58 +50,8 @@ imported!"reggae.build".Target dubDependant(
)
()
{
import reggae.rules.dub: oneOptionalOf, isOfType;
import reggae.rules.d: dlink;
import reggae.rules.common: objectFiles;
import reggae.types: TargetName, CompilerFlags, LinkerFlags, ImportPaths, StringImportPaths;
import reggae.config: reggaeOptions = options; // the ones used to run reggae
import std.meta: Filter;
import std.algorithm: map, joiner;
import std.array: array;
import std.range: chain;

alias DubPaths = Filter!(isOfType!DubPath, A);
static assert(DubPaths.length > 0, "At least one `DubPath` needed");

enum compilerFlags = oneOptionalOf!(CompilerFlags, A);
enum linkerFlags = oneOptionalOf!(LinkerFlags, A);
enum importPaths = oneOptionalOf!(ImportPaths, A);
enum stringImportPaths = oneOptionalOf!(StringImportPaths, A);

auto dubPathDependencies = [DubPaths]
.map!(p => DubPathDependency(reggaeOptions, p))
.array
;

auto allImportPaths = dubPathDependencies
.map!(d => d.dubInfo.packages.map!(p => p.importPaths).joiner)
.joiner
.chain(importPaths.value)
;

auto allStringImportPaths = dubPathDependencies
.map!(d => d.dubInfo.packages.map!(p => p.stringImportPaths).joiner)
.joiner
.chain(stringImportPaths.value)
;

auto objs = objectFiles!sourcesFunc(
compilerFlags,
const ImportPaths(allImportPaths),
const StringImportPaths(allStringImportPaths),
);

auto dubDepsObjs = dubPathDependencies
.map!(d => d.target)
.array
;

const targetNameWithExt = withExtension(targetName, targetType);
return dlink(
TargetName(targetNameWithExt),
objs ~ dubDepsObjs,
linkerFlags,
);
return dubDependant!sourcesFunc(reggaeOptions, targetName, targetType, A);
}

// mostly runtime version
Expand All @@ -120,7 +70,6 @@ imported!"reggae.build".Target dubDependant
auto ref A args,
)
{
//import reggae.rules.dub: oneOptionalOf, isOfType;
import reggae.rules.common: objectFiles;
import reggae.rules.d: dlink;
import reggae.types: TargetName, CompilerFlags, LinkerFlags, ImportPaths, StringImportPaths;
Expand Down

0 comments on commit a46c6f6

Please sign in to comment.