module battery.license;
//! This is the license for the Battery.
enum license;
global licenseArray: string[];
fn __ctor() { }
module battery.testing.regular;
class Regular : Test
{
public:
//! Commands from the test file to execute.
runs: string[][];
//! Expected results of commands.
retvals: i32[];
//! Temporary file name for this test.
tempName: string;
//! Directory name.
srcDir: string;
//! Test file name.
srcFile: string;
//! Actual test file's name.
testFileName: string;
cmdGroup: CmdGroup;
btj: BatteryTestsJson;
public:
//! Construct a new Regular test. Params: srcDir: The directory that
//! contains the test. test: The name of the test. testFileName: The
//! filename of the primary test file. btj: The parsed battery.tests.json.
//! project: The Project for this test. cs: A Configuration containing the
//! tools and platform/arch information.
this(srcDir: string, test: string, testFileName: string, btj: BatteryTestsJson, project: TestProject, cs: Configuration) { }
fn parseCommand(line: string) bool { }
fn runTest(cmdGroup: CmdGroup) { }
fn getOutput() string { }
fn getError() string { }
}
class RequireExpression
{
public:
enum Type
{
None,
And,
Or,
}
public:
type: Type;
isNot: bool;
val: string;
next: RequireExpression;
err: string;
test: Regular;
public:
this(val: string, test: Regular) { }
fn nextToken(s: string) RequireExpression { }
//! Is this entire chain true or false?
fn evaluate(arch: Arch, platform: Platform, requiresAliases: string[string]) bool { }
//! Is the underlying condition true or false, ignore next and isNot.
fn evaluateProject(arch: Arch, platform: Platform, requiresAliases: string[string]) bool { }
}
module battery.testing.tester;
class Tester
{
public:
this(drv: Driver) { }
fn test(config: Configuration, hostConfig: Configuration, libs: Lib[], exes: Exe[], filter: string) { }
fn testMain(projects: TestProject[]) { }
fn getCommandFromExe(exe: Exe) Command { }
fn getVoltaCommand(testProj: Project) Command { }
}
module battery.testing.btj;
//! Parse the battery.tests.json.
class BatteryTestsJson
{
public:
patterns: string[];
prefix: string;
requiresAliases: string[string];
macros: immutable(char)[][][string];
//! How each command will start.
runPrefix: string;
retvalPrefix: string;
requiresPrefix: string;
hasPassedPrefix: string;
macroPrefix: string;
checkPrefix: string;
public:
this() { }
//! Get the commands associated with a macro, or an empty list.
fn getMacro(name: string) string[] { }
fn parse(jsonPath: string) { }
fn calculatePrefixes() { }
}
module battery.testing.output.xml;
fn writeXmlFile(ident: string, filename: string, tests: Test[]) { }
module battery.testing.output.stdio;
fn writeToStdio(tests: Test[], hasRegression: bool) { }
module battery.testing.test;
//! Test status
enum Result
{
//! Test failed, regressed, is expected to succeed.
FAIL,
//! Test failed, but is expected to fail.
XFAIL,
//! Test passed, improved, but is expected to fail.
XPASS,
//! Test passed, and that was expected.
PASS,
//! Test was skipped.
SKIPPED,
}
//! Base class for all types of tests.
class Test
{
public:
name: string;
msg: string;
project: TestProject;
result: Result;
public:
this() { }
fn runTest(CmdGroup);
fn getOutput() string;
fn getError() string;
}
module battery.testing.searcher;
//! Searches for tests cases.
class Searcher
{
public:
mTests: Test[];
mCommandStore: Configuration;
public:
this(cs: Configuration) { }
fn search(project: TestProject, dir: string) Test[] { }
}
module battery.testing.project;
class TestProject
{
public:
name: string;
paths: string[];
commands: Command[string];
public:
this(name: string, paths: string[]) { }
fn addCommand(id: string, command: Command) { }
fn getCommand(id: string) Command { }
}
//! Contians the per build configuration.
module battery.configuration;
public import battery.defines;
public import battery.commonInterfaces;
//! A build configuration for one or more builds.
class Configuration
{
public:
//! Used when launching commands.
env: Environment;
//! Is this, native, host or cross-compile?
kind: ConfigKind;
//! Architecture for this configuration.
arch: Arch;
//! Platform for this configuration.
platform: Platform;
//! Is the build release or debug.
isRelease: bool;
//! Link-time-optimizations, implemented via LLVM's ThinLTO.
isLTO: bool;
//! Should we generate vdoc json files.
shouldJSON: bool;
//! The llvmConf path, given by --llvmconf.
llvmConf: string;
//! The battery config file that might be loaded.
batConf: BatteryConfig;
//! LLVM version.
llvmVersion: semver.Release;
//! Base clang command.
clangCmd: Command;
//! Linker command.
linkerCmd: Command;
//! Linker command.
linkerKind: LinkerKind;
//! C-compiler.
ccCmd: Command;
//! C-compiler.
ccKind: CCKind;
//! NASM used for rt assembly files.
nasmCmd: Command;
//! Rdmd for bootstrapping.
rdmdCmd: Command;
//! Gdc for bootstrapping.
gdcCmd: Command;
//! All added tools.
tools: Command[string];
public:
this() { }
//! Get a tool that has been added.
fn getTool(name: string) Command { }
//! Adds a tool to this configuration, a given tool can only be added once.
fn addTool(name: string, cmd: string, args: string[]) Command { }
//! Helper properties.
fn isBootstrap() bool { }
//! Helper properties.
fn isNative() bool { }
//! Helper properties.
fn isCross() bool { }
}
//! Code for handling a small config file that declares information
//! regarding LLVM.
module battery.frontend.llvmConf;
//! Parse llvmConf-related command line arguments.
fn parseArguments(args: string[], llvmConf: string) { }
//! Holds to interact with github, like parsing a url.
module battery.frontend.github;
class Repo
{
public:
original: string;
org: string;
proj: string;
public:
this() { }
}
fn parseUrl(drv: Driver, url: string) Repo { }
//! Process TOML configuration files.
module battery.frontend.conf;
fn parseTomlConfig(tomlFilename: string, path: string, d: Driver, c: Configuration, b: Project) { }
//! Process battery configuration TOML files.
module battery.frontend.batteryConf;
enum BatteryConfName;
//! This parses the argument --conf from args.
fn parseArguments(drv: Driver, args: string[], conf: string) { }
fn loadFromFile(filename: string, batConf: BatteryConfig) bool { }
fn loadFromDir(path: string, batConf: BatteryConfig) bool { }
fn loadBatteryConf(state: State, batConf: BatteryConfig) bool { }
//! Holds the code for searching a directory and automatically creating a
//! project from that.
module battery.frontend.scanner;
enum PathRt;
enum PathSrc;
enum PathRes;
enum PathTest;
enum PathMainD;
enum PathMainVolt;
enum PathBatteryTxt;
enum PathBatteryToml;
enum PathTestJson;
enum PathTestSimple;
struct Scanner
{
public:
drv: Driver;
inputPath: string;
name: string;
hasSrc: bool;
hasRes: bool;
hasPath: bool;
hasTest: bool;
hasMainD: bool;
hasMainVolt: bool;
hasBatteryToml: bool;
path: string;
pathRt: string;
pathSrc: string;
pathRes: string;
pathTest: string;
pathMainD: string;
pathMainVolt: string;
pathBatteryToml: string;
pathDerivedBin: string;
pathSimpleTests: string[];
pathJsonTests: string[];
pathSubProjects: string[];
filesC: string[];
filesD: string[];
filesVolt: string[];
public:
fn scan(drv: Driver, inputPath: string) { }
fn getInPath(file: string) string { }
fn buildExe() Exe { }
fn buildLib() Lib { }
fn buildCommon(p: Project) { }
}
//! Scan a directory and see what it holds.
fn scanDir(drv: Driver, c: Configuration, onProject: scope (void delegate(Project)), path: string, parent: string) { }
fn rootify(root: string, path: string) string { }
fn printInfo(drv: Driver, lib: Lib, s: Scanner) { }
fn printInfo(drv: Driver, exe: Exe, s: Scanner) { }
fn printInfoCommon(drv: Driver, p: Project, s: Scanner) { }
fn processBatteryCmd(drv: Driver, c: Configuration, b: Project, s: Scanner) { }
fn deepScan(path: string, ending: string, omissions: string[]) string[] { }
//! Functions for retrieving and processing the LLVM version.
module battery.frontend.llvmVersion;
enum IdentifierPrefixLegacy;
enum IdentifierPrefix;
fn addVersionIdentifiers(ver: semver.Release, prj: battery.Project) bool { }
//! Given an LLVM version, return a list of identifiers to set while
//! compiling code.
fn identifiers(ver: semver.Release) string[] { }
//! Holds code for parsing command line options into Lib and Exe.
module battery.frontend.parameters;
//! Parser args and turns them into Libs and Exes.
class ArgParser
{
public:
mDrv: Driver;
mArgs: Arg[];
mPos: size_t;
public:
this(drv: Driver) { }
fn addExtraPkgs(pkgs: string[]) { }
fn parseConfig(args: string[]) { }
fn parseProjects(c: Configuration) { }
protected:
fn parseDefault(c: Configuration) { }
fn processBase(c: Configuration, base: Project) { }
fn parseLib(c: Configuration, lib: Lib) { }
fn parseExe(c: Configuration, exe: Exe) { }
fn verify(lib: Lib) { }
fn verify(exe: Exe) { }
fn handleCommand(c: Configuration, cmd: string) { }
}
struct ToArgs
{
public:
fn process(mDrv: Driver, mPath: string, args: string[]) Arg[] { }
}
fn parseTestArgs(drv: Driver, args: string[]) string { }
fn getArgs(arch: Arch, platform: Platform, isRelease: bool, isLTO: bool) string[] { }
fn getArgs(boot: bool, env: Environment) string[] { }
fn getArgs(boot: bool, cmds: Command[]) string[] { }
//! Turn Libs and Exes into command line arguments.
fn getArgs(libs: Lib[], exes: Exe[]) string[] { }
fn getArgsProject(b: Project, tag: string) string[] { }
fn getArgsLib(l: Lib) string[] { }
fn getArgsExe(e: Exe) string[] { }
fn parseArch(driver: Driver, a: string) Arch { }
fn parsePlatform(driver: Driver, p: string) Platform { }
fn findArchAndPlatform(driver: Driver, args: string[], arch: Arch, platform: Platform, isRelease: bool, isLTO: bool) { }
//! Lower priority setter function.
module battery.util.priority;
//! Only works on windows currently, just so battery doesn't nuke your
//! computer.
fn setLowPriority() { }
//! OS helpers.
module battery.util.system;
fn processorCount() u32 { }
fn getBuiltArch() string { }
fn getBuiltPlatform() string { }
fn getBuiltIdent() string { }
fn forceCoreCount(j: u32) { }
//! File helpers.
module battery.util.file;
fn getLinesFromFile(file: string, lines: string[]) bool { }
fn getTomlConfig(file: string, root: toml.Value) bool { }
fn getStringArray(array: toml.Value[]) string[] { }
fn outputConfig(filename: string, ver: string, genArgs: string[], batteryTxts: string[], cacheArgs: string[][]) { }
//! Main interfaces for code of battery.
module battery.commonInterfaces;
public import battery.defines;
//! A single project can either be a Lib or Exe.
class Project
{
public:
name: string;
batteryToml: string;
libs: string[];
libPaths: string[];
frameworks: string[];
frameworkPaths: string[];
deps: string[];
defs: string[];
stringPaths: string[];
xld: string[];
xcc: string[];
xlink: string[];
xlinker: string[];
srcDir: string;
srcC: string[];
srcS: string[];
srcObj: string[];
srcAsm: string[];
testFiles: string[];
//! Was this target given a -jo argument.
jsonOutput: string;
//! Should we ignore this project unless explicitly asked for
isExternal: bool;
//! For D projects.
scanForD: bool;
//! Hack to add LLVMVersionX versions.
llvmHack: bool;
warningsEnabled: bool;
public:
this() { }
}
//! The project is built as a library used by executables.
class Lib : Project
{
public:
isTheRT: bool;
public:
this() { }
}
//! The project is built as a executable.
class Exe : Project
{
public:
bin: string;
srcVolt: string[];
public:
this() { }
}
//! Interface to the main class that controles the entire process.
class Driver
{
public:
//! Helper alias
alias Fmt = watt.text.sink.SinkArg;
public:
arch: Arch;
platform: Platform;
public:
this() { }
//! Normalise a path, target must exsist.
fn normalisePath(path: string) string;
//! As the function name imples.
fn removeWorkingDirectoryPrefix(path: string) string;
//! Add a executable
fn add(exe: Exe);
//! Add a library
fn add(lib: Lib);
//! Add a enviromental variable.
fn addEnv(boot: bool, name: string, value: string);
//! Set a tool that has been found.
fn setCmd(boot: bool, name: string, c: Command);
//! Get a tool.
fn getCmd(boot: bool, name: string) Command;
//! Add a tool, will reset the tool if already given.
fn addCmd(boot: bool, name: string, cmd: string);
//! Add a argument for tool.
fn addCmdArg(boot: bool, name: string, arg: string);
//! Prints a action string.
fn action(fmt: scope (Fmt));
//! Prints a info string.
fn info(fmt: scope (Fmt));
//! Error encoutered, print error then abort operation.
fn abort(fmt: scope (Fmt));
}
//! Holds the default implementation of the Driver class.
module battery.driver;
//! Controls the flow of the program.
class DefaultDriver : Driver
{
public:
enum BatteryDirectory;
enum BatteryConfigFile;
enum VersionNumber;
enum VersionString;
public:
this(args: string[]) { }
fn process(args: string[]) { }
fn config(args: string[]) { }
fn configSanity() { }
fn build(buildArgs: string[]) { }
fn test(args: string[]) { }
fn help(args: string[]) { }
fn projectInit(args: string[]) { }
fn prompt(question: string) string { }
fn choice(question: string, options: string[]) string { }
fn printLogo() { }
fn printVersion() { }
fn printUsage() { }
fn printHelpUsage() { }
fn printBuildUsage() { }
fn printTestUsage() { }
fn printInitUsage() { }
fn printConfigUsage() { }
fn applyQuirks() { }
fn verifyConfig() { }
fn normalisePath(path: string) string { }
fn removeWorkingDirectoryPrefix(path: string) string { }
fn addEnv(boot: bool, name: string, value: string) { }
fn setCmd(boot: bool, name: string, c: Command) { }
fn addCmd(boot: bool, name: string, cmd: string) { }
fn addCmdArg(boot: bool, name: string, arg: string) { }
fn add(lib: Lib) { }
fn add(exe: Exe) { }
fn clearProjects() { }
fn action(fmt: scope (Fmt)) { }
fn info(fmt: scope (Fmt)) { }
fn abort(fmt: scope (Fmt)) { }
fn getCmd(boot: bool, name: string) Command { }
protected:
mLogFile: string;
mConfig: Configuration;
mHostConfig: Configuration;
mBootstrapConfig: Configuration;
mStore: Project[string];
mExe: Exe[];
mLib: Lib[];
mPwd: string;
mLLVMConf: string;
mConf: string;
mBootstrapCommands: Command[string];
mTargetCommands: Command[string];
mHostCommands: Command[string];
}
module battery.policy.tools;
enum VoltaName;
enum GdcName;
enum NasmName;
enum RdmdName;
enum CLName;
enum LinkName;
enum CCName;
enum LinkerName;
enum LLVMConfigName;
enum LLVMArName;
enum ClangName;
enum LDLLDName;
enum LLDLinkName;
enum WasmLLDName;
enum NasmCommand;
enum RdmdCommand;
enum GdcCommand;
enum CLCommand;
enum LinkCommand;
enum LLVMConfigCommand;
enum LLVMArCommand;
enum ClangCommand;
enum LDLLDCommand;
enum LLDLinkCommand;
enum WasmLLDCommand;
enum VoltaPrint;
enum NasmPrint;
enum RdmdPrint;
enum GdcPrint;
enum LinkPrint;
enum CLPrint;
enum LLVMConfigPrint;
enum LLVMArPrint;
enum ClangPrint;
enum LDLLDPrint;
enum LLDLinkPrint;
enum WasmLLDPrin;
enum HostRdmdPrint;
enum HostGdcPrint;
enum BootRdmdPrint;
enum BootGdcPrint;
fn infoCmd(drv: Driver, c: Configuration, cmd: Command, from: string) { }
fn getCmdPre(c: Configuration) string { }
module battery.policy.validate;
fn validateProjectNameOrAbort(drv: Driver, name: string) { }
fn validateProjectNameOrInform(drv: Driver, name: string) bool { }
fn validateProjectName(name: string) string { }
//! Companion module to battery.policy.cmd.
module battery.policy.arg;
//! Class for argument processing.
class Arg
{
public:
enum Kind
{
Directory,
Exe,
Lib,
Name,
Dep,
SrcDir,
TestFile,
Command,
WarningsEnabled,
Library,
LibraryPath,
Framework,
FrameworkPath,
StringPath,
IsTheRT,
ScanForD,
Identifier,
Output,
JSONOutput,
FileC,
FileD,
FileS,
FileObj,
FileAsm,
FileVolt,
ArgLD,
ArgCC,
ArgLink,
ArgLinker,
Env,
BootEnv,
HostEnv,
ToolCmd,
ToolArg,
BootToolCmd,
BootToolArg,
HostToolCmd,
HostToolArg,
}
public:
//! Always set, often the original param.
flag: string;
//! Extra option to the flag.
extra: string;
condArch: i32;
condPlatform: i32;
kind: Kind;
public:
this(kind: Kind, flag: string) { }
this(kind: Kind, flag: string, extra: string) { }
}
fn filterArgs(args: Arg[], arch: Arch, platform: Platform) { }
module battery.policy.host;
enum HostPlatform;
enum HostArch;
fn getProjectHostConfig(drv: Driver) Configuration { }
//! Logic for setting up configs.
module battery.policy.config;
enum UseAsLinker
{
NO,
YES,
}
struct VarsForMSVC
{
public:
//! Old INCLUDE env variable, if found.
oldInc: string;
//! Old LIB env variable, if found.
oldLib: string;
//! Old PATH env variable, if found.
oldPath: string;
//! Best guess which MSVC thing we are using.
msvcVer: msvc.VisualStudioVersion;
//! How was this MSVC found?
from: string;
//! The cl.exe for this specific MSVC version.
clCmd: string;
//! The link.exe for this specific MSVC version.
linkCmd: string;
//! Install directory for compiler and linker, from either
//! VCTOOLSINSTALLDIR or VCINSTALLDIR env.
dirVCInstall: string;
dirUCRT: string;
dirWinSDK: string;
numUCRT: string;
numWinSDK: string;
//! Include directories, derived from the above fields.
inc: string[];
//! Library directories, derived from the above fields.
lib: string[];
//! Extra path, for binaries.
path: string[];
public:
fn tPath(dir: string) { }
fn tInc(dir: string) { }
fn tLib(dir: string) { }
}
//! So we get the right prefix on logged messages.
global log: battery.util.log.Logger;
fn getProjectConfig(drv: Driver, arch: Arch, platform: Platform) Configuration { }
fn doConfig(drv: Driver, config: Configuration) { }
fn doEnv(drv: Driver, config: Configuration, outside: Environment) { }
fn logNeeded(need: llvm.Needed, config: Configuration) { }
fn fillInNeeded(need: llvm.Needed, config: Configuration) { }
fn logMissingNeeded(res: llvm.Result, cmd: string) { }
fn hasNeeded(res: llvm.Result, need: llvm.Needed) bool { }
fn pickLLVM(drv: Driver, config: Configuration, need: llvm.Needed, result: llvm.Result) bool { }
fn doToolChainLLVM(drv: Driver, config: Configuration, useLinker: UseAsLinker) { }
fn doToolChainNativeMSVC(drv: Driver, config: Configuration, outside: Environment) { }
fn doToolChainCrossMSVC(drv: Driver, config: Configuration, outside: Environment) { }
fn getMSVCInfo(vars: VarsForMSVC, drv: Driver, env: Environment) { }
fn fillInListsForMSVC(vars: VarsForMSVC) { }
fn diffVars(drv: Driver, l: VarsForMSVC, r: VarsForMSVC) { }
//! Used to compare INCLUDE and LIB env vars, badly deals with case
//! sensitivity.
fn compareOldAndNew(oldPath: string, newPath: string) bool { }
fn genAndCheckEnv(vars: VarsForMSVC, drv: Driver, inc: string, lib: string, path: string) { }
fn addCommonLinkerArgsMSVC(config: Configuration, linker: Command) { }
fn doGDC(drv: Driver, config: Configuration) bool { }
fn doRDMD(drv: Driver, config: Configuration) bool { }
fn doNASM(drv: Driver, config: Configuration) bool { }
fn doVolta(drv: Driver, config: Configuration) bool { }
fn fillInConfigCommands(drv: Driver, config: Configuration) { }
fn makeCommandFromPath(config: Configuration, cmd: string, name: string) Command { }
fn fillIfFound(drv: Driver, config: Configuration, name: string, cmd: string, args: string[]) { }
module battery.backend.command;
struct ArgsGenerator
{
public:
enum Kind
{
VoltaSrc,
VoltaLink,
VoltaBc,
VoltaAr,
ClangAssemble,
ClangLink,
LinkLink,
Dmd,
Gdc,
AnyLdLink,
AnyLink,
AnyVolta,
AnyClang,
}
public:
alias Callback = scope (string[] delegate(Project));
public:
config: Configuration;
libs: Lib[];
exes: Exe[];
store: Project[string];
voltaArgs: string[];
archStr: string;
platformStr: string;
buildDir: string;
//! The runtime.
rt: Lib;
public:
fn setup(config: Configuration, libs: Lib[], exes: Exe[]) { }
//! Generates a Volta command line to build a binary.
fn genVoltArgs(base: Project, kind: Kind, cb: scope (Callback)) string[] { }
fn shouldSourceInclude(b: Project) bool { }
//! Should when we are building generate json files.
fn shouldJSON(b: Project) string { }
fn genVolted() string { }
fn getFileOFromBC(name: string) string { }
fn genFileBC(name: string) string { }
fn genAsmO(name: string) string { }
fn genCO(name: string) string { }
fn genSO(name: string) string { }
fn genVoltO(name: string) string { }
fn genVoltA(name: string) string { }
fn genVoltBc(name: string) string { }
fn genVoltDep(name: string) string { }
fn genVoltJSON(name: string) string { }
}
module battery.backend.builder;
class Builder
{
public:
alias ArgsKind = ArgsGenerator.Kind;
public:
mDrv: Driver;
mega: uni.Target;
ins: uni.Instance;
voltaPrint: string;
voltaBin: uni.Target;
public:
this(drv: Driver) { }
fn build(config: Configuration, boot: Configuration, libs: Lib[], exes: Exe[], verbose: bool) { }
fn processProject(gen: ArgsGenerator, b: Project) Store { }
fn processLibrary(gen: ArgsGenerator, lib: Lib) Store { }
fn processExe(gen: ArgsGenerator, exe: Exe) Store { }
fn makeTargetVoltLibraryGeneric(gen: ArgsGenerator, lib: Lib, name: string, flags: ArgsKind) uni.Target { }
fn makeTargetVoltLibraryBc(gen: ArgsGenerator, lib: Lib) uni.Target { }
fn makeTargetVoltLibraryAr(gen: ArgsGenerator, lib: Lib) uni.Target { }
fn makeTargetVoltLibraryO(gen: ArgsGenerator, lib: Lib) uni.Target { }
fn makeTargetExeGeneric(gen: ArgsGenerator, exe: Exe, name: string, flags: ArgsKind) uni.Target { }
fn makeTargetExeBc(gen: ArgsGenerator, exe: Exe) uni.Target { }
fn makeTargetExeAr(gen: ArgsGenerator, exe: Exe) uni.Target { }
fn makeTargetExeO(gen: ArgsGenerator, exe: Exe) uni.Target { }
fn makeTargetExe(gen: ArgsGenerator, exe: Exe) uni.Target { }
fn makeTargetC(gen: ArgsGenerator, src: string) uni.Target { }
fn makeTargetS(gen: ArgsGenerator, src: string) uni.Target { }
fn makeTargetAsm(gen: ArgsGenerator, src: string) uni.Target { }
fn makeHelperBitcodeToObj(gen: ArgsGenerator, bc: uni.Target) uni.Target { }
fn makeTargetVolted(gen: ArgsGenerator, exe: Exe) uni.Target { }
protected:
//! Store of objects each Lib/Exe produces.
mStore: Store[string];
mGen: ArgsGenerator;
}
class Store
{
public:
bcs: uni.Target[];
objs: uni.Target[];
public:
this() { }
}
module main;
fn main(args: string[]) i32 { }
fn printLicense() { }
module battery.conf.cfg;
//! Evals a target string, throws core.Exception on errors.
fn eval(arch: Arch, platform: Platform, str: string, warning: scope (Sink)) bool { }
module battery.conf.platform;
//! Evaluate a platform key.
fn eval(platform: Platform, key: string) bool { }
//! Detect and find the nasm command.
module battery.detect.nasm;
//! Used as a argument when supplying a command on the command line.
struct FromArgs
{
public:
cmd: string;
args: string[];
}
//! The result of the dection, also holds any extra arguments to get NASM
//! to output in the correct format.
struct Result
{
public:
from: string;
cmd: string;
args: string[];
}
//! Detect and find the nasm command.
fn detectFromPath(path: string, results: Result[]) bool { }
fn detectFromBatConf(batConf: BatteryConfig, result: Result) bool { }
//! Detect nasm from arguments.
fn detectFromArgs(arg: FromArgs, result: Result) bool { }
//! Add extra arguments to the command, any given args are appended after
//! the extra arguments.
fn addArgs(from: Result, arch: Arch, platform: Platform, res: Result) { }
//! Detect and find the gdc command.
module battery.detect.gdc;
//! Used as a argument when supplying a command on the command line.
struct FromArgs
{
public:
cmd: string;
args: string[];
}
//! The result of the dection, also holds any extra arguments to get NASM
//! to output in the correct format.
struct Result
{
public:
ver: semver.Release;
from: string;
cmd: string;
args: string[];
}
//! Detect and find the nasm command.
fn detectFromPath(path: string, results: Result[]) bool { }
//! Detect gdc from arguments.
fn detectFromArgs(arg: FromArgs, result: Result) bool { }
//! Check the battery config for gdc.
fn detectFromBatConf(batConf: BatteryConfig, result: Result) bool { }
//! Add extra arguments to the command, any given args are appended after
//! the extra arguments.
fn addArgs(from: Result, arch: Arch, platform: Platform, res: Result) { }
//! Detect and find the volta command.
module battery.detect.volta;
//! Used as a argument when supplying a command on the command line.
struct FromArgs
{
public:
cmd: string;
args: string[];
}
//! The result of the dection, also holds any extra arguments to get volta
//! to output in the correct format.
struct Result
{
public:
from: string;
cmd: string;
args: string[];
}
//! Detect rdmd from arguments.
fn detectFromArgs(arg: FromArgs, result: Result) bool { }
//! Check the battery config for rdmd.
fn detectFromBatConf(batConf: BatteryConfig, result: Result) bool { }
//! Add extra arguments to the command, any given args are appended after
//! the extra arguments.
fn addArgs(from: Result, arch: Arch, platform: Platform, res: Result) { }
//! Code for handling a small config file that declares information
//! regarding LLVM.
module battery.detect.llvm.conf;
//! Given a path to a llvm.conf file, retrieve the contained values.
fn parse(confPath: string, ver: semver.Release, clangCmd: string) bool { }
//! Detect LLVM toolchains.
module battery.detect.llvm;
//! Which llvm commands that are needed.
struct Needed
{
public:
config: bool;
ar: bool;
clang: bool;
ld: bool;
link: bool;
wasm: bool;
}
//! Used as a argument when supplying a command on the command line.
struct FromArgs
{
public:
//! The llvm-config command.
configCmd: string;
//! The arguments for llvm-config.
configArgs: string[];
//! The llvm-ar command.
arCmd: string;
//! The arguments for llvm-ar.
arArgs: string[];
//! The clang command.
clangCmd: string;
//! The arguments for clang.
clangArgs: string[];
//! The ld.lld command.
ldCmd: string;
//! The arguments for ld.lld.
ldArgs: string[];
//! The lld-link command.
linkCmd: string;
//! The arguments for lld-link.
linkArgs: string[];
//! The wasm-ld command.
wasmCmd: string;
//! The arguments for wasm-ld.
wasmArgs: string[];
}
//! Results from the detection code.
struct Result
{
public:
//! From where is this result?
from: string;
//! LLVM Version.
ver: semver.Release;
//! The llvm-config command.
configCmd: string;
//! The arguments for llvm-config.
configArgs: string[];
//! The llvm-ar command.
arCmd: string;
//! The arguments for llvm-ar.
arArgs: string[];
//! The clang command.
clangCmd: string;
//! The arguments for clang.
clangArgs: string[];
//! The ld.lld command.
ldCmd: string;
//! The arguments for ld.lld.
ldArgs: string[];
//! The lld-link command.
linkCmd: string;
//! The arguments for lld-link.
linkArgs: string[];
//! The wasm-ld command.
wasmCmd: string;
//! The arguments for wasm-ld.
wasmArgs: string[];
}
//! Detect LLVM toolchains.
fn detectFrom(path: string, confPaths: string[], results: Result[]) bool { }
//! Detect llvm from arguments.
fn detectFromArgs(fromArgs: FromArgs, result: Result) bool { }
//! Check the battery config for gdc.
fn detectFromBatConf(batConf: BatteryConfig, result: Result) bool { }
//! Add extra arguments to the command, any given args are appended after
//! the extra arguments.
fn addArgs(from: Result, arch: Arch, platform: Platform, res: Result) { }
//! Shared logger for Visual Studio detection code.
module battery.detect.llvm.logging;
//! So we get the right prefix on logged messages.
global log: battery.util.log.Logger;
fn dump(res: Result, message: string) { }
//! Detect Visual Studio installations.
module battery.detect.msvc;
//! An enumeration of supported Visual Studio versions.
enum VisualStudioVersion
{
//! An unsupported Visual Studio version.
Unknown,
//! Visual Studio 2015 (AKA v14)
V2015,
//! Visual Studio 2017 (AKA v15)
V2017,
MaxVersion,
}
//! From environment.
struct FromEnv
{
public:
vcInstallDir: string;
vcToolsInstallDir: string;
universalCrtDir: string;
universalCrtVersion: string;
windowsSdkDir: string;
windowsSdkVersion: string;
}
//! Contains information on a particular Visual Studio installation.
struct Result
{
public:
//! The version of this installation.
ver: VisualStudioVersion;
//! How was this MSVC found?
from: string;
//! The installation path of VC.
vcInstallDir: string;
//! The path to the Windows SDK.
windowsSdkDir: string;
//! The Windows SDK version.
windowsSdkVersion: string;
//! The path to the Universal CRT.
universalCrtDir: string;
//! The Universal CRT version.
universalCrtVersion: string;
//! The cl.exe command.
clCmd: string;
//! The link.exe command.
linkCmd: string;
}
//! Return a simple string that corresponds with a VisualStudioVersion
fn visualStudioVersionToString(ver: VisualStudioVersion) string { }
//! Returns a list of supported Visual Studio installations.
fn detect(fromEnv: FromEnv, results: Result[]) bool { }
//! Helper code for Visual Studio detection.
module battery.detect.msvc.util;
fn addLinkAndCL(result: Result, extraPath: string) { }
//! Shared logger for Visual Studio detection code.
module battery.detect.msvc.logging;
//! So we get the right prefix on logged messages.
global log: battery.util.log.Logger;
fn dump(result: Result, message: string) { }
//! Detect LLVM toolchains.
module battery.detect.msvc.vswhere;
//! Detect Visual Studio installations.
module battery.detect.msvc.windows;
//! Detect and find the rdmd command.
module battery.detect.rdmd;
//! Used as a argument when supplying a command on the command line.
struct FromArgs
{
public:
cmd: string;
args: string[];
}
//! The result of the dection, also holds any extra arguments to get rdmd
//! to output in the correct format.
struct Result
{
public:
from: string;
cmd: string;
args: string[];
}
//! Detect rdmd from the given path.
fn detectFromPath(path: string, results: Result[]) bool { }
//! Detect rdmd from arguments.
fn detectFromArgs(arg: FromArgs, result: Result) bool { }
//! Check the battery config for rdmd.
fn detectFromBatConf(batConf: BatteryConfig, result: Result) bool { }
//! Add extra arguments to the command, any given args are appended after
//! the extra arguments.
fn addArgs(from: Result, arch: Arch, platform: Platform, res: Result) { }
//! Common parsing functions.
module battery.util.parsing;
fn isArch(s: string) bool { }
fn stringToArch(s: string) Arch { }
fn isPlatform(s: string) bool { }
fn stringToPlatform(s: string) Platform { }
//! Comming printing functions.
module battery.util.printing;
fn archToString(arch: Arch) string { }
fn platformToString(platform: Platform) string { }
//! Somewhat simple logging core.
module battery.util.log;
alias Sink = void delegate(scope (watt.SinkArg));
//! Super simple logger.
struct Logger
{
public:
fn info(str: scope (watt.SinkArg)) { }
}
//! Opens a new OutputFileStream for logging and sets it as the active
//! logging file.
fn newLog(filename: string) { }
//! Set the active logging file.
fn setLog(stream: watt.OutputStream) { }
//! Path helpers.
module battery.util.path;
fn cleanPath(s: string) string { }
fn searchPath(path: string, cmd: string) string { }
fn checkArgCmd(log: Logger, cmd: string, name: string) bool { }
//! Common enums and classes, aka "defines".
module battery.defines;
//! Each of these listed platforms corresponds to a Version identifier.
enum Platform
{
//! Windows and MSVC compatible.
MSVC,
//! Linux.
Linux,
//! Apple OSX
OSX,
//! Bare Metal
Metal,
}
//! Each of these listed architectures corresponds to a Version
//! identifier.
enum Arch
{
//! X86 32 Bit
X86,
//! X86 64 Bit aka AMD64.
X86_64,
//! armv7-a, ARMHF.
ARMHF,
//! AArch64, ARM64.
AArch64,
}
//! What kind of linker is being used, selects arguments.
enum LinkerKind
{
//! Internal error state.
Invalid,
//! MSVC
Link,
//! LLVM Clang
Clang,
}
//! What kind of C-compiler is being used, selects arguments.
enum CCKind
{
//! Internal error state.
Invalid,
//! LLVM Clang
Clang,
}
//! Tracking if a configuration is native, host or cross-compile.
enum ConfigKind
{
//! Internal error state.
Invalid,
//! For boostraping the volted binary.
Bootstrap,
//! Target is the same as the host system.
Native,
//! For cross-compile, this config is the host system.
Host,
//! For cross-compile, this is the target config.
Cross,
}
//! Represents a single command that can be launched.
class Command
{
public:
//! Textual name.
name: string;
//! Name and path.
cmd: string;
//! Extra args to give when invoking.
args: string[];
//! Name to print.
print: string;
public:
this() { }
this(cmd: string, args: string[]) { }
this(name: string, c: Command) { }
}
//! A struct holding information from a battery.conf.toml file.
struct BatteryConfig
{
public:
filename: string;
voltaCmd: string;
nasmCmd: string;
gdcCmd: string;
rdmdCmd: string;
pkgs: string[];
llvmConfigCmd: string;
llvmArCmd: string;
llvmClangCmd: string;
llvmLinkCmd: string;
llvmWasmCmd: string;
llvmC: string;
}
//! Here is the main solver algorithm implementation used as a backend for
//! all builds. Uses build.util.cmd to dispatch compilers and other tasks.
module build.core.solver;
//! Builds a target, will throw exceptions on build failure.
fn doBuild(t: Target, numJobs: u32, env: Environment, verbose: bool) { }
//! Main package for the build system for Battery.
module build.core;
public import build.core.solver;
public import build.core.target;
//! The basic building blocks for a build.
module build.core.target;
//! Holds all inspected files/targets for a build. The caching supplied by
//! this class helps with both speed and ease of use.
class Instance
{
public:
this() { }
fn file(name: string) Target { }
fn fileNoRule(name: string) Target { }
}
//! Most basic building block, represent a single file on the file system.
//! Can be used as a dependency and as a target to be built.
class Target
{
public:
enum Status
{
FRESH,
CHECKED,
BLOCKED,
BUILDING,
BUILT,
}
public:
alias FRESH = Status.FRESH;
alias CHECKED = Status.CHECKED;
alias BLOCKED = Status.BLOCKED;
alias BUILDING = Status.BUILDING;
alias BUILT = Status.BUILT;
public:
//! What is the status of this target.Used to skip updating the date.
status: Status;
//! Name, for file also actuall filename.
name: string;
//! Rule to build this targe.
rule: Rule;
//! Will be built, but if no rule and missing will be ignored.
deps: Target[];
//! Cached last modified time.
mod: u64;
public:
this() { }
//! Updates the @mod field to the files last modified time.
fn updateTime() { }
fn built() { }
}
//! Rule to be executed. Can be shared for multiple targets.
class Rule
{
public:
//! To run be executed.
cmd: string;
//! To be given to cmd.
args: string[];
//! Echoed to stdout.
print: string;
//! Files needed directly to run this rule.
input: Target[];
//! When the rule is running these targets will be locked.
outputs: Target[];
public:
this() { }
fn built(retval: i32) { }
}
//! Functions for parsing Make compatible dependancy files.
module build.util.make;
fn importDepFile(ins: Instance, file: scope (SinkArg)) { }
fn parseDeps(ins: Instance, filename: scope (SinkArg), text: scope (SinkArg)) { }
//! Code for launching multiple processes and keeping track of them.
module build.util.cmdgroup;
//! Helper class to launch one or more processes to run along side the main
//! process.
class CmdGroup
{
public:
alias DoneDg = void delegate(i32);
public:
this(env: Environment, maxWaiting: u32) { }
fn run(cmd: string, args: string[], dgt: DoneDg, log: FILE*) { }
fn run(cmd: string, args: string[], dgt: DoneDg, outLog: FILE*, errLog: FILE*) { }
fn waitOne() { }
fn waitAll() { }
}
//! Exception form and when execquting commands.
class CmdException : Exception
{
public:
this(cmd: string, reason: string) { }
this(cmd: string, args: string[], reason: string) { }
this(cmd: string, result: i32) { }
this(cmd: string, args: string[], result: i32) { }
}
//! Function for manipulating files and paths.
module build.util.file;
fn modifiedMoreRecentlyThan(a: string, b: string) bool { }
fn getTimes(name: string, access: u64, modified: u64) { }
//! Replaces @oldPrefix and @oldSuffix with @newPrefix and @newSuffix.
fn replacePrefixAndSuffix(name: string, oldPrefix: string, newPrefix: string, oldSuffix: string, newSuffix: string) string { }