001
014
015 package com.liferay.util.ant;
016
017 import java.io.File;
018
019 import org.apache.tools.ant.Project;
020 import org.apache.tools.ant.taskdefs.UpToDate;
021
022
025 public class UpToDateTask {
026
027 public static boolean isUpToDate(File source, File target) {
028 if (!source.exists() || !target.exists()) {
029 return false;
030 }
031
032 Project project = AntUtil.getProject();
033
034 UpToDate upToDate = new UpToDate();
035
036 upToDate.setProject(project);
037 upToDate.setProperty("uptodate");
038 upToDate.setSrcfile(source);
039 upToDate.setTargetFile(target);
040
041 upToDate.execute();
042
043 if (project.getProperty("uptodate") != null) {
044 return true;
045 }
046 else {
047 return false;
048 }
049 }
050
051 public static boolean isUpToDate(String source, String target) {
052 return isUpToDate(new File(source), new File(target));
053 }
054
055 }