]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Java/Source/Cpptasks/net/sf/antcontrib/cpptasks/CCTaskProgressMonitor.java
Added code to check if "cmd" attribute is valid or not. This is to make error report...
[mirror_edk2.git] / Tools / Java / Source / Cpptasks / net / sf / antcontrib / cpptasks / CCTaskProgressMonitor.java
1 /*
2 *
3 * Copyright 2001-2004 The Ant-Contrib project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package net.sf.antcontrib.cpptasks;
18 import java.io.IOException;
19
20 import net.sf.antcontrib.cpptasks.compiler.ProcessorConfiguration;
21 import net.sf.antcontrib.cpptasks.compiler.ProgressMonitor;
22 public class CCTaskProgressMonitor implements ProgressMonitor {
23 private ProcessorConfiguration config;
24 private TargetHistoryTable history;
25 private long lastCommit = -1;
26 public CCTaskProgressMonitor(TargetHistoryTable history) {
27 this.history = history;
28 }
29 public void finish(ProcessorConfiguration config, boolean normal) {
30 long current = System.currentTimeMillis();
31 if ((current - lastCommit) > 120000) {
32 try {
33 history.commit();
34 lastCommit = System.currentTimeMillis();
35 } catch (IOException ex) {
36 }
37 }
38 }
39 public void progress(String[] sources) {
40 history.update(config, sources);
41 long current = System.currentTimeMillis();
42 if ((current - lastCommit) > 120000) {
43 try {
44 history.commit();
45 lastCommit = current;
46 } catch (IOException ex) {
47 }
48 }
49 }
50 public void start(ProcessorConfiguration config) {
51 if (lastCommit < 0) {
52 lastCommit = System.currentTimeMillis();
53 }
54 this.config = config;
55 }
56 }