Mercurial > projects > doodle
diff builder.d @ 30:4a688da41f1a
Minor improvement to builder
author | Graham St Jack <graham.stjack@internode.on.net> |
---|---|
date | Sun, 09 Aug 2009 09:12:55 +0930 |
parents | 960b408d3ac5 |
children | 705817d8514a |
line wrap: on
line diff
--- a/builder.d Mon Aug 03 23:19:55 2009 +0930 +++ b/builder.d Sun Aug 09 09:12:55 2009 +0930 @@ -34,8 +34,9 @@ // // The directory structure employs a heirarchy of: // * Bundle - A collection of products. Has no source code of its own, and does not appear in package paths. -// Corresponds to the root of a checkout/repository. -// * Product - A directory to provide namespace. +// Corresponds to the root of a checkout/repository. The bundle is on the source search path. +// * Product - Top-level package, usually to provide namespace, but can also contain code +// just like lower-level packages. // * Package - A self-contained set of library code, executable code, docs, tests, etc. // Can contain nested packages, and can refer to other packages. // @@ -44,37 +45,35 @@ // // The directory structure within a bundle is: // -// +--README Introductory information -// +--configure.d D script to set up a build directory -// +--builder.d This file -// +--options Compiler options -// +--uses Specifies which other bundles to use, with paths relative to this bundle +// +--README Introductory information +// +--configure.d D script to set up a build directory +// +--builder.d This file +// +--options Compiler options +// +--uses Specifies which other bundles to use, with paths relative to this bundle // | -// +--product-name(s) Provides namespace - only contains packages +// +--package-name(s) A package, containing library source // | -// +--package-name(s) Can contain library code -// | -// +--doc Restructured-text documents and associated images -// | -// +--data Data files required by tests and binaries -// | -// +--test Code for regression tests -// | -// +--prog Code for binaries -// | -// +--package-name(s) Nested packages +// +--doc Restructured-text documents and associated images +// | +// +--data Data files required by tests and binaries +// | +// +--test Code for regression tests +// | +// +--prog Code for binaries +// | +// +--package-name(s) Nested packages // // The resultant build directory structure is: // -// +--build Script to build the system (put there by configure) +// +--build Script to build the system (put there by configure) // | -// +--obj Contains object files and libraries in package structure +// +--obj Contains object files and libraries in package structure // | -// +--test Contains test binaries and results in package structure +// +--test Contains test binaries and results in package structure // | -// +--bin Contains the binaries built from prog directories +// +--bin Contains the binaries built from prog directories // | -// +--doc Contains the package html docs, in package structure +// +--doc Contains the package html docs, in package structure // // The dependency rules are: // * A built file depends on its sources, and anything the sources explicitly import. @@ -436,12 +435,18 @@ class SourceItem : FileItem { SourceItem[string] mImports; // the source items this one imports + ObjectItem mObject; // the object item to be built from this source this(string path, GroupItem group) { super("source", path, group); if (!isfile(path)) error(format("source file %s not found", path)); } + // set the object item + void set_object(ObjectItem obj) { + mObject = obj; + } + // Add an import to this source item. // These are used later to determine all the non-structural item dependencies. void addImport(SourceItem source) { @@ -473,7 +478,7 @@ // Use our source's imports to add non-structural dependencies. // The rules are: - // * We depend on any sources our source imports, transitively. + // * We depend on any sources our source imports, and their objects, transitively. // * Our group depends on the imported source's group, and any of its // ancestral groups that aren't our ancestors. // * We must not trace a chain of imports back to our source. @@ -489,6 +494,7 @@ addDepends(s.mGroup); } addDepends(s); + addDepends(s.mObject); dependsOnImportsOf(s); } } @@ -738,6 +744,7 @@ string obj_path = join(Global.buildPath, "obj", mSlashName ~ ".o"); mSource = new SourceItem(path, group); mObject = new ObjectItem(obj_path, mSource, group); + mSource.set_object(mObject); //writefln("loaded Module %s from %s", mDotName, mSource.mPath); }