changeset 93:069ceb9446ad

Fixes to builder for dmd 2.0.48 and rejigged options file slightly.
author "David Bryant <bagnose@gmail.com>"
date Thu, 26 Aug 2010 00:11:21 +0930
parents a98116479793
children deb9d9fae854
files builder.d options.template
diffstat 2 files changed, 11 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/builder.d	Fri Aug 20 18:34:32 2010 +0930
+++ b/builder.d	Thu Aug 26 00:11:21 2010 +0930
@@ -155,7 +155,7 @@
         std.format.doFormat(&put, _arguments, _argptr);
     } 
 
-    // return a copy of the internal buffer
+    // return an immutable copy of the internal buffer
     string str() {
         return buffer[0..pos].idup;
     }
@@ -184,15 +184,15 @@
     // A less-than-perfect parser is ok because it only has to work for code
     // within the project, so we can write code that it works for.
     // 
-    void parseForImport(string line) {
+    void parseForImport(char[] line) {
         static string[] leaders = ["private ", "public ", "static ", "import "];
         bool found;
-        string stripped = stripl(line);
+        auto stripped = stripl(line);
         if (stripped.length > 8) {
             foreach (i, leader ; leaders) {
                 if (stripped[0..leader.length] == leader) {
                     // this is a possibility - look for import token
-                    scope string[] tokens = split(stripped);
+                    scope char[][] tokens = split(stripped);
                     if (tokens.length > 1) {
                         if (i == 3) {
                             found = true;
@@ -220,7 +220,7 @@
 
     scope file = new BufferedFile(path);
     foreach (char[] line; file) {
-        parseForImport(line.idup);
+        parseForImport(line);
     }
     //writefln("imports of %s are %s", file, result);
     return result;
@@ -325,7 +325,7 @@
 
         // this directory depends on its parent directory chain
         string parent_path = path.dirname;
-        if (parent_path.length > 0 && parent_path[0] != '.' ) {
+        if (parent_path.length > 0 && parent_path[0] != '.' && parent_path != "/") {
             Item* parent = parent_path in mItems;
             if (parent) {
                 assert(cast(DirectoryItem *)parent);
@@ -513,7 +513,7 @@
 
         cmd.format("dmd -c");
         foreach (path; Global.bundlePaths) {
-            cmd.format(" -I", path);
+            cmd.format(" -I%s", path);
         }
         cmd.format(" -od%s %s", dirname(mPath), mSource.mPath);
         cmd.format(" @%s", Global.optionsPath);
@@ -639,7 +639,7 @@
             mPath.remove();
         }
         scope cmd = new StringFormatter();
-        scope tmpPath = (mPath ~ ".failed").idup;
+        scope tmpPath = mPath ~ ".failed";
         cmd.format("%s > %s 2>&1", mProgram.mPath, tmpPath);
 
         if (std.process.system(cmd.str)) {
@@ -760,7 +760,7 @@
         // add an import dependancy (if it is inside our project)
         void imports(string importing) {
             string[] chain = split(importing, ".");
-            assert(chain.length > 0);
+            assert(chain.length > 0, format("source '%s' importing: '%s'", mSource, importing));
 
             // only depend on internal products
             if (!(chain[0] in Global.products)) {
@@ -944,10 +944,6 @@
     void load(string path) {
         //writefln("loading bundle from %s", path);
 
-        if (path == "What?/excre") {      //
-            return;
-        }
-
         // add path to Global for use when compiling
         Global.bundlePaths ~= path;
         Global.optionsPath = path.join("options");
@@ -1042,7 +1038,7 @@
         scope project = new Project(sourcePath);
     }
     catch (Exception e) {
-        writeln("Error, bailing");
+        writeln("Error, bailing out.");
         return 1;
     }
 
--- a/options.template	Fri Aug 20 18:34:32 2010 +0930
+++ b/options.template	Thu Aug 26 00:11:21 2010 +0930
@@ -1,6 +1,5 @@
 -I~/source/d/dmd/include/d
 -L-lgtkd
 -L-ldl
--w
 -wi
--g
+-gc