Changeset 228:31b43bd7e7c3 in make_builder


Ignore:
Timestamp:
31.08.2010 14:53:07 (9 years ago)
Author:
Max Reichardt <reichardt@…>
Branch:
default
Phase:
public
Convert:
svn:d8b181b9-5805-4a7f-8f90-6c1c75747850/trunk@234
Message:

Improved error messages for targets that cannot be built.

Location:
src/makebuilder
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/makebuilder/BuildEntity.java

    r215 r228  
    123123            if (be.missingDep) { 
    124124                missingDep = true; 
    125                 mfb.printErrorLine("Not building " + name + " due to dependency " + be.name + " which cannot be built"); 
     125                mfb.printCannotBuildError(this, " due to dependency " + be.name + "(" + be.buildFile.relative + ") which cannot be built"); 
    126126                return; 
    127127            } 
     
    257257        if (!optional) { 
    258258            missingDep = true; 
    259             builder.printErrorLine("Not building " + name + " due to missing dependency " + dep); 
     259            builder.printCannotBuildError(this, " due to missing dependency " + dep); 
    260260        } 
    261261    } 
  • src/makebuilder/MakeFileBuilder.java

    r213 r228  
    302302    } 
    303303 
     304    /** 
     305     * Print error line which says that target cannot be built 
     306     * 
     307     * @param be Entity that cannot be built 
     308     * @param string Error string 
     309     */ 
     310    public void printCannotBuildError(BuildEntity be, String string) { 
     311        printErrorLine("Cannot build " + be.toString() + " (" + be.buildFile + ")" + string); 
     312    } 
     313 
     314 
    304315    /** Print advice if an error occured */ 
    305316    public static void printErrorAdvice() { 
  • src/makebuilder/handler/MakeXMLLoader.java

    r209 r228  
    132132                // Source files are a little more complicated 
    133133                for (String s : asStringList(params.get("sources"))) { 
    134                     be.sources.addAll(new FileSet(file.dir, s, scanner).files); 
     134                    be.sources.addAll(new FileSet(be, file.dir, s, scanner).files); 
    135135                } 
    136136                for (String s : asStringList(params.get("exclude"))) { 
    137                     be.sources.removeAll(new FileSet(file.dir, s, scanner).files); 
     137                    be.sources.removeAll(new FileSet(be, file.dir, s, scanner).files); 
    138138                } 
    139139            } 
     
    181181 
    182182        /** 
     183         * @param be BuildEntity files will be added to 
    183184         * @param dir Directory to search in 
    184185         * @param pattern Pattern (* means anything except of / - ** means anything - similar as in Apache Ant) 
    185186         */ 
    186         private FileSet(SrcDir dir, String pattern, SourceScanner sources) { 
     187        private FileSet(BuildEntity be, SrcDir dir, String pattern, SourceScanner sources) { 
    187188 
    188189            // no-wildcard optimization 
     
    192193                    files.add(sf); 
    193194                } else { 
    194                     System.out.println("warning: " + dir + "/" + pattern + " not found"); 
     195                    be.missingDep = true; 
     196                    sources.builder.printCannotBuildError(be, ": " + dir + "/" + pattern + " not found"); 
    195197                } 
    196198                return; 
     
    209211                } 
    210212            } 
     213 
     214            if (files.isEmpty()) { 
     215                be.missingDep = true; 
     216                sources.builder.printCannotBuildError(be, ": Pattern '" + pattern + "': no files found"); 
     217            } 
    211218        } 
    212219    } 
Note: See TracChangeset for help on using the changeset viewer.