作業部屋の使い方を試しています。
ブランチテスト2
| @@ -0,0 +1,134 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (C) 2014 kgto. | |
| 3 | + * | |
| 4 | + * This library is free software; you can redistribute it and/or | |
| 5 | + * modify it under the terms of the GNU Lesser General Public | |
| 6 | + * License as published by the Free Software Foundation; either | |
| 7 | + * version 2.1 of the License, or (at your option) any later version. | |
| 8 | + * | |
| 9 | + * This library is distributed in the hope that it will be useful, | |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | + * Lesser General Public License for more details. | |
| 13 | + * | |
| 14 | + * You should have received a copy of the GNU Lesser General Public | |
| 15 | + * License along with this library; if not, write to the Free Software | |
| 16 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
| 17 | + * MA 02110-1301 USA | |
| 18 | + */ | |
| 19 | + | |
| 20 | +package Form; | |
| 21 | + | |
| 22 | +import Lib.SearchData; | |
| 23 | +import java.io.BufferedReader; | |
| 24 | +import java.io.BufferedWriter; | |
| 25 | +import java.io.File; | |
| 26 | +import java.io.FileInputStream; | |
| 27 | +import java.io.FileOutputStream; | |
| 28 | +import java.io.IOException; | |
| 29 | +import java.io.InputStreamReader; | |
| 30 | +import java.io.OutputStreamWriter; | |
| 31 | +import java.util.ArrayList; | |
| 32 | + | |
| 33 | +/** | |
| 34 | + * | |
| 35 | + * @author kgto | |
| 36 | + */ | |
| 37 | +public class SearchDataRW { | |
| 38 | + | |
| 39 | + private final String splitchar = "\t"; | |
| 40 | + | |
| 41 | + private String UrlAdress; | |
| 42 | + private ArrayList slist; | |
| 43 | + | |
| 44 | + public void seturl(String UrlAdress) { | |
| 45 | + this.UrlAdress = UrlAdress; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setslist(ArrayList slist) { | |
| 49 | + this.slist = slist; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public String geturl() { | |
| 53 | + return UrlAdress; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public ArrayList getslist() { | |
| 57 | + return slist; | |
| 58 | + } | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * 保存 | |
| 62 | + * @param file | |
| 63 | + */ | |
| 64 | + public void save(File file) { | |
| 65 | + | |
| 66 | + try { | |
| 67 | + //空のファイルを作成 | |
| 68 | + file.createNewFile(); | |
| 69 | + | |
| 70 | + FileOutputStream fileoutputstream = new FileOutputStream(file); | |
| 71 | + OutputStreamWriter outputstreamwriter = new OutputStreamWriter(fileoutputstream, "UTF-8"); | |
| 72 | + BufferedWriter bufferedwriter = new BufferedWriter(outputstreamwriter); | |
| 73 | + | |
| 74 | + // URL | |
| 75 | + bufferedwriter.write(UrlAdress); | |
| 76 | + bufferedwriter.write("\n"); | |
| 77 | + // 検索情報 | |
| 78 | + for (Object slist1 : slist) { | |
| 79 | + SearchData sdat = (SearchData) slist1; | |
| 80 | + StringBuilder str = new StringBuilder(); | |
| 81 | + str.append(sdat.getitem()).append(splitchar); | |
| 82 | + str.append(sdat.getHtmltag()).append(splitchar); | |
| 83 | + str.append(sdat.getHtmlid()).append(splitchar); | |
| 84 | + str.append(sdat.getHtmlclass()).append(splitchar); | |
| 85 | + str.append(sdat.getaround()).append(splitchar); | |
| 86 | + str.append(sdat.getregexp()).append("\n"); | |
| 87 | + | |
| 88 | + bufferedwriter.write(str.toString()); | |
| 89 | + } | |
| 90 | + bufferedwriter.close(); | |
| 91 | + | |
| 92 | + } catch(IOException e) { | |
| 93 | + System.out.println(e); | |
| 94 | + } | |
| 95 | + } | |
| 96 | + | |
| 97 | + /** | |
| 98 | + * 読込 | |
| 99 | + * @param file | |
| 100 | + */ | |
| 101 | + public void load(File file) { | |
| 102 | + slist = new ArrayList(); | |
| 103 | + | |
| 104 | + try { | |
| 105 | + FileInputStream fileinputstream = new FileInputStream(file); | |
| 106 | + InputStreamReader inputstreamreader = new InputStreamReader(fileinputstream, "UTF-8"); | |
| 107 | + BufferedReader bufferedreader = new BufferedReader(inputstreamreader); | |
| 108 | + | |
| 109 | + String rec; | |
| 110 | + | |
| 111 | + // URL | |
| 112 | + UrlAdress = bufferedreader.readLine(); | |
| 113 | + // 検索情報 | |
| 114 | + while((rec = bufferedreader.readLine()) != null) { | |
| 115 | + String[] recary = rec.split(splitchar, -1); | |
| 116 | + SearchData sdat = new SearchData(); | |
| 117 | + sdat.setitem(recary[0]); | |
| 118 | + sdat.setHtmltag(recary[1]); | |
| 119 | + sdat.setHtmlid(recary[2]); | |
| 120 | + sdat.setHtmlclass(recary[3]); | |
| 121 | + sdat.setaround(recary[4]); | |
| 122 | + sdat.setregexp(recary[5]); | |
| 123 | + | |
| 124 | + slist.add(sdat); | |
| 125 | + } | |
| 126 | + bufferedreader.close(); | |
| 127 | + | |
| 128 | + } catch(IOException e) { | |
| 129 | + System.out.println(e); | |
| 130 | + } | |
| 131 | + | |
| 132 | + } | |
| 133 | + | |
| 134 | +} |
| @@ -0,0 +1,374 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (C) 2014 kgto. | |
| 3 | + * | |
| 4 | + * This library is free software; you can redistribute it and/or | |
| 5 | + * modify it under the terms of the GNU Lesser General Public | |
| 6 | + * License as published by the Free Software Foundation; either | |
| 7 | + * version 2.1 of the License, or (at your option) any later version. | |
| 8 | + * | |
| 9 | + * This library is distributed in the hope that it will be useful, | |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | + * Lesser General Public License for more details. | |
| 13 | + * | |
| 14 | + * You should have received a copy of the GNU Lesser General Public | |
| 15 | + * License along with this library; if not, write to the Free Software | |
| 16 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
| 17 | + * MA 02110-1301 USA | |
| 18 | + */ | |
| 19 | + | |
| 20 | +package Form; | |
| 21 | + | |
| 22 | +import Lib.HtmlParser; | |
| 23 | +import Lib.SearchData; | |
| 24 | +import java.io.File; | |
| 25 | +import java.util.*; | |
| 26 | +import javax.swing.JFileChooser; | |
| 27 | +import javax.swing.filechooser.FileNameExtensionFilter; | |
| 28 | +import org.jdesktop.observablecollections.ObservableCollections; | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * HTMLページ上の特定の項目を検索し、その項目内容の値を取得する。 | |
| 32 | + * @author kgto | |
| 33 | + */ | |
| 34 | +public class HtmlSearch extends javax.swing.JFrame { | |
| 35 | + | |
| 36 | + private ArrayList slist = new ArrayList(); | |
| 37 | + private List serachDataList = ObservableCollections.observableList(slist); | |
| 38 | + private SearchDataRW sio = new SearchDataRW(); | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * Creates new form Frame1 | |
| 42 | + */ | |
| 43 | + public HtmlSearch() { | |
| 44 | + initComponents(); | |
| 45 | + } | |
| 46 | + | |
| 47 | + public List getSerachDataList() { | |
| 48 | + return this.serachDataList; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public void setSerachDataList(List serachDataList) { | |
| 52 | + this.serachDataList = serachDataList; | |
| 53 | + } | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * This method is called from within the constructor to initialize the form. | |
| 57 | + * WARNING: Do NOT modify this code. The content of this method is always | |
| 58 | + * regenerated by the Form Editor. | |
| 59 | + */ | |
| 60 | + @SuppressWarnings("unchecked") | |
| 61 | + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | |
| 62 | + private void initComponents() { | |
| 63 | + bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); | |
| 64 | + | |
| 65 | + jFileChooser1 = new javax.swing.JFileChooser(); | |
| 66 | + jLabel1 = new javax.swing.JLabel(); | |
| 67 | + jTxtUrl = new javax.swing.JTextField(); | |
| 68 | + jBtnSearch = new javax.swing.JButton(); | |
| 69 | + jPanel1 = new javax.swing.JPanel(); | |
| 70 | + jScrollPane1 = new javax.swing.JScrollPane(); | |
| 71 | + jTable1 = new javax.swing.JTable(); | |
| 72 | + jBtnRowIns = new javax.swing.JButton(); | |
| 73 | + jBtnRowDel = new javax.swing.JButton(); | |
| 74 | + jBtnRowCpy = new javax.swing.JButton(); | |
| 75 | + jPanel2 = new javax.swing.JPanel(); | |
| 76 | + jScrollPane2 = new javax.swing.JScrollPane(); | |
| 77 | + jTxtRtn = new javax.swing.JTextArea(); | |
| 78 | + jMenuBar1 = new javax.swing.JMenuBar(); | |
| 79 | + jMenu1 = new javax.swing.JMenu(); | |
| 80 | + jMenuLoad = new javax.swing.JMenuItem(); | |
| 81 | + jMenuSave = new javax.swing.JMenuItem(); | |
| 82 | + jMenu2 = new javax.swing.JMenu(); | |
| 83 | + | |
| 84 | + jFileChooser1.setCurrentDirectory(new java.io.File("C:\\zz_work\\java")); | |
| 85 | + jFileChooser1.setDialogTitle(""); | |
| 86 | + jFileChooser1.setFileFilter(new FileNameExtensionFilter("TEXTファイル", "txt")); | |
| 87 | + | |
| 88 | + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); | |
| 89 | + setTitle("タグ検索"); | |
| 90 | + | |
| 91 | + jLabel1.setText(" URL:"); | |
| 92 | + | |
| 93 | + jBtnSearch.setText("検索"); | |
| 94 | + jBtnSearch.addActionListener(new java.awt.event.ActionListener() { | |
| 95 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 96 | + jBtnSearchActionPerformed(evt); | |
| 97 | + } | |
| 98 | + }); | |
| 99 | + | |
| 100 | + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("検索情報")); | |
| 101 | + | |
| 102 | + jTable1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); | |
| 103 | + jTable1.getTableHeader().setReorderingAllowed(false); | |
| 104 | + | |
| 105 | + org.jdesktop.beansbinding.ELProperty eLProperty = org.jdesktop.beansbinding.ELProperty.create("${serachDataList}"); | |
| 106 | + org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, eLProperty, jTable1); | |
| 107 | + org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${item}")); | |
| 108 | + columnBinding.setColumnName("項目名"); | |
| 109 | + columnBinding.setColumnClass(String.class); | |
| 110 | + columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${htmltag}")); | |
| 111 | + columnBinding.setColumnName("タグ"); | |
| 112 | + columnBinding.setColumnClass(String.class); | |
| 113 | + columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${htmlid}")); | |
| 114 | + columnBinding.setColumnName("ID"); | |
| 115 | + columnBinding.setColumnClass(String.class); | |
| 116 | + columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${htmlclass}")); | |
| 117 | + columnBinding.setColumnName("クラス"); | |
| 118 | + columnBinding.setColumnClass(String.class); | |
| 119 | + columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${around}")); | |
| 120 | + columnBinding.setColumnName("位置"); | |
| 121 | + columnBinding.setColumnClass(String.class); | |
| 122 | + columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${regexp}")); | |
| 123 | + columnBinding.setColumnName("抽出条件"); | |
| 124 | + columnBinding.setColumnClass(String.class); | |
| 125 | + bindingGroup.addBinding(jTableBinding); | |
| 126 | + jTableBinding.bind(); | |
| 127 | + jScrollPane1.setViewportView(jTable1); | |
| 128 | + | |
| 129 | + jBtnRowIns.setText("行挿入"); | |
| 130 | + jBtnRowIns.addActionListener(new java.awt.event.ActionListener() { | |
| 131 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 132 | + jBtnRowInsActionPerformed(evt); | |
| 133 | + } | |
| 134 | + }); | |
| 135 | + | |
| 136 | + jBtnRowDel.setText("行削除"); | |
| 137 | + jBtnRowDel.addActionListener(new java.awt.event.ActionListener() { | |
| 138 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 139 | + jBtnRowDelActionPerformed(evt); | |
| 140 | + } | |
| 141 | + }); | |
| 142 | + | |
| 143 | + jBtnRowCpy.setText("行コピー"); | |
| 144 | + jBtnRowCpy.addActionListener(new java.awt.event.ActionListener() { | |
| 145 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 146 | + jBtnRowCpyActionPerformed(evt); | |
| 147 | + } | |
| 148 | + }); | |
| 149 | + | |
| 150 | + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); | |
| 151 | + jPanel1.setLayout(jPanel1Layout); | |
| 152 | + jPanel1Layout.setHorizontalGroup( | |
| 153 | + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 154 | + .addGroup(jPanel1Layout.createSequentialGroup() | |
| 155 | + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
| 156 | + .addComponent(jBtnRowCpy) | |
| 157 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 158 | + .addComponent(jBtnRowDel) | |
| 159 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 160 | + .addComponent(jBtnRowIns)) | |
| 161 | + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) | |
| 162 | + ); | |
| 163 | + jPanel1Layout.setVerticalGroup( | |
| 164 | + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 165 | + .addGroup(jPanel1Layout.createSequentialGroup() | |
| 166 | + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE) | |
| 167 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 168 | + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
| 169 | + .addComponent(jBtnRowDel) | |
| 170 | + .addComponent(jBtnRowIns) | |
| 171 | + .addComponent(jBtnRowCpy))) | |
| 172 | + ); | |
| 173 | + | |
| 174 | + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("検索結果")); | |
| 175 | + | |
| 176 | + jTxtRtn.setColumns(20); | |
| 177 | + jTxtRtn.setRows(5); | |
| 178 | + jScrollPane2.setViewportView(jTxtRtn); | |
| 179 | + | |
| 180 | + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); | |
| 181 | + jPanel2.setLayout(jPanel2Layout); | |
| 182 | + jPanel2Layout.setHorizontalGroup( | |
| 183 | + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 184 | + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE) | |
| 185 | + ); | |
| 186 | + jPanel2Layout.setVerticalGroup( | |
| 187 | + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 188 | + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE) | |
| 189 | + ); | |
| 190 | + | |
| 191 | + jMenu1.setText("ファイル"); | |
| 192 | + | |
| 193 | + jMenuLoad.setText("LOAD"); | |
| 194 | + jMenuLoad.addActionListener(new java.awt.event.ActionListener() { | |
| 195 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 196 | + jMenuLoadActionPerformed(evt); | |
| 197 | + } | |
| 198 | + }); | |
| 199 | + jMenu1.add(jMenuLoad); | |
| 200 | + | |
| 201 | + jMenuSave.setText("SAVE"); | |
| 202 | + jMenuSave.addActionListener(new java.awt.event.ActionListener() { | |
| 203 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 204 | + jMenuSaveActionPerformed(evt); | |
| 205 | + } | |
| 206 | + }); | |
| 207 | + jMenu1.add(jMenuSave); | |
| 208 | + | |
| 209 | + jMenuBar1.add(jMenu1); | |
| 210 | + | |
| 211 | + jMenu2.setText("検索"); | |
| 212 | + jMenu2.addMouseListener(new java.awt.event.MouseAdapter() { | |
| 213 | + public void mouseClicked(java.awt.event.MouseEvent evt) { | |
| 214 | + jMenu2MouseClicked(evt); | |
| 215 | + } | |
| 216 | + }); | |
| 217 | + jMenuBar1.add(jMenu2); | |
| 218 | + | |
| 219 | + setJMenuBar(jMenuBar1); | |
| 220 | + | |
| 221 | + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | |
| 222 | + getContentPane().setLayout(layout); | |
| 223 | + layout.setHorizontalGroup( | |
| 224 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 225 | + .addGroup(layout.createSequentialGroup() | |
| 226 | + .addComponent(jLabel1) | |
| 227 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 228 | + .addComponent(jTxtUrl) | |
| 229 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 230 | + .addComponent(jBtnSearch)) | |
| 231 | + .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
| 232 | + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
| 233 | + ); | |
| 234 | + layout.setVerticalGroup( | |
| 235 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 236 | + .addGroup(layout.createSequentialGroup() | |
| 237 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
| 238 | + .addComponent(jLabel1) | |
| 239 | + .addComponent(jTxtUrl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
| 240 | + .addComponent(jBtnSearch)) | |
| 241 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 242 | + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
| 243 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 244 | + .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |
| 245 | + ); | |
| 246 | + | |
| 247 | + bindingGroup.bind(); | |
| 248 | + | |
| 249 | + pack(); | |
| 250 | + }// </editor-fold>//GEN-END:initComponents | |
| 251 | + | |
| 252 | + private void jBtnRowInsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnRowInsActionPerformed | |
| 253 | + int SelectedRow = jTable1.getSelectedRow(); | |
| 254 | + SearchData sdat = new SearchData(); | |
| 255 | + | |
| 256 | + if(SelectedRow >= 0) { | |
| 257 | + this.serachDataList.add(SelectedRow, sdat); | |
| 258 | + } else { | |
| 259 | + this.serachDataList.add(sdat); | |
| 260 | + } | |
| 261 | + }//GEN-LAST:event_jBtnRowInsActionPerformed | |
| 262 | + | |
| 263 | + private void jBtnRowDelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnRowDelActionPerformed | |
| 264 | + int SelectedRow = jTable1.getSelectedRow(); | |
| 265 | + if(!(SelectedRow < 0)) { | |
| 266 | + this.serachDataList.remove(SelectedRow); | |
| 267 | + } | |
| 268 | + }//GEN-LAST:event_jBtnRowDelActionPerformed | |
| 269 | + | |
| 270 | + private void jMenuLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuLoadActionPerformed | |
| 271 | + int selected = jFileChooser1.showOpenDialog(this); | |
| 272 | + if (selected == JFileChooser.APPROVE_OPTION) { | |
| 273 | + File file = jFileChooser1.getSelectedFile(); | |
| 274 | + serachDataList.clear(); | |
| 275 | + sio.load(file); | |
| 276 | + jTxtUrl.setText(sio.geturl()); | |
| 277 | + serachDataList.addAll(sio.getslist()); | |
| 278 | + } | |
| 279 | + }//GEN-LAST:event_jMenuLoadActionPerformed | |
| 280 | + | |
| 281 | + private void jMenuSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuSaveActionPerformed | |
| 282 | + int selected = jFileChooser1.showSaveDialog(this); | |
| 283 | + if (selected == JFileChooser.APPROVE_OPTION) { | |
| 284 | + File file = jFileChooser1.getSelectedFile(); | |
| 285 | + sio.seturl(jTxtUrl.getText()); | |
| 286 | + sio.setslist(slist); | |
| 287 | + sio.save(file); | |
| 288 | + } | |
| 289 | + }//GEN-LAST:event_jMenuSaveActionPerformed | |
| 290 | + | |
| 291 | + private void jMenu2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu2MouseClicked | |
| 292 | + jTxtRtn.setText(null); | |
| 293 | + HtmlParser par = new HtmlParser(jTxtUrl.getText()); | |
| 294 | + for (Object slist1 : slist) { | |
| 295 | + String rtn = par.search((SearchData)slist1); | |
| 296 | + jTxtRtn.append(rtn + "\r\n"); | |
| 297 | + } | |
| 298 | + }//GEN-LAST:event_jMenu2MouseClicked | |
| 299 | + | |
| 300 | + private void jBtnRowCpyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnRowCpyActionPerformed | |
| 301 | + int SelectedRow = jTable1.getSelectedRow(); | |
| 302 | + if(SelectedRow >= 0) { | |
| 303 | + SearchData SelectData = (SearchData)slist.get(SelectedRow); | |
| 304 | + SearchData Cpydata = new SearchData(SelectData); | |
| 305 | + this.serachDataList.add(SelectedRow, Cpydata); | |
| 306 | + } | |
| 307 | + }//GEN-LAST:event_jBtnRowCpyActionPerformed | |
| 308 | + | |
| 309 | + private void jBtnSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnSearchActionPerformed | |
| 310 | + jTxtRtn.setText(null); | |
| 311 | + HtmlParser par = new HtmlParser(jTxtUrl.getText()); | |
| 312 | + for (Object slist1 : slist) { | |
| 313 | + String rtn = par.search((SearchData)slist1); | |
| 314 | + jTxtRtn.append(rtn + "\r\n"); | |
| 315 | + } | |
| 316 | + }//GEN-LAST:event_jBtnSearchActionPerformed | |
| 317 | + | |
| 318 | + /** | |
| 319 | + * @param args the command line arguments | |
| 320 | + */ | |
| 321 | + public static void main(String args[]) { | |
| 322 | + /* Set the Nimbus look and feel */ | |
| 323 | + //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> | |
| 324 | + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. | |
| 325 | + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html | |
| 326 | + */ | |
| 327 | + try { | |
| 328 | + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { | |
| 329 | + if ("Nimbus".equals(info.getName())) { | |
| 330 | + javax.swing.UIManager.setLookAndFeel(info.getClassName()); | |
| 331 | + break; | |
| 332 | + } | |
| 333 | + } | |
| 334 | + } catch (ClassNotFoundException ex) { | |
| 335 | + java.util.logging.Logger.getLogger(HtmlSearch.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
| 336 | + } catch (InstantiationException ex) { | |
| 337 | + java.util.logging.Logger.getLogger(HtmlSearch.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
| 338 | + } catch (IllegalAccessException ex) { | |
| 339 | + java.util.logging.Logger.getLogger(HtmlSearch.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
| 340 | + } catch (javax.swing.UnsupportedLookAndFeelException ex) { | |
| 341 | + java.util.logging.Logger.getLogger(HtmlSearch.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | |
| 342 | + } | |
| 343 | + //</editor-fold> | |
| 344 | + | |
| 345 | + /* Create and display the form */ | |
| 346 | + java.awt.EventQueue.invokeLater(new Runnable() { | |
| 347 | + public void run() { | |
| 348 | + new HtmlSearch().setVisible(true); | |
| 349 | + } | |
| 350 | + }); | |
| 351 | + } | |
| 352 | + | |
| 353 | + // Variables declaration - do not modify//GEN-BEGIN:variables | |
| 354 | + private javax.swing.JButton jBtnRowCpy; | |
| 355 | + private javax.swing.JButton jBtnRowDel; | |
| 356 | + private javax.swing.JButton jBtnRowIns; | |
| 357 | + private javax.swing.JButton jBtnSearch; | |
| 358 | + private javax.swing.JFileChooser jFileChooser1; | |
| 359 | + private javax.swing.JLabel jLabel1; | |
| 360 | + private javax.swing.JMenu jMenu1; | |
| 361 | + private javax.swing.JMenu jMenu2; | |
| 362 | + private javax.swing.JMenuBar jMenuBar1; | |
| 363 | + private javax.swing.JMenuItem jMenuLoad; | |
| 364 | + private javax.swing.JMenuItem jMenuSave; | |
| 365 | + private javax.swing.JPanel jPanel1; | |
| 366 | + private javax.swing.JPanel jPanel2; | |
| 367 | + private javax.swing.JScrollPane jScrollPane1; | |
| 368 | + private javax.swing.JScrollPane jScrollPane2; | |
| 369 | + private javax.swing.JTable jTable1; | |
| 370 | + private javax.swing.JTextArea jTxtRtn; | |
| 371 | + private javax.swing.JTextField jTxtUrl; | |
| 372 | + private org.jdesktop.beansbinding.BindingGroup bindingGroup; | |
| 373 | + // End of variables declaration//GEN-END:variables | |
| 374 | +} |
| @@ -0,0 +1,217 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (C) 2014 kgto. | |
| 3 | + * | |
| 4 | + * This library is free software; you can redistribute it and/or | |
| 5 | + * modify it under the terms of the GNU Lesser General Public | |
| 6 | + * License as published by the Free Software Foundation; either | |
| 7 | + * version 2.1 of the License, or (at your option) any later version. | |
| 8 | + * | |
| 9 | + * This library is distributed in the hope that it will be useful, | |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | + * Lesser General Public License for more details. | |
| 13 | + * | |
| 14 | + * You should have received a copy of the GNU Lesser General Public | |
| 15 | + * License along with this library; if not, write to the Free Software | |
| 16 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
| 17 | + * MA 02110-1301 USA | |
| 18 | + */ | |
| 19 | + | |
| 20 | +package Lib; | |
| 21 | + | |
| 22 | +import java.util.ArrayList; | |
| 23 | +import java.util.HashMap; | |
| 24 | +import javax.swing.text.MutableAttributeSet; | |
| 25 | +import javax.swing.text.html.HTML; | |
| 26 | +import javax.swing.text.html.HTMLEditorKit; | |
| 27 | + | |
| 28 | +/** | |
| 29 | + * | |
| 30 | + * @author kgto | |
| 31 | + */ | |
| 32 | +public class HtmlParserCallback extends HTMLEditorKit.ParserCallback { | |
| 33 | + | |
| 34 | + // デバック情報表示フラグ | |
| 35 | + final boolean DEBUG = false; | |
| 36 | + | |
| 37 | + // Tag毎の階層 | |
| 38 | + HashMap<HTML.Tag,Integer> tagMap = new HashMap<>(); | |
| 39 | + | |
| 40 | + // serach key 情報 | |
| 41 | + String keytag; | |
| 42 | + String keyid; | |
| 43 | + String keyclass; | |
| 44 | + | |
| 45 | + // serach key と一致時の情報退避 | |
| 46 | + int bufCount = 0; | |
| 47 | + HTML.Tag bufTag = null; | |
| 48 | + MutableAttributeSet bufAttr = null; | |
| 49 | + // serach key と一致時の情報格納ワーク | |
| 50 | + StringBuilder bufText; | |
| 51 | + | |
| 52 | + // serach key と一致時のデータ一覧 | |
| 53 | + ArrayList sData; | |
| 54 | + | |
| 55 | + public HtmlParserCallback(SearchData skey) { | |
| 56 | + | |
| 57 | + // キー情報展開 | |
| 58 | + keytag = skey.getHtmltag(); | |
| 59 | + keyid = skey.getHtmlid(); | |
| 60 | + keyclass = skey.getHtmlclass(); | |
| 61 | + | |
| 62 | + sData = new ArrayList(); | |
| 63 | + } | |
| 64 | + | |
| 65 | + public ArrayList getrtnData() { | |
| 66 | + return this.sData; | |
| 67 | + } | |
| 68 | + | |
| 69 | + @Override | |
| 70 | + public void handleStartTag(HTML.Tag tag, MutableAttributeSet attr, int pos){ | |
| 71 | + // Tag毎の階層を保持 | |
| 72 | + int count = 1; | |
| 73 | + if(tagMap.containsKey(tag)) { | |
| 74 | + count = tagMap.get(tag); | |
| 75 | + count++; | |
| 76 | + } | |
| 77 | + tagMap.put(tag, count); | |
| 78 | + | |
| 79 | + //--- DEBUG OUT ---- start --- | |
| 80 | + if(DEBUG) { | |
| 81 | + StringBuffer strBuf = new StringBuffer(); | |
| 82 | + String ret; | |
| 83 | + | |
| 84 | + strBuf.append(count).append(" : F : ").append(tag.toString()); | |
| 85 | + ret = (String)attr.getAttribute(HTML.Attribute.ID); | |
| 86 | + if(ret != null) { | |
| 87 | + strBuf.append(" [ID] ").append(ret); | |
| 88 | + } | |
| 89 | + ret = (String)attr.getAttribute(HTML.Attribute.CLASS); | |
| 90 | + if(ret != null) { | |
| 91 | + strBuf.append(" [CLASS] ").append(ret); | |
| 92 | + } | |
| 93 | + ret = (String)attr.getAttribute(HTML.Attribute.VALUE); | |
| 94 | + if(ret != null) { | |
| 95 | + strBuf.append(" [VALUE] ").append(ret); | |
| 96 | + } | |
| 97 | + System.out.println(strBuf); | |
| 98 | + } | |
| 99 | + //--- DEBUG OUT ---- end --- | |
| 100 | + | |
| 101 | + if(bufCount == 0) { | |
| 102 | + if(tag.toString().equals(keytag)) { | |
| 103 | + if(serachAttribute(attr)) { | |
| 104 | + bufCount = count; | |
| 105 | + bufTag = tag; | |
| 106 | + bufAttr = attr; | |
| 107 | + bufText = new StringBuilder(); | |
| 108 | + } | |
| 109 | + } | |
| 110 | + } | |
| 111 | + } | |
| 112 | + | |
| 113 | + @Override | |
| 114 | + public void handleEndTag(HTML.Tag tag, int pos){ | |
| 115 | + // Tag毎の階層を取得 | |
| 116 | + int count = 0; | |
| 117 | + if(tagMap.containsKey(tag)) { | |
| 118 | + count = tagMap.get(tag); | |
| 119 | + } | |
| 120 | + | |
| 121 | + //--- DEBUG OUT ---- start --- | |
| 122 | + if(DEBUG) { | |
| 123 | + System.out.println(count + " : E : " + tag.toString()); | |
| 124 | + } | |
| 125 | + //--- DEBUG OUT ---- end --- | |
| 126 | + | |
| 127 | + if(tag.equals(bufTag) && count <= bufCount) { | |
| 128 | + | |
| 129 | + // 溜め込んだ一致情報をリストへ格納 | |
| 130 | + sData.add(bufText.toString()); | |
| 131 | + | |
| 132 | + // 退避したserach keyとの一致情報クリア | |
| 133 | + bufCount = 0; | |
| 134 | + bufTag = null; | |
| 135 | + bufAttr = null; | |
| 136 | + bufText = null; | |
| 137 | + } | |
| 138 | + | |
| 139 | + // Tag毎の階層減算 | |
| 140 | + tagMap.put(tag, --count); | |
| 141 | + } | |
| 142 | + | |
| 143 | + @Override | |
| 144 | + public void handleText(char[] data, int pos){ | |
| 145 | + //--- DEBUG OUT ---- start --- | |
| 146 | + if(DEBUG) { | |
| 147 | + String dat = new String(data); | |
| 148 | + System.out.println(dat); | |
| 149 | + } | |
| 150 | + //--- DEBUG OUT ---- end --- | |
| 151 | + String splitchar = "\t"; | |
| 152 | + | |
| 153 | + //制御文字の削除 | |
| 154 | + // 0xa0 | |
| 155 | + StringBuilder buf = new StringBuilder(); | |
| 156 | + for(int i = 0; i < data.length; i++) { | |
| 157 | + if(data[i] > 0x1f && data[i] != 0x7f && data[i] != 0xa0) { | |
| 158 | + buf.append(data[i]); | |
| 159 | + } | |
| 160 | + } | |
| 161 | + | |
| 162 | + if(bufCount > 0) { | |
| 163 | + if(bufText.length() > 0) { | |
| 164 | + bufText.append(splitchar); | |
| 165 | + } | |
| 166 | + bufText.append(buf.toString()); | |
| 167 | + } | |
| 168 | + | |
| 169 | + } | |
| 170 | + | |
| 171 | + @Override | |
| 172 | + public void handleSimpleTag(HTML.Tag tag, MutableAttributeSet attr, int pos){ | |
| 173 | + //--- DEBUG OUT ---- start --- | |
| 174 | + if(DEBUG) { | |
| 175 | + StringBuffer strBuf = new StringBuffer(); | |
| 176 | + String ret; | |
| 177 | + strBuf.append("x : S : ").append(tag.toString()); | |
| 178 | + ret = (String)attr.getAttribute(HTML.Attribute.VALUE); | |
| 179 | + if(ret != null) { | |
| 180 | + strBuf.append(" [VALUE] ").append(ret); | |
| 181 | + } | |
| 182 | + System.out.println(strBuf); | |
| 183 | + } | |
| 184 | + //--- DEBUG OUT ---- end --- | |
| 185 | + } | |
| 186 | + | |
| 187 | + /** | |
| 188 | + * ページ内のID/CLASS値と検索キーを比較する. | |
| 189 | + * @param attr ページのMutableAttributeSet | |
| 190 | + * @return boolean 検索キーと一致の時、true | |
| 191 | + */ | |
| 192 | + public boolean serachAttribute(MutableAttributeSet attr) { | |
| 193 | + String currentID = (String)attr.getAttribute(HTML.Attribute.ID); | |
| 194 | + String currentClass = (String)attr.getAttribute(HTML.Attribute.CLASS); | |
| 195 | + | |
| 196 | + if(keyid.isEmpty() == false && keyclass.isEmpty() == false) { | |
| 197 | + if(keyid.equals(currentID) && keyclass.equals(currentClass)) { | |
| 198 | + return true; | |
| 199 | + } | |
| 200 | + } | |
| 201 | + | |
| 202 | + if(keyid.isEmpty() == false) { | |
| 203 | + if(keyid.equals(currentID)) { | |
| 204 | + return true; | |
| 205 | + } | |
| 206 | + } | |
| 207 | + | |
| 208 | + if(keyclass.isEmpty() == false) { | |
| 209 | + if(keyclass.equals(currentClass)) { | |
| 210 | + return true; | |
| 211 | + } | |
| 212 | + } | |
| 213 | + | |
| 214 | + return false; | |
| 215 | + } | |
| 216 | + | |
| 217 | +} |
| @@ -0,0 +1,95 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (C) 2014 kgto. | |
| 3 | + * | |
| 4 | + * This library is free software; you can redistribute it and/or | |
| 5 | + * modify it under the terms of the GNU Lesser General Public | |
| 6 | + * License as published by the Free Software Foundation; either | |
| 7 | + * version 2.1 of the License, or (at your option) any later version. | |
| 8 | + * | |
| 9 | + * This library is distributed in the hope that it will be useful, | |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | + * Lesser General Public License for more details. | |
| 13 | + * | |
| 14 | + * You should have received a copy of the GNU Lesser General Public | |
| 15 | + * License along with this library; if not, write to the Free Software | |
| 16 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
| 17 | + * MA 02110-1301 USA | |
| 18 | + */ | |
| 19 | + | |
| 20 | +package Lib; | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * | |
| 24 | + * @author kgto | |
| 25 | + */ | |
| 26 | +public class SearchData { | |
| 27 | + | |
| 28 | + private String item; | |
| 29 | + private String htmltag; | |
| 30 | + private String htmlid; | |
| 31 | + private String htmlclass; | |
| 32 | + private String around; | |
| 33 | + private String regexp; | |
| 34 | + | |
| 35 | + public SearchData() { | |
| 36 | + } | |
| 37 | + | |
| 38 | + public SearchData(SearchData dat) { | |
| 39 | + this.item = dat.getitem(); | |
| 40 | + this.htmltag = dat.getHtmltag(); | |
| 41 | + this.htmlid = dat.getHtmlid(); | |
| 42 | + this.htmlclass = dat.getHtmlclass(); | |
| 43 | + this.around = dat.getaround(); | |
| 44 | + this.regexp = dat.getregexp(); | |
| 45 | + } | |
| 46 | + | |
| 47 | + public void setitem(String item) { | |
| 48 | + this.item = item; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public void setHtmltag(String htmltag) { | |
| 52 | + this.htmltag = htmltag; | |
| 53 | + } | |
| 54 | + | |
| 55 | + public void setHtmlid(String htmlid) { | |
| 56 | + this.htmlid = htmlid; | |
| 57 | + } | |
| 58 | + | |
| 59 | + public void setHtmlclass(String htmlclass) { | |
| 60 | + this.htmlclass = htmlclass; | |
| 61 | + } | |
| 62 | + | |
| 63 | + public void setaround(String around) { | |
| 64 | + this.around = around; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public void setregexp(String regexp) { | |
| 68 | + this.regexp = regexp; | |
| 69 | + } | |
| 70 | + | |
| 71 | + public String getitem() { | |
| 72 | + return item; | |
| 73 | + } | |
| 74 | + | |
| 75 | + public String getHtmltag() { | |
| 76 | + return htmltag; | |
| 77 | + } | |
| 78 | + | |
| 79 | + public String getHtmlid() { | |
| 80 | + return htmlid; | |
| 81 | + } | |
| 82 | + | |
| 83 | + public String getHtmlclass() { | |
| 84 | + return htmlclass; | |
| 85 | + } | |
| 86 | + | |
| 87 | + public String getaround() { | |
| 88 | + return around; | |
| 89 | + } | |
| 90 | + | |
| 91 | + public String getregexp() { | |
| 92 | + return regexp; | |
| 93 | + } | |
| 94 | + | |
| 95 | +} |
| @@ -0,0 +1,214 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (C) 2014 kgto. | |
| 3 | + * | |
| 4 | + * This library is free software; you can redistribute it and/or | |
| 5 | + * modify it under the terms of the GNU Lesser General Public | |
| 6 | + * License as published by the Free Software Foundation; either | |
| 7 | + * version 2.1 of the License, or (at your option) any later version. | |
| 8 | + * | |
| 9 | + * This library is distributed in the hope that it will be useful, | |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | + * Lesser General Public License for more details. | |
| 13 | + * | |
| 14 | + * You should have received a copy of the GNU Lesser General Public | |
| 15 | + * License along with this library; if not, write to the Free Software | |
| 16 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
| 17 | + * MA 02110-1301 USA | |
| 18 | + */ | |
| 19 | + | |
| 20 | +package Lib; | |
| 21 | + | |
| 22 | +import java.io.*; | |
| 23 | +import java.net.*; | |
| 24 | +import java.util.ArrayList; | |
| 25 | +import java.util.regex.Matcher; | |
| 26 | +import java.util.regex.Pattern; | |
| 27 | +import javax.swing.text.html.parser.ParserDelegator; | |
| 28 | + | |
| 29 | +/** | |
| 30 | + * | |
| 31 | + * @author kgto | |
| 32 | + */ | |
| 33 | +public class HtmlParser { | |
| 34 | + | |
| 35 | + String UrlAdress; | |
| 36 | + String pageData; | |
| 37 | + | |
| 38 | + ArrayList sData; | |
| 39 | + | |
| 40 | + // 作業ワーク | |
| 41 | + String htmltag; | |
| 42 | + String htmlid; | |
| 43 | + String htmlclass; | |
| 44 | + | |
| 45 | + public HtmlParser() { | |
| 46 | + UrlAdress = null; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public HtmlParser(String UrlAdress) { | |
| 50 | + this.UrlAdress = UrlAdress; | |
| 51 | + getpageData(); | |
| 52 | + } | |
| 53 | + | |
| 54 | + public void seturl(String UrlAdress) { | |
| 55 | + this.UrlAdress = UrlAdress; | |
| 56 | + getpageData(); | |
| 57 | + } | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * HTMLページ内検索. | |
| 61 | + * 検索キーとして渡されたタグ,ID,クラスから、対象となるタグを探し出し、 | |
| 62 | + * around(タグ位置)として指定された箇所の文字列をregexp(正規表現)で指定された整形を | |
| 63 | + * 行った結果を返す。<br> | |
| 64 | + * aroundの初期値:0 検索キーとして未指定(未入力)の場合、最初(0)の文字列。<br> | |
| 65 | + * regexpが指定(入力)ありの場合、正規表現にて整形を行う。<br> | |
| 66 | + * 渡された検索キーに一致するタグが存在しなかった場合、NULLを返す。 | |
| 67 | + * @param skey 検索キーデータ(SearchData) | |
| 68 | + * @return String 検索キーに一致するデータの文字列 | |
| 69 | + */ | |
| 70 | + public String search(SearchData skey) { | |
| 71 | + | |
| 72 | + String item = skey.getitem(); | |
| 73 | + String regexp = skey.getregexp(); | |
| 74 | + | |
| 75 | + // htmlページ内を検索 | |
| 76 | + if(isHtmlkeyEq(skey) == false) { | |
| 77 | + serchpageData(skey); | |
| 78 | + } | |
| 79 | + | |
| 80 | + // 検索位置を数値変換 | |
| 81 | + String around = skey.getaround(); | |
| 82 | + byte bAround = 0; | |
| 83 | + if(around.length() > 0) { | |
| 84 | + bAround = Byte.parseByte(around); | |
| 85 | + } | |
| 86 | + | |
| 87 | + if(bAround < sData.size()) { | |
| 88 | + String str = (String)sData.get(bAround); | |
| 89 | + String rtn = RegularExpression(str, regexp); | |
| 90 | + return item + "\t" + rtn; | |
| 91 | + } | |
| 92 | + return null; | |
| 93 | + } | |
| 94 | + | |
| 95 | + /** | |
| 96 | + * 直近のHTMLタグ/ID/CLASS値と引数の値を比較する. | |
| 97 | + * @param skey HTMLタグ/ID/CLASSが格納された検索キー | |
| 98 | + * @return boolean HTMLタグ/ID/CLASS値が一致する時、true | |
| 99 | + */ | |
| 100 | + public boolean isHtmlkeyEq(SearchData skey) { | |
| 101 | + | |
| 102 | + String stag = skey.getHtmltag(); | |
| 103 | + String sid = skey.getHtmlid(); | |
| 104 | + String sclass = skey.getHtmlclass(); | |
| 105 | + | |
| 106 | + boolean rtn = true; | |
| 107 | + | |
| 108 | + // htmltag | |
| 109 | + if(htmltag == null) { | |
| 110 | + rtn = false; | |
| 111 | + } else { | |
| 112 | + if(htmltag.equals(stag) == false) { | |
| 113 | + rtn = false; | |
| 114 | + } | |
| 115 | + } | |
| 116 | + | |
| 117 | + // htmlid | |
| 118 | + if(htmlid == null) { | |
| 119 | + rtn = false; | |
| 120 | + } else { | |
| 121 | + if(htmlid.equals(sid) == false) { | |
| 122 | + rtn = false; | |
| 123 | + } | |
| 124 | + } | |
| 125 | + | |
| 126 | + // htmlclass | |
| 127 | + if(htmlclass == null) { | |
| 128 | + rtn = false; | |
| 129 | + } else { | |
| 130 | + if(htmlclass.equals(sclass) == false) { | |
| 131 | + rtn = false; | |
| 132 | + } | |
| 133 | + } | |
| 134 | + | |
| 135 | + if(!rtn) { | |
| 136 | + htmltag = stag; | |
| 137 | + htmlid = sid; | |
| 138 | + htmlclass = sclass; | |
| 139 | + } | |
| 140 | + | |
| 141 | + return rtn; | |
| 142 | + } | |
| 143 | + | |
| 144 | + /** | |
| 145 | + * 正規表現検索. | |
| 146 | + * @param strdata | |
| 147 | + * @param regexp | |
| 148 | + * @return | |
| 149 | + */ | |
| 150 | + public String RegularExpression(String strdata, String regexp) { | |
| 151 | + String expdata = null; | |
| 152 | + | |
| 153 | + //regexpのチェック | |
| 154 | + if(regexp.isEmpty()) { | |
| 155 | + expdata = strdata; | |
| 156 | + return expdata; | |
| 157 | + } | |
| 158 | + | |
| 159 | + //正規表現検索 | |
| 160 | + Pattern ptn = Pattern.compile(regexp); | |
| 161 | + Matcher matchdata = ptn.matcher(strdata); | |
| 162 | + if (matchdata.find()) { | |
| 163 | + if(matchdata.groupCount() >= 1) { | |
| 164 | + expdata = matchdata.group(1); | |
| 165 | + } | |
| 166 | + } | |
| 167 | + return expdata; | |
| 168 | + } | |
| 169 | + | |
| 170 | + /** | |
| 171 | + * インターネット接続. | |
| 172 | + */ | |
| 173 | + public void getpageData() { | |
| 174 | + try { | |
| 175 | + URL url = new URL(UrlAdress); | |
| 176 | + HttpURLConnection con = (HttpURLConnection)url.openConnection(); | |
| 177 | + con.setRequestMethod("GET"); | |
| 178 | + BufferedReader reader = new BufferedReader( | |
| 179 | + new InputStreamReader(con.getInputStream(), "utf-8")); | |
| 180 | + String wkline; | |
| 181 | + StringBuilder sb = new StringBuilder(); | |
| 182 | + while((wkline = reader.readLine()) != null) { | |
| 183 | + sb.append(wkline).append("\n"); | |
| 184 | + } | |
| 185 | + pageData = sb.toString(); | |
| 186 | + | |
| 187 | + con.disconnect(); | |
| 188 | + } | |
| 189 | + catch(IOException e) { | |
| 190 | + System.err.println(e); | |
| 191 | + } | |
| 192 | + } | |
| 193 | + | |
| 194 | + /** | |
| 195 | + * HTMLパーサ. | |
| 196 | + * @param skey | |
| 197 | + */ | |
| 198 | + public void serchpageData(SearchData skey){ | |
| 199 | + Reader reader; | |
| 200 | + try { | |
| 201 | + reader = new BufferedReader(new StringReader(pageData)); | |
| 202 | + HtmlParserCallback cb = new HtmlParserCallback(skey); | |
| 203 | + ParserDelegator pd = new ParserDelegator(); | |
| 204 | + pd.parse(reader, cb, true); | |
| 205 | + reader.close(); | |
| 206 | + | |
| 207 | + sData = cb.getrtnData(); | |
| 208 | + | |
| 209 | + } catch (IOException e) { | |
| 210 | + System.err.println(e); | |
| 211 | + } | |
| 212 | + } | |
| 213 | + | |
| 214 | +} |
| @@ -0,0 +1,15 @@ | ||
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<project xmlns="http://www.netbeans.org/ns/project/1"> | |
| 3 | + <type>org.netbeans.modules.java.j2seproject</type> | |
| 4 | + <configuration> | |
| 5 | + <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> | |
| 6 | + <name>HtmlTest2</name> | |
| 7 | + <source-roots> | |
| 8 | + <root id="src.dir"/> | |
| 9 | + </source-roots> | |
| 10 | + <test-roots> | |
| 11 | + <root id="test.src.dir"/> | |
| 12 | + </test-roots> | |
| 13 | + </data> | |
| 14 | + </configuration> | |
| 15 | +</project> |
| @@ -0,0 +1,1413 @@ | ||
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!-- | |
| 3 | +*** GENERATED FROM project.xml - DO NOT EDIT *** | |
| 4 | +*** EDIT ../build.xml INSTEAD *** | |
| 5 | + | |
| 6 | +For the purpose of easier reading the script | |
| 7 | +is divided into following sections: | |
| 8 | + | |
| 9 | + - initialization | |
| 10 | + - compilation | |
| 11 | + - jar | |
| 12 | + - execution | |
| 13 | + - debugging | |
| 14 | + - javadoc | |
| 15 | + - test compilation | |
| 16 | + - test execution | |
| 17 | + - test debugging | |
| 18 | + - applet | |
| 19 | + - cleanup | |
| 20 | + | |
| 21 | + --> | |
| 22 | +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="HtmlTest2-impl"> | |
| 23 | + <fail message="Please build using Ant 1.8.0 or higher."> | |
| 24 | + <condition> | |
| 25 | + <not> | |
| 26 | + <antversion atleast="1.8.0"/> | |
| 27 | + </not> | |
| 28 | + </condition> | |
| 29 | + </fail> | |
| 30 | + <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/> | |
| 31 | + <!-- | |
| 32 | + ====================== | |
| 33 | + INITIALIZATION SECTION | |
| 34 | + ====================== | |
| 35 | + --> | |
| 36 | + <target name="-pre-init"> | |
| 37 | + <!-- Empty placeholder for easier customization. --> | |
| 38 | + <!-- You can override this target in the ../build.xml file. --> | |
| 39 | + </target> | |
| 40 | + <target depends="-pre-init" name="-init-private"> | |
| 41 | + <property file="nbproject/private/config.properties"/> | |
| 42 | + <property file="nbproject/private/configs/${config}.properties"/> | |
| 43 | + <property file="nbproject/private/private.properties"/> | |
| 44 | + </target> | |
| 45 | + <target depends="-pre-init,-init-private" name="-init-user"> | |
| 46 | + <property file="${user.properties.file}"/> | |
| 47 | + <!-- The two properties below are usually overridden --> | |
| 48 | + <!-- by the active platform. Just a fallback. --> | |
| 49 | + <property name="default.javac.source" value="1.4"/> | |
| 50 | + <property name="default.javac.target" value="1.4"/> | |
| 51 | + </target> | |
| 52 | + <target depends="-pre-init,-init-private,-init-user" name="-init-project"> | |
| 53 | + <property file="nbproject/configs/${config}.properties"/> | |
| 54 | + <property file="nbproject/project.properties"/> | |
| 55 | + </target> | |
| 56 | + <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init"> | |
| 57 | + <property name="platform.java" value="${java.home}/bin/java"/> | |
| 58 | + <available file="${manifest.file}" property="manifest.available"/> | |
| 59 | + <condition property="splashscreen.available"> | |
| 60 | + <and> | |
| 61 | + <not> | |
| 62 | + <equals arg1="${application.splash}" arg2="" trim="true"/> | |
| 63 | + </not> | |
| 64 | + <available file="${application.splash}"/> | |
| 65 | + </and> | |
| 66 | + </condition> | |
| 67 | + <condition property="main.class.available"> | |
| 68 | + <and> | |
| 69 | + <isset property="main.class"/> | |
| 70 | + <not> | |
| 71 | + <equals arg1="${main.class}" arg2="" trim="true"/> | |
| 72 | + </not> | |
| 73 | + </and> | |
| 74 | + </condition> | |
| 75 | + <condition property="profile.available"> | |
| 76 | + <and> | |
| 77 | + <isset property="javac.profile"/> | |
| 78 | + <length length="0" string="${javac.profile}" when="greater"/> | |
| 79 | + <matches pattern="1\.[89](\..*)?" string="${javac.source}"/> | |
| 80 | + </and> | |
| 81 | + </condition> | |
| 82 | + <condition property="do.archive"> | |
| 83 | + <or> | |
| 84 | + <not> | |
| 85 | + <istrue value="${jar.archive.disabled}"/> | |
| 86 | + </not> | |
| 87 | + <istrue value="${not.archive.disabled}"/> | |
| 88 | + </or> | |
| 89 | + </condition> | |
| 90 | + <condition property="do.mkdist"> | |
| 91 | + <and> | |
| 92 | + <isset property="do.archive"/> | |
| 93 | + <isset property="libs.CopyLibs.classpath"/> | |
| 94 | + <not> | |
| 95 | + <istrue value="${mkdist.disabled}"/> | |
| 96 | + </not> | |
| 97 | + </and> | |
| 98 | + </condition> | |
| 99 | + <condition property="do.archive+manifest.available"> | |
| 100 | + <and> | |
| 101 | + <isset property="manifest.available"/> | |
| 102 | + <istrue value="${do.archive}"/> | |
| 103 | + </and> | |
| 104 | + </condition> | |
| 105 | + <condition property="do.archive+main.class.available"> | |
| 106 | + <and> | |
| 107 | + <isset property="main.class.available"/> | |
| 108 | + <istrue value="${do.archive}"/> | |
| 109 | + </and> | |
| 110 | + </condition> | |
| 111 | + <condition property="do.archive+splashscreen.available"> | |
| 112 | + <and> | |
| 113 | + <isset property="splashscreen.available"/> | |
| 114 | + <istrue value="${do.archive}"/> | |
| 115 | + </and> | |
| 116 | + </condition> | |
| 117 | + <condition property="do.archive+profile.available"> | |
| 118 | + <and> | |
| 119 | + <isset property="profile.available"/> | |
| 120 | + <istrue value="${do.archive}"/> | |
| 121 | + </and> | |
| 122 | + </condition> | |
| 123 | + <condition property="have.tests"> | |
| 124 | + <or> | |
| 125 | + <available file="${test.src.dir}"/> | |
| 126 | + </or> | |
| 127 | + </condition> | |
| 128 | + <condition property="have.sources"> | |
| 129 | + <or> | |
| 130 | + <available file="${src.dir}"/> | |
| 131 | + </or> | |
| 132 | + </condition> | |
| 133 | + <condition property="netbeans.home+have.tests"> | |
| 134 | + <and> | |
| 135 | + <isset property="netbeans.home"/> | |
| 136 | + <isset property="have.tests"/> | |
| 137 | + </and> | |
| 138 | + </condition> | |
| 139 | + <condition property="no.javadoc.preview"> | |
| 140 | + <and> | |
| 141 | + <isset property="javadoc.preview"/> | |
| 142 | + <isfalse value="${javadoc.preview}"/> | |
| 143 | + </and> | |
| 144 | + </condition> | |
| 145 | + <property name="run.jvmargs" value=""/> | |
| 146 | + <property name="run.jvmargs.ide" value=""/> | |
| 147 | + <property name="javac.compilerargs" value=""/> | |
| 148 | + <property name="work.dir" value="${basedir}"/> | |
| 149 | + <condition property="no.deps"> | |
| 150 | + <and> | |
| 151 | + <istrue value="${no.dependencies}"/> | |
| 152 | + </and> | |
| 153 | + </condition> | |
| 154 | + <property name="javac.debug" value="true"/> | |
| 155 | + <property name="javadoc.preview" value="true"/> | |
| 156 | + <property name="application.args" value=""/> | |
| 157 | + <property name="source.encoding" value="${file.encoding}"/> | |
| 158 | + <property name="runtime.encoding" value="${source.encoding}"/> | |
| 159 | + <condition property="javadoc.encoding.used" value="${javadoc.encoding}"> | |
| 160 | + <and> | |
| 161 | + <isset property="javadoc.encoding"/> | |
| 162 | + <not> | |
| 163 | + <equals arg1="${javadoc.encoding}" arg2=""/> | |
| 164 | + </not> | |
| 165 | + </and> | |
| 166 | + </condition> | |
| 167 | + <property name="javadoc.encoding.used" value="${source.encoding}"/> | |
| 168 | + <property name="includes" value="**"/> | |
| 169 | + <property name="excludes" value=""/> | |
| 170 | + <property name="do.depend" value="false"/> | |
| 171 | + <condition property="do.depend.true"> | |
| 172 | + <istrue value="${do.depend}"/> | |
| 173 | + </condition> | |
| 174 | + <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> | |
| 175 | + <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'"> | |
| 176 | + <and> | |
| 177 | + <isset property="endorsed.classpath"/> | |
| 178 | + <not> | |
| 179 | + <equals arg1="${endorsed.classpath}" arg2="" trim="true"/> | |
| 180 | + </not> | |
| 181 | + </and> | |
| 182 | + </condition> | |
| 183 | + <condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}"> | |
| 184 | + <isset property="profile.available"/> | |
| 185 | + </condition> | |
| 186 | + <condition else="false" property="jdkBug6558476"> | |
| 187 | + <and> | |
| 188 | + <matches pattern="1\.[56]" string="${java.specification.version}"/> | |
| 189 | + <not> | |
| 190 | + <os family="unix"/> | |
| 191 | + </not> | |
| 192 | + </and> | |
| 193 | + </condition> | |
| 194 | + <property name="javac.fork" value="${jdkBug6558476}"/> | |
| 195 | + <property name="jar.index" value="false"/> | |
| 196 | + <property name="jar.index.metainf" value="${jar.index}"/> | |
| 197 | + <property name="copylibs.rebase" value="true"/> | |
| 198 | + <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/> | |
| 199 | + <condition property="junit.available"> | |
| 200 | + <or> | |
| 201 | + <available classname="org.junit.Test" classpath="${run.test.classpath}"/> | |
| 202 | + <available classname="junit.framework.Test" classpath="${run.test.classpath}"/> | |
| 203 | + </or> | |
| 204 | + </condition> | |
| 205 | + <condition property="testng.available"> | |
| 206 | + <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/> | |
| 207 | + </condition> | |
| 208 | + <condition property="junit+testng.available"> | |
| 209 | + <and> | |
| 210 | + <istrue value="${junit.available}"/> | |
| 211 | + <istrue value="${testng.available}"/> | |
| 212 | + </and> | |
| 213 | + </condition> | |
| 214 | + <condition else="testng" property="testng.mode" value="mixed"> | |
| 215 | + <istrue value="${junit+testng.available}"/> | |
| 216 | + </condition> | |
| 217 | + <condition else="" property="testng.debug.mode" value="-mixed"> | |
| 218 | + <istrue value="${junit+testng.available}"/> | |
| 219 | + </condition> | |
| 220 | + </target> | |
| 221 | + <target name="-post-init"> | |
| 222 | + <!-- Empty placeholder for easier customization. --> | |
| 223 | + <!-- You can override this target in the ../build.xml file. --> | |
| 224 | + </target> | |
| 225 | + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check"> | |
| 226 | + <fail unless="src.dir">Must set src.dir</fail> | |
| 227 | + <fail unless="test.src.dir">Must set test.src.dir</fail> | |
| 228 | + <fail unless="build.dir">Must set build.dir</fail> | |
| 229 | + <fail unless="dist.dir">Must set dist.dir</fail> | |
| 230 | + <fail unless="build.classes.dir">Must set build.classes.dir</fail> | |
| 231 | + <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail> | |
| 232 | + <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail> | |
| 233 | + <fail unless="build.test.results.dir">Must set build.test.results.dir</fail> | |
| 234 | + <fail unless="build.classes.excludes">Must set build.classes.excludes</fail> | |
| 235 | + <fail unless="dist.jar">Must set dist.jar</fail> | |
| 236 | + </target> | |
| 237 | + <target name="-init-macrodef-property"> | |
| 238 | + <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
| 239 | + <attribute name="name"/> | |
| 240 | + <attribute name="value"/> | |
| 241 | + <sequential> | |
| 242 | + <property name="@{name}" value="${@{value}}"/> | |
| 243 | + </sequential> | |
| 244 | + </macrodef> | |
| 245 | + </target> | |
| 246 | + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors"> | |
| 247 | + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 248 | + <attribute default="${src.dir}" name="srcdir"/> | |
| 249 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
| 250 | + <attribute default="${javac.classpath}" name="classpath"/> | |
| 251 | + <attribute default="${javac.processorpath}" name="processorpath"/> | |
| 252 | + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> | |
| 253 | + <attribute default="${includes}" name="includes"/> | |
| 254 | + <attribute default="${excludes}" name="excludes"/> | |
| 255 | + <attribute default="${javac.debug}" name="debug"/> | |
| 256 | + <attribute default="${empty.dir}" name="sourcepath"/> | |
| 257 | + <attribute default="${empty.dir}" name="gensrcdir"/> | |
| 258 | + <element name="customize" optional="true"/> | |
| 259 | + <sequential> | |
| 260 | + <property location="${build.dir}/empty" name="empty.dir"/> | |
| 261 | + <mkdir dir="${empty.dir}"/> | |
| 262 | + <mkdir dir="@{apgeneratedsrcdir}"/> | |
| 263 | + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> | |
| 264 | + <src> | |
| 265 | + <dirset dir="@{gensrcdir}" erroronmissingdir="false"> | |
| 266 | + <include name="*"/> | |
| 267 | + </dirset> | |
| 268 | + </src> | |
| 269 | + <classpath> | |
| 270 | + <path path="@{classpath}"/> | |
| 271 | + </classpath> | |
| 272 | + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> | |
| 273 | + <compilerarg line="${javac.profile.cmd.line.arg}"/> | |
| 274 | + <compilerarg line="${javac.compilerargs}"/> | |
| 275 | + <compilerarg value="-processorpath"/> | |
| 276 | + <compilerarg path="@{processorpath}:${empty.dir}"/> | |
| 277 | + <compilerarg line="${ap.processors.internal}"/> | |
| 278 | + <compilerarg line="${annotation.processing.processor.options}"/> | |
| 279 | + <compilerarg value="-s"/> | |
| 280 | + <compilerarg path="@{apgeneratedsrcdir}"/> | |
| 281 | + <compilerarg line="${ap.proc.none.internal}"/> | |
| 282 | + <customize/> | |
| 283 | + </javac> | |
| 284 | + </sequential> | |
| 285 | + </macrodef> | |
| 286 | + </target> | |
| 287 | + <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal"> | |
| 288 | + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 289 | + <attribute default="${src.dir}" name="srcdir"/> | |
| 290 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
| 291 | + <attribute default="${javac.classpath}" name="classpath"/> | |
| 292 | + <attribute default="${javac.processorpath}" name="processorpath"/> | |
| 293 | + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> | |
| 294 | + <attribute default="${includes}" name="includes"/> | |
| 295 | + <attribute default="${excludes}" name="excludes"/> | |
| 296 | + <attribute default="${javac.debug}" name="debug"/> | |
| 297 | + <attribute default="${empty.dir}" name="sourcepath"/> | |
| 298 | + <attribute default="${empty.dir}" name="gensrcdir"/> | |
| 299 | + <element name="customize" optional="true"/> | |
| 300 | + <sequential> | |
| 301 | + <property location="${build.dir}/empty" name="empty.dir"/> | |
| 302 | + <mkdir dir="${empty.dir}"/> | |
| 303 | + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> | |
| 304 | + <src> | |
| 305 | + <dirset dir="@{gensrcdir}" erroronmissingdir="false"> | |
| 306 | + <include name="*"/> | |
| 307 | + </dirset> | |
| 308 | + </src> | |
| 309 | + <classpath> | |
| 310 | + <path path="@{classpath}"/> | |
| 311 | + </classpath> | |
| 312 | + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> | |
| 313 | + <compilerarg line="${javac.profile.cmd.line.arg}"/> | |
| 314 | + <compilerarg line="${javac.compilerargs}"/> | |
| 315 | + <customize/> | |
| 316 | + </javac> | |
| 317 | + </sequential> | |
| 318 | + </macrodef> | |
| 319 | + </target> | |
| 320 | + <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac"> | |
| 321 | + <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 322 | + <attribute default="${src.dir}" name="srcdir"/> | |
| 323 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
| 324 | + <attribute default="${javac.classpath}" name="classpath"/> | |
| 325 | + <sequential> | |
| 326 | + <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}"> | |
| 327 | + <classpath> | |
| 328 | + <path path="@{classpath}"/> | |
| 329 | + </classpath> | |
| 330 | + </depend> | |
| 331 | + </sequential> | |
| 332 | + </macrodef> | |
| 333 | + <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 334 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
| 335 | + <sequential> | |
| 336 | + <fail unless="javac.includes">Must set javac.includes</fail> | |
| 337 | + <pathconvert pathsep="${line.separator}" property="javac.includes.binary"> | |
| 338 | + <path> | |
| 339 | + <filelist dir="@{destdir}" files="${javac.includes}"/> | |
| 340 | + </path> | |
| 341 | + <globmapper from="*.java" to="*.class"/> | |
| 342 | + </pathconvert> | |
| 343 | + <tempfile deleteonexit="true" property="javac.includesfile.binary"/> | |
| 344 | + <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/> | |
| 345 | + <delete> | |
| 346 | + <files includesfile="${javac.includesfile.binary}"/> | |
| 347 | + </delete> | |
| 348 | + <delete> | |
| 349 | + <fileset file="${javac.includesfile.binary}"/> | |
| 350 | + </delete> | |
| 351 | + </sequential> | |
| 352 | + </macrodef> | |
| 353 | + </target> | |
| 354 | + <target if="${junit.available}" name="-init-macrodef-junit-init"> | |
| 355 | + <condition else="false" property="nb.junit.batch" value="true"> | |
| 356 | + <and> | |
| 357 | + <istrue value="${junit.available}"/> | |
| 358 | + <not> | |
| 359 | + <isset property="test.method"/> | |
| 360 | + </not> | |
| 361 | + </and> | |
| 362 | + </condition> | |
| 363 | + <condition else="false" property="nb.junit.single" value="true"> | |
| 364 | + <and> | |
| 365 | + <istrue value="${junit.available}"/> | |
| 366 | + <isset property="test.method"/> | |
| 367 | + </and> | |
| 368 | + </condition> | |
| 369 | + </target> | |
| 370 | + <target name="-init-test-properties"> | |
| 371 | + <property name="test.binaryincludes" value="<nothing>"/> | |
| 372 | + <property name="test.binarytestincludes" value=""/> | |
| 373 | + <property name="test.binaryexcludes" value=""/> | |
| 374 | + </target> | |
| 375 | + <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}"> | |
| 376 | + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 377 | + <attribute default="${includes}" name="includes"/> | |
| 378 | + <attribute default="${excludes}" name="excludes"/> | |
| 379 | + <attribute default="**" name="testincludes"/> | |
| 380 | + <attribute default="" name="testmethods"/> | |
| 381 | + <element name="customize" optional="true"/> | |
| 382 | + <sequential> | |
| 383 | + <property name="junit.forkmode" value="perTest"/> | |
| 384 | + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> | |
| 385 | + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> | |
| 386 | + <syspropertyset> | |
| 387 | + <propertyref prefix="test-sys-prop."/> | |
| 388 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
| 389 | + </syspropertyset> | |
| 390 | + <formatter type="brief" usefile="false"/> | |
| 391 | + <formatter type="xml"/> | |
| 392 | + <jvmarg value="-ea"/> | |
| 393 | + <customize/> | |
| 394 | + </junit> | |
| 395 | + </sequential> | |
| 396 | + </macrodef> | |
| 397 | + </target> | |
| 398 | + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}"> | |
| 399 | + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 400 | + <attribute default="${includes}" name="includes"/> | |
| 401 | + <attribute default="${excludes}" name="excludes"/> | |
| 402 | + <attribute default="**" name="testincludes"/> | |
| 403 | + <attribute default="" name="testmethods"/> | |
| 404 | + <element name="customize" optional="true"/> | |
| 405 | + <sequential> | |
| 406 | + <property name="junit.forkmode" value="perTest"/> | |
| 407 | + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> | |
| 408 | + <batchtest todir="${build.test.results.dir}"> | |
| 409 | + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> | |
| 410 | + <filename name="@{testincludes}"/> | |
| 411 | + </fileset> | |
| 412 | + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> | |
| 413 | + <filename name="${test.binarytestincludes}"/> | |
| 414 | + </fileset> | |
| 415 | + </batchtest> | |
| 416 | + <syspropertyset> | |
| 417 | + <propertyref prefix="test-sys-prop."/> | |
| 418 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
| 419 | + </syspropertyset> | |
| 420 | + <formatter type="brief" usefile="false"/> | |
| 421 | + <formatter type="xml"/> | |
| 422 | + <jvmarg value="-ea"/> | |
| 423 | + <customize/> | |
| 424 | + </junit> | |
| 425 | + </sequential> | |
| 426 | + </macrodef> | |
| 427 | + </target> | |
| 428 | + <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/> | |
| 429 | + <target if="${testng.available}" name="-init-macrodef-testng"> | |
| 430 | + <macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 431 | + <attribute default="${includes}" name="includes"/> | |
| 432 | + <attribute default="${excludes}" name="excludes"/> | |
| 433 | + <attribute default="**" name="testincludes"/> | |
| 434 | + <attribute default="" name="testmethods"/> | |
| 435 | + <element name="customize" optional="true"/> | |
| 436 | + <sequential> | |
| 437 | + <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}"> | |
| 438 | + <isset property="test.method"/> | |
| 439 | + </condition> | |
| 440 | + <union id="test.set"> | |
| 441 | + <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}"> | |
| 442 | + <filename name="@{testincludes}"/> | |
| 443 | + </fileset> | |
| 444 | + </union> | |
| 445 | + <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/> | |
| 446 | + <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="HtmlTest2" testname="TestNG tests" workingDir="${work.dir}"> | |
| 447 | + <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> | |
| 448 | + <propertyset> | |
| 449 | + <propertyref prefix="test-sys-prop."/> | |
| 450 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
| 451 | + </propertyset> | |
| 452 | + <customize/> | |
| 453 | + </testng> | |
| 454 | + </sequential> | |
| 455 | + </macrodef> | |
| 456 | + </target> | |
| 457 | + <target name="-init-macrodef-test-impl"> | |
| 458 | + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 459 | + <attribute default="${includes}" name="includes"/> | |
| 460 | + <attribute default="${excludes}" name="excludes"/> | |
| 461 | + <attribute default="**" name="testincludes"/> | |
| 462 | + <attribute default="" name="testmethods"/> | |
| 463 | + <element implicit="true" name="customize" optional="true"/> | |
| 464 | + <sequential> | |
| 465 | + <echo>No tests executed.</echo> | |
| 466 | + </sequential> | |
| 467 | + </macrodef> | |
| 468 | + </target> | |
| 469 | + <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl"> | |
| 470 | + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 471 | + <attribute default="${includes}" name="includes"/> | |
| 472 | + <attribute default="${excludes}" name="excludes"/> | |
| 473 | + <attribute default="**" name="testincludes"/> | |
| 474 | + <attribute default="" name="testmethods"/> | |
| 475 | + <element implicit="true" name="customize" optional="true"/> | |
| 476 | + <sequential> | |
| 477 | + <j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
| 478 | + <customize/> | |
| 479 | + </j2seproject3:junit> | |
| 480 | + </sequential> | |
| 481 | + </macrodef> | |
| 482 | + </target> | |
| 483 | + <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl"> | |
| 484 | + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 485 | + <attribute default="${includes}" name="includes"/> | |
| 486 | + <attribute default="${excludes}" name="excludes"/> | |
| 487 | + <attribute default="**" name="testincludes"/> | |
| 488 | + <attribute default="" name="testmethods"/> | |
| 489 | + <element implicit="true" name="customize" optional="true"/> | |
| 490 | + <sequential> | |
| 491 | + <j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
| 492 | + <customize/> | |
| 493 | + </j2seproject3:testng> | |
| 494 | + </sequential> | |
| 495 | + </macrodef> | |
| 496 | + </target> | |
| 497 | + <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test"> | |
| 498 | + <macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 499 | + <attribute default="${includes}" name="includes"/> | |
| 500 | + <attribute default="${excludes}" name="excludes"/> | |
| 501 | + <attribute default="**" name="testincludes"/> | |
| 502 | + <attribute default="" name="testmethods"/> | |
| 503 | + <sequential> | |
| 504 | + <j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
| 505 | + <customize> | |
| 506 | + <classpath> | |
| 507 | + <path path="${run.test.classpath}"/> | |
| 508 | + </classpath> | |
| 509 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
| 510 | + <jvmarg line="${run.jvmargs}"/> | |
| 511 | + <jvmarg line="${run.jvmargs.ide}"/> | |
| 512 | + </customize> | |
| 513 | + </j2seproject3:test-impl> | |
| 514 | + </sequential> | |
| 515 | + </macrodef> | |
| 516 | + </target> | |
| 517 | + <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}"> | |
| 518 | + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 519 | + <attribute default="${includes}" name="includes"/> | |
| 520 | + <attribute default="${excludes}" name="excludes"/> | |
| 521 | + <attribute default="**" name="testincludes"/> | |
| 522 | + <attribute default="" name="testmethods"/> | |
| 523 | + <element name="customize" optional="true"/> | |
| 524 | + <sequential> | |
| 525 | + <property name="junit.forkmode" value="perTest"/> | |
| 526 | + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> | |
| 527 | + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> | |
| 528 | + <syspropertyset> | |
| 529 | + <propertyref prefix="test-sys-prop."/> | |
| 530 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
| 531 | + </syspropertyset> | |
| 532 | + <formatter type="brief" usefile="false"/> | |
| 533 | + <formatter type="xml"/> | |
| 534 | + <jvmarg value="-ea"/> | |
| 535 | + <jvmarg line="${debug-args-line}"/> | |
| 536 | + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> | |
| 537 | + <customize/> | |
| 538 | + </junit> | |
| 539 | + </sequential> | |
| 540 | + </macrodef> | |
| 541 | + </target> | |
| 542 | + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch"> | |
| 543 | + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 544 | + <attribute default="${includes}" name="includes"/> | |
| 545 | + <attribute default="${excludes}" name="excludes"/> | |
| 546 | + <attribute default="**" name="testincludes"/> | |
| 547 | + <attribute default="" name="testmethods"/> | |
| 548 | + <element name="customize" optional="true"/> | |
| 549 | + <sequential> | |
| 550 | + <property name="junit.forkmode" value="perTest"/> | |
| 551 | + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> | |
| 552 | + <batchtest todir="${build.test.results.dir}"> | |
| 553 | + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> | |
| 554 | + <filename name="@{testincludes}"/> | |
| 555 | + </fileset> | |
| 556 | + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> | |
| 557 | + <filename name="${test.binarytestincludes}"/> | |
| 558 | + </fileset> | |
| 559 | + </batchtest> | |
| 560 | + <syspropertyset> | |
| 561 | + <propertyref prefix="test-sys-prop."/> | |
| 562 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
| 563 | + </syspropertyset> | |
| 564 | + <formatter type="brief" usefile="false"/> | |
| 565 | + <formatter type="xml"/> | |
| 566 | + <jvmarg value="-ea"/> | |
| 567 | + <jvmarg line="${debug-args-line}"/> | |
| 568 | + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> | |
| 569 | + <customize/> | |
| 570 | + </junit> | |
| 571 | + </sequential> | |
| 572 | + </macrodef> | |
| 573 | + </target> | |
| 574 | + <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl"> | |
| 575 | + <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 576 | + <attribute default="${includes}" name="includes"/> | |
| 577 | + <attribute default="${excludes}" name="excludes"/> | |
| 578 | + <attribute default="**" name="testincludes"/> | |
| 579 | + <attribute default="" name="testmethods"/> | |
| 580 | + <element implicit="true" name="customize" optional="true"/> | |
| 581 | + <sequential> | |
| 582 | + <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
| 583 | + <customize/> | |
| 584 | + </j2seproject3:junit-debug> | |
| 585 | + </sequential> | |
| 586 | + </macrodef> | |
| 587 | + </target> | |
| 588 | + <target if="${testng.available}" name="-init-macrodef-testng-debug"> | |
| 589 | + <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 590 | + <attribute default="${main.class}" name="testClass"/> | |
| 591 | + <attribute default="" name="testMethod"/> | |
| 592 | + <element name="customize2" optional="true"/> | |
| 593 | + <sequential> | |
| 594 | + <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}"> | |
| 595 | + <isset property="test.method"/> | |
| 596 | + </condition> | |
| 597 | + <condition else="-suitename HtmlTest2 -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}"> | |
| 598 | + <matches pattern=".*\.xml" string="@{testClass}"/> | |
| 599 | + </condition> | |
| 600 | + <delete dir="${build.test.results.dir}" quiet="true"/> | |
| 601 | + <mkdir dir="${build.test.results.dir}"/> | |
| 602 | + <j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}"> | |
| 603 | + <customize> | |
| 604 | + <customize2/> | |
| 605 | + <jvmarg value="-ea"/> | |
| 606 | + <arg line="${testng.debug.mode}"/> | |
| 607 | + <arg line="-d ${build.test.results.dir}"/> | |
| 608 | + <arg line="-listener org.testng.reporters.VerboseReporter"/> | |
| 609 | + <arg line="${testng.cmd.args}"/> | |
| 610 | + </customize> | |
| 611 | + </j2seproject3:debug> | |
| 612 | + </sequential> | |
| 613 | + </macrodef> | |
| 614 | + </target> | |
| 615 | + <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl"> | |
| 616 | + <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 617 | + <attribute default="${main.class}" name="testClass"/> | |
| 618 | + <attribute default="" name="testMethod"/> | |
| 619 | + <element implicit="true" name="customize2" optional="true"/> | |
| 620 | + <sequential> | |
| 621 | + <j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}"> | |
| 622 | + <customize2/> | |
| 623 | + </j2seproject3:testng-debug> | |
| 624 | + </sequential> | |
| 625 | + </macrodef> | |
| 626 | + </target> | |
| 627 | + <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit"> | |
| 628 | + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 629 | + <attribute default="${includes}" name="includes"/> | |
| 630 | + <attribute default="${excludes}" name="excludes"/> | |
| 631 | + <attribute default="**" name="testincludes"/> | |
| 632 | + <attribute default="" name="testmethods"/> | |
| 633 | + <attribute default="${main.class}" name="testClass"/> | |
| 634 | + <attribute default="" name="testMethod"/> | |
| 635 | + <sequential> | |
| 636 | + <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
| 637 | + <customize> | |
| 638 | + <classpath> | |
| 639 | + <path path="${run.test.classpath}"/> | |
| 640 | + </classpath> | |
| 641 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
| 642 | + <jvmarg line="${run.jvmargs}"/> | |
| 643 | + <jvmarg line="${run.jvmargs.ide}"/> | |
| 644 | + </customize> | |
| 645 | + </j2seproject3:test-debug-impl> | |
| 646 | + </sequential> | |
| 647 | + </macrodef> | |
| 648 | + </target> | |
| 649 | + <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng"> | |
| 650 | + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 651 | + <attribute default="${includes}" name="includes"/> | |
| 652 | + <attribute default="${excludes}" name="excludes"/> | |
| 653 | + <attribute default="**" name="testincludes"/> | |
| 654 | + <attribute default="" name="testmethods"/> | |
| 655 | + <attribute default="${main.class}" name="testClass"/> | |
| 656 | + <attribute default="" name="testMethod"/> | |
| 657 | + <sequential> | |
| 658 | + <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}"> | |
| 659 | + <customize2> | |
| 660 | + <syspropertyset> | |
| 661 | + <propertyref prefix="test-sys-prop."/> | |
| 662 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
| 663 | + </syspropertyset> | |
| 664 | + </customize2> | |
| 665 | + </j2seproject3:testng-debug-impl> | |
| 666 | + </sequential> | |
| 667 | + </macrodef> | |
| 668 | + </target> | |
| 669 | + <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/> | |
| 670 | + <!-- | |
| 671 | + pre NB7.2 profiling section; consider it deprecated | |
| 672 | + --> | |
| 673 | + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/> | |
| 674 | + <target if="profiler.info.jvmargs.agent" name="-profile-pre-init"> | |
| 675 | + <!-- Empty placeholder for easier customization. --> | |
| 676 | + <!-- You can override this target in the ../build.xml file. --> | |
| 677 | + </target> | |
| 678 | + <target if="profiler.info.jvmargs.agent" name="-profile-post-init"> | |
| 679 | + <!-- Empty placeholder for easier customization. --> | |
| 680 | + <!-- You can override this target in the ../build.xml file. --> | |
| 681 | + </target> | |
| 682 | + <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile"> | |
| 683 | + <macrodef name="resolve"> | |
| 684 | + <attribute name="name"/> | |
| 685 | + <attribute name="value"/> | |
| 686 | + <sequential> | |
| 687 | + <property name="@{name}" value="${env.@{value}}"/> | |
| 688 | + </sequential> | |
| 689 | + </macrodef> | |
| 690 | + <macrodef name="profile"> | |
| 691 | + <attribute default="${main.class}" name="classname"/> | |
| 692 | + <element name="customize" optional="true"/> | |
| 693 | + <sequential> | |
| 694 | + <property environment="env"/> | |
| 695 | + <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/> | |
| 696 | + <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}"> | |
| 697 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
| 698 | + <jvmarg value="${profiler.info.jvmargs.agent}"/> | |
| 699 | + <jvmarg line="${profiler.info.jvmargs}"/> | |
| 700 | + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> | |
| 701 | + <arg line="${application.args}"/> | |
| 702 | + <classpath> | |
| 703 | + <path path="${run.classpath}"/> | |
| 704 | + </classpath> | |
| 705 | + <syspropertyset> | |
| 706 | + <propertyref prefix="run-sys-prop."/> | |
| 707 | + <mapper from="run-sys-prop.*" to="*" type="glob"/> | |
| 708 | + </syspropertyset> | |
| 709 | + <customize/> | |
| 710 | + </java> | |
| 711 | + </sequential> | |
| 712 | + </macrodef> | |
| 713 | + </target> | |
| 714 | + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check"> | |
| 715 | + <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail> | |
| 716 | + <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail> | |
| 717 | + </target> | |
| 718 | + <!-- | |
| 719 | + end of pre NB7.2 profiling section | |
| 720 | + --> | |
| 721 | + <target depends="-init-debug-args" name="-init-macrodef-nbjpda"> | |
| 722 | + <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
| 723 | + <attribute default="${main.class}" name="name"/> | |
| 724 | + <attribute default="${debug.classpath}" name="classpath"/> | |
| 725 | + <attribute default="" name="stopclassname"/> | |
| 726 | + <sequential> | |
| 727 | + <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}"> | |
| 728 | + <classpath> | |
| 729 | + <path path="@{classpath}"/> | |
| 730 | + </classpath> | |
| 731 | + </nbjpdastart> | |
| 732 | + </sequential> | |
| 733 | + </macrodef> | |
| 734 | + <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
| 735 | + <attribute default="${build.classes.dir}" name="dir"/> | |
| 736 | + <sequential> | |
| 737 | + <nbjpdareload> | |
| 738 | + <fileset dir="@{dir}" includes="${fix.classes}"> | |
| 739 | + <include name="${fix.includes}*.class"/> | |
| 740 | + </fileset> | |
| 741 | + </nbjpdareload> | |
| 742 | + </sequential> | |
| 743 | + </macrodef> | |
| 744 | + </target> | |
| 745 | + <target name="-init-debug-args"> | |
| 746 | + <property name="version-output" value="java version "${ant.java.version}"/> | |
| 747 | + <condition property="have-jdk-older-than-1.4"> | |
| 748 | + <or> | |
| 749 | + <contains string="${version-output}" substring="java version "1.0"/> | |
| 750 | + <contains string="${version-output}" substring="java version "1.1"/> | |
| 751 | + <contains string="${version-output}" substring="java version "1.2"/> | |
| 752 | + <contains string="${version-output}" substring="java version "1.3"/> | |
| 753 | + </or> | |
| 754 | + </condition> | |
| 755 | + <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none"> | |
| 756 | + <istrue value="${have-jdk-older-than-1.4}"/> | |
| 757 | + </condition> | |
| 758 | + <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem"> | |
| 759 | + <os family="windows"/> | |
| 760 | + </condition> | |
| 761 | + <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}"> | |
| 762 | + <isset property="debug.transport"/> | |
| 763 | + </condition> | |
| 764 | + </target> | |
| 765 | + <target depends="-init-debug-args" name="-init-macrodef-debug"> | |
| 766 | + <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 767 | + <attribute default="${main.class}" name="classname"/> | |
| 768 | + <attribute default="${debug.classpath}" name="classpath"/> | |
| 769 | + <element name="customize" optional="true"/> | |
| 770 | + <sequential> | |
| 771 | + <java classname="@{classname}" dir="${work.dir}" fork="true"> | |
| 772 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
| 773 | + <jvmarg line="${debug-args-line}"/> | |
| 774 | + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> | |
| 775 | + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> | |
| 776 | + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> | |
| 777 | + <jvmarg line="${run.jvmargs}"/> | |
| 778 | + <jvmarg line="${run.jvmargs.ide}"/> | |
| 779 | + <classpath> | |
| 780 | + <path path="@{classpath}"/> | |
| 781 | + </classpath> | |
| 782 | + <syspropertyset> | |
| 783 | + <propertyref prefix="run-sys-prop."/> | |
| 784 | + <mapper from="run-sys-prop.*" to="*" type="glob"/> | |
| 785 | + </syspropertyset> | |
| 786 | + <customize/> | |
| 787 | + </java> | |
| 788 | + </sequential> | |
| 789 | + </macrodef> | |
| 790 | + </target> | |
| 791 | + <target name="-init-macrodef-java"> | |
| 792 | + <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
| 793 | + <attribute default="${main.class}" name="classname"/> | |
| 794 | + <attribute default="${run.classpath}" name="classpath"/> | |
| 795 | + <attribute default="jvm" name="jvm"/> | |
| 796 | + <element name="customize" optional="true"/> | |
| 797 | + <sequential> | |
| 798 | + <java classname="@{classname}" dir="${work.dir}" fork="true"> | |
| 799 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
| 800 | + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> | |
| 801 | + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> | |
| 802 | + <jvmarg line="${run.jvmargs}"/> | |
| 803 | + <jvmarg line="${run.jvmargs.ide}"/> | |
| 804 | + <classpath> | |
| 805 | + <path path="@{classpath}"/> | |
| 806 | + </classpath> | |
| 807 | + <syspropertyset> | |
| 808 | + <propertyref prefix="run-sys-prop."/> | |
| 809 | + <mapper from="run-sys-prop.*" to="*" type="glob"/> | |
| 810 | + </syspropertyset> | |
| 811 | + <customize/> | |
| 812 | + </java> | |
| 813 | + </sequential> | |
| 814 | + </macrodef> | |
| 815 | + </target> | |
| 816 | + <target name="-init-macrodef-copylibs"> | |
| 817 | + <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 818 | + <attribute default="${manifest.file}" name="manifest"/> | |
| 819 | + <element name="customize" optional="true"/> | |
| 820 | + <sequential> | |
| 821 | + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> | |
| 822 | + <pathconvert property="run.classpath.without.build.classes.dir"> | |
| 823 | + <path path="${run.classpath}"/> | |
| 824 | + <map from="${build.classes.dir.resolved}" to=""/> | |
| 825 | + </pathconvert> | |
| 826 | + <pathconvert pathsep=" " property="jar.classpath"> | |
| 827 | + <path path="${run.classpath.without.build.classes.dir}"/> | |
| 828 | + <chainedmapper> | |
| 829 | + <flattenmapper/> | |
| 830 | + <filtermapper> | |
| 831 | + <replacestring from=" " to="%20"/> | |
| 832 | + </filtermapper> | |
| 833 | + <globmapper from="*" to="lib/*"/> | |
| 834 | + </chainedmapper> | |
| 835 | + </pathconvert> | |
| 836 | + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> | |
| 837 | + <copylibs compress="${jar.compress}" excludeFromCopy="${copylibs.excludes}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> | |
| 838 | + <fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> | |
| 839 | + <manifest> | |
| 840 | + <attribute name="Class-Path" value="${jar.classpath}"/> | |
| 841 | + <customize/> | |
| 842 | + </manifest> | |
| 843 | + </copylibs> | |
| 844 | + </sequential> | |
| 845 | + </macrodef> | |
| 846 | + </target> | |
| 847 | + <target name="-init-presetdef-jar"> | |
| 848 | + <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
| 849 | + <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}"> | |
| 850 | + <j2seproject1:fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> | |
| 851 | + </jar> | |
| 852 | + </presetdef> | |
| 853 | + </target> | |
| 854 | + <target name="-init-ap-cmdline-properties"> | |
| 855 | + <property name="annotation.processing.enabled" value="true"/> | |
| 856 | + <property name="annotation.processing.processors.list" value=""/> | |
| 857 | + <property name="annotation.processing.processor.options" value=""/> | |
| 858 | + <property name="annotation.processing.run.all.processors" value="true"/> | |
| 859 | + <property name="javac.processorpath" value="${javac.classpath}"/> | |
| 860 | + <property name="javac.test.processorpath" value="${javac.test.classpath}"/> | |
| 861 | + <condition property="ap.supported.internal" value="true"> | |
| 862 | + <not> | |
| 863 | + <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/> | |
| 864 | + </not> | |
| 865 | + </condition> | |
| 866 | + </target> | |
| 867 | + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported"> | |
| 868 | + <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}"> | |
| 869 | + <isfalse value="${annotation.processing.run.all.processors}"/> | |
| 870 | + </condition> | |
| 871 | + <condition else="" property="ap.proc.none.internal" value="-proc:none"> | |
| 872 | + <isfalse value="${annotation.processing.enabled}"/> | |
| 873 | + </condition> | |
| 874 | + </target> | |
| 875 | + <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline"> | |
| 876 | + <property name="ap.cmd.line.internal" value=""/> | |
| 877 | + </target> | |
| 878 | + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/> | |
| 879 | + <!-- | |
| 880 | + =================== | |
| 881 | + COMPILATION SECTION | |
| 882 | + =================== | |
| 883 | + --> | |
| 884 | + <target name="-deps-jar-init" unless="built-jar.properties"> | |
| 885 | + <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/> | |
| 886 | + <delete file="${built-jar.properties}" quiet="true"/> | |
| 887 | + </target> | |
| 888 | + <target if="already.built.jar.${basedir}" name="-warn-already-built-jar"> | |
| 889 | + <echo level="warn" message="Cycle detected: HtmlTest2 was already built"/> | |
| 890 | + </target> | |
| 891 | + <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps"> | |
| 892 | + <mkdir dir="${build.dir}"/> | |
| 893 | + <touch file="${built-jar.properties}" verbose="false"/> | |
| 894 | + <property file="${built-jar.properties}" prefix="already.built.jar."/> | |
| 895 | + <antcall target="-warn-already-built-jar"/> | |
| 896 | + <propertyfile file="${built-jar.properties}"> | |
| 897 | + <entry key="${basedir}" value=""/> | |
| 898 | + </propertyfile> | |
| 899 | + </target> | |
| 900 | + <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/> | |
| 901 | + <target depends="init" name="-check-automatic-build"> | |
| 902 | + <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/> | |
| 903 | + </target> | |
| 904 | + <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build"> | |
| 905 | + <antcall target="clean"/> | |
| 906 | + </target> | |
| 907 | + <target depends="init,deps-jar" name="-pre-pre-compile"> | |
| 908 | + <mkdir dir="${build.classes.dir}"/> | |
| 909 | + </target> | |
| 910 | + <target name="-pre-compile"> | |
| 911 | + <!-- Empty placeholder for easier customization. --> | |
| 912 | + <!-- You can override this target in the ../build.xml file. --> | |
| 913 | + </target> | |
| 914 | + <target if="do.depend.true" name="-compile-depend"> | |
| 915 | + <pathconvert property="build.generated.subdirs"> | |
| 916 | + <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false"> | |
| 917 | + <include name="*"/> | |
| 918 | + </dirset> | |
| 919 | + </pathconvert> | |
| 920 | + <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/> | |
| 921 | + </target> | |
| 922 | + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile"> | |
| 923 | + <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/> | |
| 924 | + <copy todir="${build.classes.dir}"> | |
| 925 | + <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> | |
| 926 | + </copy> | |
| 927 | + </target> | |
| 928 | + <target if="has.persistence.xml" name="-copy-persistence-xml"> | |
| 929 | + <mkdir dir="${build.classes.dir}/META-INF"/> | |
| 930 | + <copy todir="${build.classes.dir}/META-INF"> | |
| 931 | + <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/> | |
| 932 | + </copy> | |
| 933 | + </target> | |
| 934 | + <target name="-post-compile"> | |
| 935 | + <!-- Empty placeholder for easier customization. --> | |
| 936 | + <!-- You can override this target in the ../build.xml file. --> | |
| 937 | + </target> | |
| 938 | + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/> | |
| 939 | + <target name="-pre-compile-single"> | |
| 940 | + <!-- Empty placeholder for easier customization. --> | |
| 941 | + <!-- You can override this target in the ../build.xml file. --> | |
| 942 | + </target> | |
| 943 | + <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single"> | |
| 944 | + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> | |
| 945 | + <j2seproject3:force-recompile/> | |
| 946 | + <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/> | |
| 947 | + </target> | |
| 948 | + <target name="-post-compile-single"> | |
| 949 | + <!-- Empty placeholder for easier customization. --> | |
| 950 | + <!-- You can override this target in the ../build.xml file. --> | |
| 951 | + </target> | |
| 952 | + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/> | |
| 953 | + <!-- | |
| 954 | + ==================== | |
| 955 | + JAR BUILDING SECTION | |
| 956 | + ==================== | |
| 957 | + --> | |
| 958 | + <target depends="init" name="-pre-pre-jar"> | |
| 959 | + <dirname file="${dist.jar}" property="dist.jar.dir"/> | |
| 960 | + <mkdir dir="${dist.jar.dir}"/> | |
| 961 | + </target> | |
| 962 | + <target name="-pre-jar"> | |
| 963 | + <!-- Empty placeholder for easier customization. --> | |
| 964 | + <!-- You can override this target in the ../build.xml file. --> | |
| 965 | + </target> | |
| 966 | + <target depends="init" if="do.archive" name="-do-jar-create-manifest" unless="manifest.available"> | |
| 967 | + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> | |
| 968 | + <touch file="${tmp.manifest.file}" verbose="false"/> | |
| 969 | + </target> | |
| 970 | + <target depends="init" if="do.archive+manifest.available" name="-do-jar-copy-manifest"> | |
| 971 | + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> | |
| 972 | + <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/> | |
| 973 | + </target> | |
| 974 | + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+main.class.available" name="-do-jar-set-mainclass"> | |
| 975 | + <manifest file="${tmp.manifest.file}" mode="update"> | |
| 976 | + <attribute name="Main-Class" value="${main.class}"/> | |
| 977 | + </manifest> | |
| 978 | + </target> | |
| 979 | + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+profile.available" name="-do-jar-set-profile"> | |
| 980 | + <manifest file="${tmp.manifest.file}" mode="update"> | |
| 981 | + <attribute name="Profile" value="${javac.profile}"/> | |
| 982 | + </manifest> | |
| 983 | + </target> | |
| 984 | + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-set-splashscreen"> | |
| 985 | + <basename file="${application.splash}" property="splashscreen.basename"/> | |
| 986 | + <mkdir dir="${build.classes.dir}/META-INF"/> | |
| 987 | + <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/> | |
| 988 | + <manifest file="${tmp.manifest.file}" mode="update"> | |
| 989 | + <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/> | |
| 990 | + </manifest> | |
| 991 | + </target> | |
| 992 | + <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.mkdist" name="-do-jar-copylibs"> | |
| 993 | + <j2seproject3:copylibs manifest="${tmp.manifest.file}"/> | |
| 994 | + <echo level="info">To run this application from the command line without Ant, try:</echo> | |
| 995 | + <property location="${dist.jar}" name="dist.jar.resolved"/> | |
| 996 | + <echo level="info">java -jar "${dist.jar.resolved}"</echo> | |
| 997 | + </target> | |
| 998 | + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.archive" name="-do-jar-jar" unless="do.mkdist"> | |
| 999 | + <j2seproject1:jar manifest="${tmp.manifest.file}"/> | |
| 1000 | + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> | |
| 1001 | + <property location="${dist.jar}" name="dist.jar.resolved"/> | |
| 1002 | + <pathconvert property="run.classpath.with.dist.jar"> | |
| 1003 | + <path path="${run.classpath}"/> | |
| 1004 | + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> | |
| 1005 | + </pathconvert> | |
| 1006 | + <condition else="" property="jar.usage.message" value="To run this application from the command line without Ant, try:${line.separator}${platform.java} -cp ${run.classpath.with.dist.jar} ${main.class}"> | |
| 1007 | + <isset property="main.class.available"/> | |
| 1008 | + </condition> | |
| 1009 | + <condition else="debug" property="jar.usage.level" value="info"> | |
| 1010 | + <isset property="main.class.available"/> | |
| 1011 | + </condition> | |
| 1012 | + <echo level="${jar.usage.level}" message="${jar.usage.message}"/> | |
| 1013 | + </target> | |
| 1014 | + <target depends="-do-jar-copylibs" if="do.archive" name="-do-jar-delete-manifest"> | |
| 1015 | + <delete> | |
| 1016 | + <fileset file="${tmp.manifest.file}"/> | |
| 1017 | + </delete> | |
| 1018 | + </target> | |
| 1019 | + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-jar,-do-jar-delete-manifest" name="-do-jar-without-libraries"/> | |
| 1020 | + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-copylibs,-do-jar-delete-manifest" name="-do-jar-with-libraries"/> | |
| 1021 | + <target name="-post-jar"> | |
| 1022 | + <!-- Empty placeholder for easier customization. --> | |
| 1023 | + <!-- You can override this target in the ../build.xml file. --> | |
| 1024 | + </target> | |
| 1025 | + <target depends="init,compile,-pre-jar,-do-jar-without-libraries,-do-jar-with-libraries,-post-jar" name="-do-jar"/> | |
| 1026 | + <target depends="init,compile,-pre-jar,-do-jar,-post-jar" description="Build JAR." name="jar"/> | |
| 1027 | + <!-- | |
| 1028 | + ================= | |
| 1029 | + EXECUTION SECTION | |
| 1030 | + ================= | |
| 1031 | + --> | |
| 1032 | + <target depends="init,compile" description="Run a main class." name="run"> | |
| 1033 | + <j2seproject1:java> | |
| 1034 | + <customize> | |
| 1035 | + <arg line="${application.args}"/> | |
| 1036 | + </customize> | |
| 1037 | + </j2seproject1:java> | |
| 1038 | + </target> | |
| 1039 | + <target name="-do-not-recompile"> | |
| 1040 | + <property name="javac.includes.binary" value=""/> | |
| 1041 | + </target> | |
| 1042 | + <target depends="init,compile-single" name="run-single"> | |
| 1043 | + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> | |
| 1044 | + <j2seproject1:java classname="${run.class}"/> | |
| 1045 | + </target> | |
| 1046 | + <target depends="init,compile-test-single" name="run-test-with-main"> | |
| 1047 | + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> | |
| 1048 | + <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/> | |
| 1049 | + </target> | |
| 1050 | + <!-- | |
| 1051 | + ================= | |
| 1052 | + DEBUGGING SECTION | |
| 1053 | + ================= | |
| 1054 | + --> | |
| 1055 | + <target depends="init" if="netbeans.home" name="-debug-start-debugger"> | |
| 1056 | + <j2seproject1:nbjpdastart name="${debug.class}"/> | |
| 1057 | + </target> | |
| 1058 | + <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test"> | |
| 1059 | + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/> | |
| 1060 | + </target> | |
| 1061 | + <target depends="init,compile" name="-debug-start-debuggee"> | |
| 1062 | + <j2seproject3:debug> | |
| 1063 | + <customize> | |
| 1064 | + <arg line="${application.args}"/> | |
| 1065 | + </customize> | |
| 1066 | + </j2seproject3:debug> | |
| 1067 | + </target> | |
| 1068 | + <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/> | |
| 1069 | + <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto"> | |
| 1070 | + <j2seproject1:nbjpdastart stopclassname="${main.class}"/> | |
| 1071 | + </target> | |
| 1072 | + <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/> | |
| 1073 | + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single"> | |
| 1074 | + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> | |
| 1075 | + <j2seproject3:debug classname="${debug.class}"/> | |
| 1076 | + </target> | |
| 1077 | + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/> | |
| 1078 | + <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test"> | |
| 1079 | + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> | |
| 1080 | + <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/> | |
| 1081 | + </target> | |
| 1082 | + <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/> | |
| 1083 | + <target depends="init" name="-pre-debug-fix"> | |
| 1084 | + <fail unless="fix.includes">Must set fix.includes</fail> | |
| 1085 | + <property name="javac.includes" value="${fix.includes}.java"/> | |
| 1086 | + </target> | |
| 1087 | + <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix"> | |
| 1088 | + <j2seproject1:nbjpdareload/> | |
| 1089 | + </target> | |
| 1090 | + <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/> | |
| 1091 | + <!-- | |
| 1092 | + ================= | |
| 1093 | + PROFILING SECTION | |
| 1094 | + ================= | |
| 1095 | + --> | |
| 1096 | + <!-- | |
| 1097 | + pre NB7.2 profiler integration | |
| 1098 | + --> | |
| 1099 | + <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72"> | |
| 1100 | + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> | |
| 1101 | + <nbprofiledirect> | |
| 1102 | + <classpath> | |
| 1103 | + <path path="${run.classpath}"/> | |
| 1104 | + </classpath> | |
| 1105 | + </nbprofiledirect> | |
| 1106 | + <profile/> | |
| 1107 | + </target> | |
| 1108 | + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72"> | |
| 1109 | + <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail> | |
| 1110 | + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> | |
| 1111 | + <nbprofiledirect> | |
| 1112 | + <classpath> | |
| 1113 | + <path path="${run.classpath}"/> | |
| 1114 | + </classpath> | |
| 1115 | + </nbprofiledirect> | |
| 1116 | + <profile classname="${profile.class}"/> | |
| 1117 | + </target> | |
| 1118 | + <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72"> | |
| 1119 | + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> | |
| 1120 | + <nbprofiledirect> | |
| 1121 | + <classpath> | |
| 1122 | + <path path="${run.classpath}"/> | |
| 1123 | + </classpath> | |
| 1124 | + </nbprofiledirect> | |
| 1125 | + <profile classname="sun.applet.AppletViewer"> | |
| 1126 | + <customize> | |
| 1127 | + <arg value="${applet.url}"/> | |
| 1128 | + </customize> | |
| 1129 | + </profile> | |
| 1130 | + </target> | |
| 1131 | + <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72"> | |
| 1132 | + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> | |
| 1133 | + <nbprofiledirect> | |
| 1134 | + <classpath> | |
| 1135 | + <path path="${run.test.classpath}"/> | |
| 1136 | + </classpath> | |
| 1137 | + </nbprofiledirect> | |
| 1138 | + <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true"> | |
| 1139 | + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> | |
| 1140 | + <jvmarg value="${profiler.info.jvmargs.agent}"/> | |
| 1141 | + <jvmarg line="${profiler.info.jvmargs}"/> | |
| 1142 | + <test name="${profile.class}"/> | |
| 1143 | + <classpath> | |
| 1144 | + <path path="${run.test.classpath}"/> | |
| 1145 | + </classpath> | |
| 1146 | + <syspropertyset> | |
| 1147 | + <propertyref prefix="test-sys-prop."/> | |
| 1148 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
| 1149 | + </syspropertyset> | |
| 1150 | + <formatter type="brief" usefile="false"/> | |
| 1151 | + <formatter type="xml"/> | |
| 1152 | + </junit> | |
| 1153 | + </target> | |
| 1154 | + <!-- | |
| 1155 | + end of pre NB72 profiling section | |
| 1156 | + --> | |
| 1157 | + <target if="netbeans.home" name="-profile-check"> | |
| 1158 | + <condition property="profiler.configured"> | |
| 1159 | + <or> | |
| 1160 | + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/> | |
| 1161 | + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/> | |
| 1162 | + </or> | |
| 1163 | + </condition> | |
| 1164 | + </target> | |
| 1165 | + <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent"> | |
| 1166 | + <startprofiler/> | |
| 1167 | + <antcall target="run"/> | |
| 1168 | + </target> | |
| 1169 | + <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent"> | |
| 1170 | + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> | |
| 1171 | + <startprofiler/> | |
| 1172 | + <antcall target="run-single"/> | |
| 1173 | + </target> | |
| 1174 | + <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/> | |
| 1175 | + <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs"> | |
| 1176 | + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> | |
| 1177 | + <startprofiler/> | |
| 1178 | + <antcall target="test-single"/> | |
| 1179 | + </target> | |
| 1180 | + <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main"> | |
| 1181 | + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> | |
| 1182 | + <startprofiler/> | |
| 1183 | + <antcal target="run-test-with-main"/> | |
| 1184 | + </target> | |
| 1185 | + <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent"> | |
| 1186 | + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> | |
| 1187 | + <startprofiler/> | |
| 1188 | + <antcall target="run-applet"/> | |
| 1189 | + </target> | |
| 1190 | + <!-- | |
| 1191 | + =============== | |
| 1192 | + JAVADOC SECTION | |
| 1193 | + =============== | |
| 1194 | + --> | |
| 1195 | + <target depends="init" if="have.sources" name="-javadoc-build"> | |
| 1196 | + <mkdir dir="${dist.javadoc.dir}"/> | |
| 1197 | + <condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}"> | |
| 1198 | + <and> | |
| 1199 | + <isset property="endorsed.classpath.cmd.line.arg"/> | |
| 1200 | + <not> | |
| 1201 | + <equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/> | |
| 1202 | + </not> | |
| 1203 | + </and> | |
| 1204 | + </condition> | |
| 1205 | + <condition else="" property="bug5101868workaround" value="*.java"> | |
| 1206 | + <matches pattern="1\.[56](\..*)?" string="${java.version}"/> | |
| 1207 | + </condition> | |
| 1208 | + <javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"> | |
| 1209 | + <classpath> | |
| 1210 | + <path path="${javac.classpath}"/> | |
| 1211 | + </classpath> | |
| 1212 | + <fileset dir="${src.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}"> | |
| 1213 | + <filename name="**/*.java"/> | |
| 1214 | + </fileset> | |
| 1215 | + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> | |
| 1216 | + <include name="**/*.java"/> | |
| 1217 | + <exclude name="*.java"/> | |
| 1218 | + </fileset> | |
| 1219 | + <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/> | |
| 1220 | + </javadoc> | |
| 1221 | + <copy todir="${dist.javadoc.dir}"> | |
| 1222 | + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> | |
| 1223 | + <filename name="**/doc-files/**"/> | |
| 1224 | + </fileset> | |
| 1225 | + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> | |
| 1226 | + <include name="**/doc-files/**"/> | |
| 1227 | + </fileset> | |
| 1228 | + </copy> | |
| 1229 | + </target> | |
| 1230 | + <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview"> | |
| 1231 | + <nbbrowse file="${dist.javadoc.dir}/index.html"/> | |
| 1232 | + </target> | |
| 1233 | + <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/> | |
| 1234 | + <!-- | |
| 1235 | + ========================= | |
| 1236 | + TEST COMPILATION SECTION | |
| 1237 | + ========================= | |
| 1238 | + --> | |
| 1239 | + <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test"> | |
| 1240 | + <mkdir dir="${build.test.classes.dir}"/> | |
| 1241 | + </target> | |
| 1242 | + <target name="-pre-compile-test"> | |
| 1243 | + <!-- Empty placeholder for easier customization. --> | |
| 1244 | + <!-- You can override this target in the ../build.xml file. --> | |
| 1245 | + </target> | |
| 1246 | + <target if="do.depend.true" name="-compile-test-depend"> | |
| 1247 | + <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/> | |
| 1248 | + </target> | |
| 1249 | + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test"> | |
| 1250 | + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/> | |
| 1251 | + <copy todir="${build.test.classes.dir}"> | |
| 1252 | + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> | |
| 1253 | + </copy> | |
| 1254 | + </target> | |
| 1255 | + <target name="-post-compile-test"> | |
| 1256 | + <!-- Empty placeholder for easier customization. --> | |
| 1257 | + <!-- You can override this target in the ../build.xml file. --> | |
| 1258 | + </target> | |
| 1259 | + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/> | |
| 1260 | + <target name="-pre-compile-test-single"> | |
| 1261 | + <!-- Empty placeholder for easier customization. --> | |
| 1262 | + <!-- You can override this target in the ../build.xml file. --> | |
| 1263 | + </target> | |
| 1264 | + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single"> | |
| 1265 | + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> | |
| 1266 | + <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/> | |
| 1267 | + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/> | |
| 1268 | + <copy todir="${build.test.classes.dir}"> | |
| 1269 | + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> | |
| 1270 | + </copy> | |
| 1271 | + </target> | |
| 1272 | + <target name="-post-compile-test-single"> | |
| 1273 | + <!-- Empty placeholder for easier customization. --> | |
| 1274 | + <!-- You can override this target in the ../build.xml file. --> | |
| 1275 | + </target> | |
| 1276 | + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/> | |
| 1277 | + <!-- | |
| 1278 | + ======================= | |
| 1279 | + TEST EXECUTION SECTION | |
| 1280 | + ======================= | |
| 1281 | + --> | |
| 1282 | + <target depends="init" if="have.tests" name="-pre-test-run"> | |
| 1283 | + <mkdir dir="${build.test.results.dir}"/> | |
| 1284 | + </target> | |
| 1285 | + <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run"> | |
| 1286 | + <j2seproject3:test includes="${includes}" testincludes="**/*Test.java"/> | |
| 1287 | + </target> | |
| 1288 | + <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run"> | |
| 1289 | + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> | |
| 1290 | + </target> | |
| 1291 | + <target depends="init" if="have.tests" name="test-report"/> | |
| 1292 | + <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/> | |
| 1293 | + <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/> | |
| 1294 | + <target depends="init" if="have.tests" name="-pre-test-run-single"> | |
| 1295 | + <mkdir dir="${build.test.results.dir}"/> | |
| 1296 | + </target> | |
| 1297 | + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single"> | |
| 1298 | + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> | |
| 1299 | + <j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/> | |
| 1300 | + </target> | |
| 1301 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single"> | |
| 1302 | + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> | |
| 1303 | + </target> | |
| 1304 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/> | |
| 1305 | + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method"> | |
| 1306 | + <fail unless="test.class">Must select some files in the IDE or set test.class</fail> | |
| 1307 | + <fail unless="test.method">Must select some method in the IDE or set test.method</fail> | |
| 1308 | + <j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/> | |
| 1309 | + </target> | |
| 1310 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method"> | |
| 1311 | + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> | |
| 1312 | + </target> | |
| 1313 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/> | |
| 1314 | + <!-- | |
| 1315 | + ======================= | |
| 1316 | + TEST DEBUGGING SECTION | |
| 1317 | + ======================= | |
| 1318 | + --> | |
| 1319 | + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test"> | |
| 1320 | + <fail unless="test.class">Must select one file in the IDE or set test.class</fail> | |
| 1321 | + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/> | |
| 1322 | + </target> | |
| 1323 | + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method"> | |
| 1324 | + <fail unless="test.class">Must select one file in the IDE or set test.class</fail> | |
| 1325 | + <fail unless="test.method">Must select some method in the IDE or set test.method</fail> | |
| 1326 | + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/> | |
| 1327 | + </target> | |
| 1328 | + <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test"> | |
| 1329 | + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/> | |
| 1330 | + </target> | |
| 1331 | + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/> | |
| 1332 | + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/> | |
| 1333 | + <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test"> | |
| 1334 | + <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/> | |
| 1335 | + </target> | |
| 1336 | + <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/> | |
| 1337 | + <!-- | |
| 1338 | + ========================= | |
| 1339 | + APPLET EXECUTION SECTION | |
| 1340 | + ========================= | |
| 1341 | + --> | |
| 1342 | + <target depends="init,compile-single" name="run-applet"> | |
| 1343 | + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> | |
| 1344 | + <j2seproject1:java classname="sun.applet.AppletViewer"> | |
| 1345 | + <customize> | |
| 1346 | + <arg value="${applet.url}"/> | |
| 1347 | + </customize> | |
| 1348 | + </j2seproject1:java> | |
| 1349 | + </target> | |
| 1350 | + <!-- | |
| 1351 | + ========================= | |
| 1352 | + APPLET DEBUGGING SECTION | |
| 1353 | + ========================= | |
| 1354 | + --> | |
| 1355 | + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet"> | |
| 1356 | + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> | |
| 1357 | + <j2seproject3:debug classname="sun.applet.AppletViewer"> | |
| 1358 | + <customize> | |
| 1359 | + <arg value="${applet.url}"/> | |
| 1360 | + </customize> | |
| 1361 | + </j2seproject3:debug> | |
| 1362 | + </target> | |
| 1363 | + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/> | |
| 1364 | + <!-- | |
| 1365 | + =============== | |
| 1366 | + CLEANUP SECTION | |
| 1367 | + =============== | |
| 1368 | + --> | |
| 1369 | + <target name="-deps-clean-init" unless="built-clean.properties"> | |
| 1370 | + <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/> | |
| 1371 | + <delete file="${built-clean.properties}" quiet="true"/> | |
| 1372 | + </target> | |
| 1373 | + <target if="already.built.clean.${basedir}" name="-warn-already-built-clean"> | |
| 1374 | + <echo level="warn" message="Cycle detected: HtmlTest2 was already built"/> | |
| 1375 | + </target> | |
| 1376 | + <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps"> | |
| 1377 | + <mkdir dir="${build.dir}"/> | |
| 1378 | + <touch file="${built-clean.properties}" verbose="false"/> | |
| 1379 | + <property file="${built-clean.properties}" prefix="already.built.clean."/> | |
| 1380 | + <antcall target="-warn-already-built-clean"/> | |
| 1381 | + <propertyfile file="${built-clean.properties}"> | |
| 1382 | + <entry key="${basedir}" value=""/> | |
| 1383 | + </propertyfile> | |
| 1384 | + </target> | |
| 1385 | + <target depends="init" name="-do-clean"> | |
| 1386 | + <delete dir="${build.dir}"/> | |
| 1387 | + <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/> | |
| 1388 | + </target> | |
| 1389 | + <target name="-post-clean"> | |
| 1390 | + <!-- Empty placeholder for easier customization. --> | |
| 1391 | + <!-- You can override this target in the ../build.xml file. --> | |
| 1392 | + </target> | |
| 1393 | + <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/> | |
| 1394 | + <target name="-check-call-dep"> | |
| 1395 | + <property file="${call.built.properties}" prefix="already.built."/> | |
| 1396 | + <condition property="should.call.dep"> | |
| 1397 | + <and> | |
| 1398 | + <not> | |
| 1399 | + <isset property="already.built.${call.subproject}"/> | |
| 1400 | + </not> | |
| 1401 | + <available file="${call.script}"/> | |
| 1402 | + </and> | |
| 1403 | + </condition> | |
| 1404 | + </target> | |
| 1405 | + <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep"> | |
| 1406 | + <ant antfile="${call.script}" inheritall="false" target="${call.target}"> | |
| 1407 | + <propertyset> | |
| 1408 | + <propertyref prefix="transfer."/> | |
| 1409 | + <mapper from="transfer.*" to="*" type="glob"/> | |
| 1410 | + </propertyset> | |
| 1411 | + </ant> | |
| 1412 | + </target> | |
| 1413 | +</project> |
| @@ -0,0 +1,3 @@ | ||
| 1 | +Manifest-Version: 1.0 | |
| 2 | +X-COMMENT: Main-Class will be added automatically by build | |
| 3 | + |
| @@ -0,0 +1,73 @@ | ||
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!-- You may freely edit this file. See commented blocks below for --> | |
| 3 | +<!-- some examples of how to customize the build. --> | |
| 4 | +<!-- (If you delete it and reopen the project it will be recreated.) --> | |
| 5 | +<!-- By default, only the Clean and Build commands use this build script. --> | |
| 6 | +<!-- Commands such as Run, Debug, and Test only use this build script if --> | |
| 7 | +<!-- the Compile on Save feature is turned off for the project. --> | |
| 8 | +<!-- You can turn off the Compile on Save (or Deploy on Save) setting --> | |
| 9 | +<!-- in the project's Project Properties dialog box.--> | |
| 10 | +<project name="HtmlTest2" default="default" basedir="."> | |
| 11 | + <description>Builds, tests, and runs the project HtmlTest2.</description> | |
| 12 | + <import file="nbproject/build-impl.xml"/> | |
| 13 | + <!-- | |
| 14 | + | |
| 15 | + There exist several targets which are by default empty and which can be | |
| 16 | + used for execution of your tasks. These targets are usually executed | |
| 17 | + before and after some main targets. They are: | |
| 18 | + | |
| 19 | + -pre-init: called before initialization of project properties | |
| 20 | + -post-init: called after initialization of project properties | |
| 21 | + -pre-compile: called before javac compilation | |
| 22 | + -post-compile: called after javac compilation | |
| 23 | + -pre-compile-single: called before javac compilation of single file | |
| 24 | + -post-compile-single: called after javac compilation of single file | |
| 25 | + -pre-compile-test: called before javac compilation of JUnit tests | |
| 26 | + -post-compile-test: called after javac compilation of JUnit tests | |
| 27 | + -pre-compile-test-single: called before javac compilation of single JUnit test | |
| 28 | + -post-compile-test-single: called after javac compilation of single JUunit test | |
| 29 | + -pre-jar: called before JAR building | |
| 30 | + -post-jar: called after JAR building | |
| 31 | + -post-clean: called after cleaning build products | |
| 32 | + | |
| 33 | + (Targets beginning with '-' are not intended to be called on their own.) | |
| 34 | + | |
| 35 | + Example of inserting an obfuscator after compilation could look like this: | |
| 36 | + | |
| 37 | + <target name="-post-compile"> | |
| 38 | + <obfuscate> | |
| 39 | + <fileset dir="${build.classes.dir}"/> | |
| 40 | + </obfuscate> | |
| 41 | + </target> | |
| 42 | + | |
| 43 | + For list of available properties check the imported | |
| 44 | + nbproject/build-impl.xml file. | |
| 45 | + | |
| 46 | + | |
| 47 | + Another way to customize the build is by overriding existing main targets. | |
| 48 | + The targets of interest are: | |
| 49 | + | |
| 50 | + -init-macrodef-javac: defines macro for javac compilation | |
| 51 | + -init-macrodef-junit: defines macro for junit execution | |
| 52 | + -init-macrodef-debug: defines macro for class debugging | |
| 53 | + -init-macrodef-java: defines macro for class execution | |
| 54 | + -do-jar: JAR building | |
| 55 | + run: execution of project | |
| 56 | + -javadoc-build: Javadoc generation | |
| 57 | + test-report: JUnit report generation | |
| 58 | + | |
| 59 | + An example of overriding the target for project execution could look like this: | |
| 60 | + | |
| 61 | + <target name="run" depends="HtmlTest2-impl.jar"> | |
| 62 | + <exec dir="bin" executable="launcher.exe"> | |
| 63 | + <arg file="${dist.jar}"/> | |
| 64 | + </exec> | |
| 65 | + </target> | |
| 66 | + | |
| 67 | + Notice that the overridden target depends on the jar target and not only on | |
| 68 | + the compile target as the regular run target does. Again, for a list of available | |
| 69 | + properties which you can use, check the target you are overriding in the | |
| 70 | + nbproject/build-impl.xml file. | |
| 71 | + | |
| 72 | + --> | |
| 73 | +</project> |