Changeset 17011 for lang/java

Show
Ignore:
Timestamp:
08/03/08 11:27:34 (4 months ago)
Author:
shogo4405
Message:

テストケースにhhcタスクを追加

Location:
lang/java/utiljs/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/java/utiljs/trunk/src/org/coderepos/utiljs/taskdefs/Hhc.java

    r16717 r17011  
    33// 親クラスのインポート 
    44import java.io.*; 
     5 
    56import org.apache.tools.ant.*; 
    67import org.apache.tools.ant.taskdefs.*; 
     8import org.apache.tools.ant.types.Commandline; 
    79 
    810/** 
     
    1214final public class Hhc extends Task 
    1315{ 
    14         // HTML Help Compilerの名称 
    15         final public String EXECUTABLE = "hhc.exe"; 
     16        // HTML Help Compilerの標準インストール先 
     17        final public String EXECUTABLE = "C:\\Program Files\\HTML Help Workshop\\hhc.exe"; 
     18 
    1619        // HTML Help Projectファイル 
    17         public File hhp = null; 
     20        public File file = null; 
    1821        // HTML Help Workショップのインストールパス 
    19         public File dir = new File("C:\\Program Files\\HTML Help Workshop"); 
     22        public File path = null; 
    2023 
    2124        /** 
     
    2427        public void execute() throws BuildException 
    2528        { 
    26                 ExecTask task = (ExecTask)getProject().createTask("ExecTask"); 
     29                ExecTask task = (ExecTask)getProject().createTask("exec"); 
    2730 
    2831                task.setExecutable(EXECUTABLE); 
    29                 task.setDir(getDir()); 
     32                Commandline.Argument arg = task.createArg(); 
     33                arg.setLine(getFile().getAbsolutePath()); 
    3034 
    3135                task.execute(); 
     
    3337 
    3438        /** setter for HHP **/ 
    35         public void setHhp(File f){ hhp = f; }; 
    36  
     39        public void setFile(File f){ file = f; }; 
    3740        /** getter for HHP **/ 
    38         public File getHhp(){ return hhp; }; 
    39  
    40         /** setter for dir **/ 
    41         public void setDir(File d){ dir = d; }; 
    42  
    43         /** getter for dir **/ 
    44         public File getDir(){ return dir; }; 
     41        public File getFile(){ return file; }; 
     42         
     43        /** setter for path to hhc.exe **/ 
     44        public void setPath(File p){ path = p; }; 
     45        /** getter for path to hhc.exe **/ 
     46        public File getPath(){ return path; }; 
    4547}; 
  • lang/java/utiljs/trunk/src/org/coderepos/utiljs/taskdefs/JSDoc.java

    r16717 r17011  
    33// import 
    44import java.io.*; 
     5 
     6import org.coderepos.utiljs.*; 
    57import org.apache.tools.ant.*; 
    68import org.apache.tools.ant.taskdefs.*; 
     9import org.apache.tools.ant.types.Commandline; 
    710 
    811/** 
     
    1215final public class JSDoc extends Task 
    1316{ 
    14         /** 
    15          * Documentationテンプレート 
    16          */ 
    17         private String template = new String("sunny"); 
     17        final public String JARNAME = "jsrun.jar"; 
     18        final public String JSDOCNAME = "app/run.js"; 
    1819 
    19         /** 
    20          * 処理内容メッセージ 
    21          */ 
    22         private boolean verbose = false; 
    23  
    24         /** 
    25          * JSDoc出力先ディレクト 
    26          */ 
     20        /** 全関数の出力オプション **/ 
     21        private boolean allfunctions = false; 
     22        /** confファイルの読み込みオプション **/ 
     23        private File conf = null; 
     24        /** 出力先ディレクトリ **/ 
    2725        private File destDir = null; 
    28  
    29         /** 
    30          * 文字コード 
    31          */ 
     26        /** 出力文字コード **/ 
    3227        private String encoding = null; 
    33  
    34         /** 
    35          * 許可する拡張子 
    36          */ 
    37         private String extention = null; 
     28        /** JavaScriptソースコードの無視するか否か **/ 
     29        private boolean nocode = false; 
     30        /** 出力結果の保存 **/ 
     31        private File log = null; 
     32        /** private関数も出力するか? **/ 
     33        private boolean privateOpt = false; 
     34        /** 再帰的にディレクトリを探索するか? **/ 
     35        private int recurse = 0; 
     36        /** **/ 
     37        private boolean supress = false; 
     38        /** 必須:出力テンプレート **/ 
     39        private File template = null; 
     40        /** JSDocToolkitのパス **/ 
     41        private File path = null; 
     42        /** testオプション **/ 
     43        private boolean test = false; 
     44        /** 処理している内容の表示 **/ 
     45        private String ext = null; 
     46        /** ヘルプ表示オプション **/ 
     47        private boolean help = false; 
    3848 
    3949        /** 
     
    4252        public void execute() throws BuildException 
    4353        { 
     54                Arguments args = new Arguments(); 
     55 
     56                args.add(getPath().getAbsolutePath() + JSDOCNAME); 
     57                args.addIf(0 < recurse, "--recurse=" + new Integer(recurse).toString()); 
     58                args.addIf(help, "--help"); 
     59                args.addIf(allfunctions, "--allfunctions"); 
     60                args.addIf(test, "--test"); 
     61                args.addIf(nocode, "--nocode"); 
     62                args.addIf(supress, "--supress"); 
     63                args.addIf(ext != null, ext); 
     64 
    4465                Java task = (Java)getProject().createTask("Java"); 
    45                 // fork = trueにしないと動かない。 
     66 
     67                Commandline.Argument arg = task.createArg(); 
     68                arg.setValue(args.toString()); 
     69 
     70                task.setJar(new File(getPath().getAbsolutePath() + JSDOCNAME)); 
    4671                task.setFork(true); 
    4772                task.execute(); 
    4873        }; 
    4974 
    50         /** setter for verbose **/ 
    51         public void setVerbose(boolean b){ verbose = b; }; 
    52  
    53         /** getter for verbose **/ 
    54         public boolean getVerbose(){ return verbose; }; 
    55  
    5675        /** setter for encoding **/ 
    5776        public void setEncoding(String s){ encoding = s; }; 
    58  
    5977        /** getter for encoding **/ 
    6078        public String getEncoding(){ return encoding; }; 
     
    6280        /** setter for destDir **/ 
    6381        public void setDestDir(File d){ destDir = d; }; 
    64  
    6582        /** getter for destDir **/ 
    6683        public File getDestDir(){ return destDir; }; 
     84 
     85        /** setter for allfunctions **/ 
     86        public void setAllfunctions(boolean b){ allfunctions = b; }; 
     87        /** getter for allfunctions **/ 
     88        public boolean getAllfunctions(){ return allfunctions; }; 
     89 
     90        /** setter for path **/ 
     91        public void setPath(File d){ path = d; }; 
     92        /** getter for path **/ 
     93        public File getPath(){ return path; }; 
     94 
     95        /** setter for ext **/ 
     96        public void setExt(String s){ ext = s; }; 
     97        /** getter for ext **/ 
     98        public String getExt(){ return ext; }; 
     99 
     100        /** setter for template **/ 
     101        public void setTemplate(File f){ template = f; }; 
     102        /** getter for template **/ 
     103        public File getTemplate(){ return template; }; 
     104 
     105        /** setter for log **/ 
     106        public void setLog(File f){ log = f; }; 
     107        /** getter for log **/ 
     108        public File getLog(){ return log; }; 
     109 
     110        /** setter for setPrivateOpt **/ 
     111        public void setPrivateOpt(boolean b){ privateOpt = b; }; 
     112        /** getter for setPrivateOpt **/ 
     113        public boolean getPrivateOpt(){ return privateOpt; }; 
     114 
     115        /** setter for conf **/ 
     116        public void setConf(File f){ conf = f; }; 
     117        /** getter for conf **/ 
     118        public File getConf(){ return conf; }; 
     119 
     120        /** setter for help **/ 
     121        public void setHelp(boolean b){ help = b; }; 
     122        /** getter for help **/ 
     123        public boolean getHelp(){ return help; }; 
     124 
     125        /** setter for recurse **/ 
     126        public void setRecurse(int i){ recurse = i; }; 
     127        /** getter for recurse **/ 
     128        public int getRecurse(){ return recurse; }; 
     129 
     130        /** setter for test **/ 
     131        public void setTest(boolean b){ test = b; }; 
     132        /** getter for test **/ 
     133        public boolean getTest(){ return test; }; 
    67134}; 
  • lang/java/utiljs/trunk/test/testcase.xml

    r7969 r17011  
    11<?xml version="1.0" encoding="UTF-8"?> 
    2 <project name="utiljs" default="all" basedir="../"> 
     2<project name="utiljs" default="default" basedir="../"> 
    33 
    4         <taskdef name="yuic" classname="org.coderepos.utiljs.taskdefs.Yuic" classpath="bin;lib/yuicompressor-2.3.5.jar" /> 
     4        <taskdef resource="utiljs.tasks"> 
     5                <classpath><fileset dir="lib"><include name="*.jar"/></fileset></classpath> 
     6        </taskdef> 
    57 
    6         <!-- Yuic Test --> 
    7         <target name="yuic"> 
     8        <target name="default"> 
     9                <!-- YUICompressor TestCase::01 --> 
    810                <yuic srcDir="test/sample" destDir="result/yuic" /> 
     11                <!-- YUICompressor TestCase::02 --> 
     12                <yuic srcDir="test/sample" destDir="result/yuic2" /> 
     13                <!-- HTMLHelpCompile TestCase::03 --> 
     14                <hhc file="test/hhc/sample.hhp" /> 
    915        </target> 
    1016 
    11         <target name="yuic2"> 
    12                 <yuic srcDir="test/sample" destDir="result/yuic2" /> 
    13         </target> 
    14  
    15         <!-- All --> 
    16         <target name="all" depends="yuic,yuic2" /> 
    17  
    1817</project>