Changeset 17340
- Timestamp:
- 08/11/08 01:17:14 (5 months ago)
- Location:
- lang/java/utiljs/trunk
- Files:
-
- 4 modified
-
src/org/coderepos/utiljs/Arguments.java (modified) (3 diffs)
-
src/org/coderepos/utiljs/taskdefs/Hhc.java (modified) (1 diff)
-
src/org/coderepos/utiljs/taskdefs/JSDoc.java (modified) (8 diffs)
-
test/testcase.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/java/utiljs/trunk/src/org/coderepos/utiljs/Arguments.java
r7733 r17340 14 14 private static final long serialVersionUID = -8908989881175550220L; 15 15 16 public void add(String... strs) 17 { 18 for(String str : strs){ 19 this.add(str); 20 }; 21 }; 22 16 23 /** 17 24 * 第一引数がtrueのときに、第二引数以降の文字列を追加します。 … … 22 29 { 23 30 if(!b){ return; }; 24 for(String str : strs){ 25 this.add(str); 26 }; 31 this.add(strs); 27 32 }; 28 33 … … 36 41 return (String[])this.toArray(args); 37 42 }; 43 44 public String join(){ 45 return this.toString(","); 46 }; 47 48 public String join(String delimiter){ 49 return this.toString(delimiter); 50 }; 51 52 public String toString(){ 53 return this.toString(","); 54 }; 55 56 public String toString(String delimiter) 57 { 58 int length = this.size(); 59 StringBuilder buf = new StringBuilder(); 60 61 for(int i=0;i<length;i++) 62 { 63 if(i!=length-1) 64 { 65 buf.append(this.get(i)).append(delimiter); 66 continue; 67 }; 68 buf.append(get(i)); 69 }; 70 71 return buf.toString(); 72 }; 38 73 }; -
lang/java/utiljs/trunk/src/org/coderepos/utiljs/taskdefs/Hhc.java
r17011 r17340 33 33 arg.setLine(getFile().getAbsolutePath()); 34 34 35 // タスク名を”hhc”に 36 task.setTaskName("hhc"); 35 37 task.execute(); 36 38 }; -
lang/java/utiljs/trunk/src/org/coderepos/utiljs/taskdefs/JSDoc.java
r17011 r17340 3 3 // import 4 4 import java.io.*; 5 import java.util.*; 5 6 6 7 import org.coderepos.utiljs.*; 7 8 import org.apache.tools.ant.*; 9 import org.apache.tools.ant.types.*; 8 10 import org.apache.tools.ant.taskdefs.*; 9 import org.apache.tools.ant.types.Commandline;10 11 11 12 /** … … 15 16 final public class JSDoc extends Task 16 17 { 17 final public String JARNAME = "jsrun.jar"; 18 final public String JSDOCNAME = "app/run.js"; 18 final public String MAINJAR = "jsrun.jar"; 19 final public String MAINDOC = "app/run.js"; 20 final public String MAINTPL = "templates/jsdoc"; 19 21 20 22 /** 全関数の出力オプション **/ … … 37 39 private boolean supress = false; 38 40 /** 必須:出力テンプレート **/ 39 private Filetemplate = null;41 private String template = null; 40 42 /** JSDocToolkitのパス **/ 41 43 private File path = null; … … 43 45 private boolean test = false; 44 46 /** 処理している内容の表示 **/ 47 private boolean verbose = true; 48 45 49 private String ext = null; 46 50 /** ヘルプ表示オプション **/ 47 51 private boolean help = false; 52 53 /** jsrun.jarのパス **/ 54 private File jar = null; 55 /** app/run.jsのパス **/ 56 private File runjs = null; 57 58 // ファイルセットリスト 59 LinkedList<FileSet> fileSetList = new LinkedList<FileSet>(); 48 60 49 61 /** … … 52 64 public void execute() throws BuildException 53 65 { 66 // 引数の組立 54 67 Arguments args = new Arguments(); 55 56 args.add(getPath().getAbsolutePath() + JSDOCNAME); 68 // spp/run.jsのパス(必須) 69 args.add(getRunjs().getAbsolutePath()); 70 // 必須 :: jarに渡すソースファイルパスの設定 71 Iterator<FileSet> it = fileSetList.iterator(); 72 while(it.hasNext()) 73 { 74 FileSet fileSet = it.next(); 75 File baseDir = fileSet.getDir(); 76 77 if(fileSet.hasPatterns()) 78 { 79 // JavaScriptファイルの指定 80 FileScanner fileScanner = fileSet.getDirectoryScanner(this.getProject()); 81 String[] srcFiles = fileScanner.getIncludedFiles(); 82 for(int n=0;n<srcFiles.length;n++){ 83 args.add(baseDir.getAbsolutePath() + System.getProperty("file.separator") + srcFiles[n]); 84 }; 85 } 86 else 87 { 88 // ディレクトリの指定 89 args.add(baseDir.getAbsolutePath()); 90 }; 91 }; 57 92 args.addIf(0 < recurse, "--recurse=" + new Integer(recurse).toString()); 58 93 args.addIf(help, "--help"); … … 62 97 args.addIf(supress, "--supress"); 63 98 args.addIf(ext != null, ext); 64 65 Java task = (Java)getProject().createTask("Java"); 66 67 Commandline.Argument arg = task.createArg(); 68 arg.setValue(args.toString()); 69 70 task.setJar(new File(getPath().getAbsolutePath() + JSDOCNAME)); 99 args.addIf(verbose, "--verbose"); 100 args.addIf(destDir != null, "--directory=" + getDestDir()); 101 args.add("--template=" + getTemplate()); 102 103 Java task = (Java)getProject().createTask("java"); 71 104 task.setFork(true); 105 task.setJar(getJar().getAbsoluteFile()); 106 // jarに渡すオプション引数の組み立て 107 for(int i=0;i<args.size();i++){ 108 task.createArg().setValue(args.get(i)); 109 }; 110 // タスク名を”jsdoc”に 111 task.setTaskName("jsdoc"); 72 112 task.execute(); 113 }; 114 115 public FileSet createSrc() 116 { 117 FileSet fileSet = new FileSet(); 118 fileSetList.add(fileSet); 119 return fileSet; 73 120 }; 74 121 … … 99 146 100 147 /** setter for template **/ 101 public void setTemplate( Filef){ template = f; };148 public void setTemplate(String f){ template = f; }; 102 149 /** getter for template **/ 103 public File getTemplate(){ return template; }; 150 public String getTemplate() 151 { 152 if(template == null) 153 { 154 template = 155 getPath().getAbsolutePath() + 156 System.getProperty("file.separator") + 157 MAINTPL; 158 }; 159 return template; 160 }; 104 161 105 162 /** setter for log **/ … … 132 189 /** getter for test **/ 133 190 public boolean getTest(){ return test; }; 191 192 /** setter for verbose **/ 193 public void setVerbose(boolean b){ verbose = b; }; 194 /** getter for verbose **/ 195 public boolean getVerbose(){ return verbose; }; 196 197 198 protected File getJar() 199 { 200 if(jar == null) 201 { 202 String path = 203 getPath().getAbsolutePath() + 204 System.getProperty("file.separator") + 205 MAINJAR; 206 207 jar = new File(path); 208 }; 209 return jar; 210 }; 211 212 protected File getRunjs() 213 { 214 if(runjs == null) 215 { 216 String path = 217 getPath().getAbsolutePath() + 218 System.getProperty("file.separator") + 219 MAINDOC; 220 221 runjs = new File(path); 222 }; 223 return runjs; 224 }; 134 225 }; -
lang/java/utiljs/trunk/test/testcase.xml
r17011 r17340 7 7 8 8 <target name="default"> 9 <!-- YUICompressor TestCase ::01 -->9 <!-- YUICompressor TestCase#01 --> 10 10 <yuic srcDir="test/sample" destDir="result/yuic" /> 11 <!-- YUICompressor TestCase::02 --> 11 12 <!-- YUICompressor Case#02 --> 12 13 <yuic srcDir="test/sample" destDir="result/yuic2" /> 13 <!-- HTMLHelpCompile TestCase::03 --> 14 15 <!-- Jsdoc Case#03 --> 16 <jsdoc path="c:/jsdoc" verbose="yes"> 17 <src dir="c:/jsdoc/app" includes="test.js" /> 18 </jsdoc> 19 20 <!-- HTMLHelpCompile Case#04 --> 14 21 <hhc file="test/hhc/sample.hhp" /> 15 22 </target>
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)