1 | /** This */ | | 1 | /** |
2 | private String[] getCompileOptionsAsArray() { | | 2 | * Scan for files which match at least one include pattern and don't match |
3 | Vector options = new Vector(); | | 3 | * any exclude patterns. If there are selectors then the files must pass |
4 | | | 4 | * muster there, as well. Scans under basedir, if set; otherwise the |
5 | options.addElement(binary ? "-binary" : "-nobinary"); | | 5 | * include patterns without leading wildcards specify the absolute paths of |
6 | options.addElement(comments ? "-comments" : "-nocomments"); | | 6 | * the files that may be included. |
7 | options.addElement(compile ? "-compile" : "-nocompile"); | | 7 | * |
8 | options.addElement(compact ? "-compact" : "-nocompact"); | | 8 | * @exception IllegalStateException if the base directory was set |
9 | options.addElement(console ? "-console" : "-noconsole"); | | 9 | * incorrectly (i.e. if it doesn't exist or isn't a directory). |
10 | options.addElement(crossref ? "-crossref" : "-nocrossref"); | | 10 | */ |
11 | options.addElement(decimal ? "-decimal" : "-nodecimal"); | | 11 | public void scan() throws IllegalStateException { |
12 | options.addElement(diag ? "-diag" : "-nodiag"); | | 12 | synchronized (scanLock) { |
13 | options.addElement(explicit ? "-explicit" : "-noexplicit"); | | 13 | if (scanning) { |
14 | options.addElement(format ? "-format" : "-noformat"); | | 14 | while (scanning) { |
15 | options.addElement(keep ? "-keep" : "-nokeep"); | | 15 | try { |
16 | options.addElement(logo ? "-logo" : "-nologo"); | | 16 | scanLock.wait(); |
17 | options.addElement(replace ? "-replace" : "-noreplace"); | | 17 | } catch (InterruptedException e) { |
18 | options.addElement(savelog ? "-savelog" : "-nosavelog"); | | 18 | continue; |
19 | options.addElement(sourcedir ? "-sourcedir" : "-nosourcedir"); | | 19 | } |
20 | options.addElement(strictargs ? "-strictargs" : "-nostrictargs"); | | 20 | } |
21 | options.addElement(strictassign ? "-strictassign" : "-nostrictassign"); | | 21 | if (illegal != null) { |
22 | options.addElement(strictcase ? "-strictcase" : "-nostrictcase"); | | 22 | throw illegal; |
23 | options.addElement(strictimport ? "-strictimport" : "-nostrictimport"); | | 23 | } |
24 | options.addElement(strictprops ? "-strictprops" : "-nostrictprops"); | | 24 | return; |
25 | options.addElement(strictsignal ? "-strictsignal" : "-nostrictsignal"); | | 25 | } |
26 | options.addElement(symbols ? "-symbols" : "-nosymbols"); | | 26 | scanning = true; |
27 | options.addElement(time ? "-time" : "-notime"); | | 27 | } |
28 | options.addElement("-" + trace); | | 28 | try { |
29 | options.addElement(utf8 ? "-utf8" : "-noutf8"); | | 29 | synchronized (this) { |
30 | options.addElement("-" + verbose); | | 30 | illegal = null; |
31 | | | 31 | clearResults(); |
32 | String[] results = new String[options.size()]; | | 32 | |
33 | | | 33 | // set in/excludes to reasonable defaults if needed: |
34 | options.copyInto(results); | | 34 | boolean nullIncludes = (includes == null); |
35 | return results; | | 35 | includes = nullIncludes ? new String[] {"**"} : includes; |
36 | } | | 36 | boolean nullExcludes = (excludes == null); |
| | | 37 | excludes = nullExcludes ? new String[0] : excludes; |
| | | 38 | |
| | | 39 | if (basedir == null) { |
| | | 40 | // if no basedir and no includes, nothing to do: |
| | | 41 | if (nullIncludes) { |
| | | 42 | return; |
| | | 43 | } |
| | | 44 | } else { |
| | | 45 | if (!basedir.exists()) { |
| | | 46 | illegal = new IllegalStateException("basedir " + basedir |
| | | 47 | + " does not exist"); |
| | | 48 | } |
| | | 49 | if (!basedir.isDirectory()) { |
| | | 50 | illegal = new IllegalStateException("basedir " + basedir |
| | | 51 | + " is not a directory"); |
| | | 52 | } |
| | | 53 | if (illegal != null) { |
| | | 54 | throw illegal; |
| | | 55 | } |
| | | 56 | } |
| | | 57 | if (isIncluded("")) { |
| | | 58 | if (!isExcluded("")) { |
| | | 59 | if (isSelected("", basedir)) { |
| | | 60 | dirsIncluded.addElement(""); |
| | | 61 | } else { |
| | | 62 | dirsDeselected.addElement(""); |
| | | 63 | } |
| | | 64 | } else { |
| | | 65 | dirsExcluded.addElement(""); |
| | | 66 | } |
| | | 67 | } else { |
| | | 68 | dirsNotIncluded.addElement(""); |
| | | 69 | } |
| | | 70 | checkIncludePatterns(); |
| | | 71 | clearCaches(); |
| | | 72 | includes = nullIncludes ? null : includes; |
| | | 73 | excludes = nullExcludes ? null : excludes; |
| | | 74 | } |
| | | 75 | } finally { |
| | | 76 | synchronized (scanLock) { |
| | | 77 | scanning = false; |
| | | 78 | scanLock.notifyAll(); |
| | | 79 | } |
| | | 80 | } |
| | | 81 | } |