Changeset 817


Ignore:
Timestamp:
Aug 2, 2012 6:44:26 PM (12 years ago)
Author:
Anya Helene Bagge
Message:

Builder: don't create C++ files for implementations or files with errors (this speeds up build process). Code for implementations can still be seen with 'show c++ code for module'.

Location:
branches/magnolia-eclipse-0.2.27/src/org/magnolialang
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/magnolia-eclipse-0.2.27/src/org/magnolialang/eclipse/builders/MagnoliaBuilder.java

    r691 r817  
    252252                                IConstructor info = ((IConstructor) compiler.getFact(rm, MagnoliaFacts.Type_DefInfo, name));
    253253                                String kind = ((IString) info.get("kind")).getValue();
    254                                 if(kind.equals("implementation") || kind.equals("library")) {
     254                                if(/* kind.equals("implementation") || */kind.equals("library")) {
    255255                                        toClean = buildOutput(manager, compiler, rm, name, toClean);
    256256                                }
     
    288288                if(result instanceof IString) {
    289289                        String code = ((IString) result).getValue();
    290                         if(prelude == null)
    291                                 loadPrelude();
    292                         code = prelude + "\n" + code;
    293                         String outname = Magnolia.yieldName(name).replaceAll("\\.", "/") + ".cxx";
    294                         IPath path = manager.getOutFolder().append(outname);
    295                         toClean = createFile(code, path, toClean);
     290                        if(!code.startsWith("//-")) {
     291                                if(prelude == null)
     292                                        loadPrelude();
     293                                code = prelude + "\n" + code;
     294                                String outname = Magnolia.yieldName(name).replaceAll("\\.", "/") + ".cxx";
     295                                IPath path = manager.getOutFolder().append(outname);
     296                                toClean = createFile(code, path, toClean);
     297                        }
    296298                }
    297299                return toClean;
  • branches/magnolia-eclipse-0.2.27/src/org/magnolialang/magnolia/backend/CxxBackend.rsc

    r796 r817  
    4242                        errors = getErrors(arg);
    4343                        str body = "";
     44                        bool hasCode = false;
    4445                        // library
    4546                        if(DeclBody(_) := tree) {
     
    5657                                                if(info.kind == "library")
    5758                                                        body = generateCommandInterface(tr, ds, info.qName, body);
     59                                                hasCode = true;
    5860                                                println("CxxCode cmdInterface: at <getMilliTime()-time> ms (for <nameToStr(astValue(key[1]))>)");
    5961                                        }
     
    7173                        println("CxxCode indentStr: <getMilliTime()-t2> ms (for <nameToStr(astValue(key[1]))>)");
    7274                        if(errors == {})
    73                                 setFact(tr, #CxxCode, key, CxxCode("// <info.kind>: <dispNameOf(info.qName)>\n<body>\n", errors));
     75                                setFact(tr, #CxxCode, key, CxxCode("//<hasCode ? " " : "-"> <info.kind>: <dispNameOf(info.qName)>\n<body>\n", errors));
    7476                        else
    75                                 setFact(tr, #CxxCode, key, CxxCode("// <info.kind>: <dispNameOf(info.qName)>\n// CODE DISABLED DUE TO COMPILATION ERRORS\n// <replaceAll(body, "\n", "\n// ")>\n", errors));
     77                                setFact(tr, #CxxCode, key, CxxCode("//- <info.kind>: <dispNameOf(info.qName)>\n// CODE DISABLED DUE TO COMPILATION ERRORS\n// <replaceAll(body, "\n", "\n// ")>\n", errors));
    7678                }
    7779                else {
Note: See TracChangeset for help on using the changeset viewer.