annotate lib/mod/src/de/masters_of_disaster/ant/tasks/deb/Deb.java @ 33:3d86f0391168

Work on improving the build system.
author David Barts <davidb@stashtea.com>
date Fri, 24 Apr 2020 19:45:57 -0700
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
33
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
1 package de.masters_of_disaster.ant.tasks.deb;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
2
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
3 import de.masters_of_disaster.ant.tasks.ar.Ar;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
4 import de.masters_of_disaster.ant.tasks.ar.Ar.ArFileSet;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
5 import java.io.File;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
6 import java.util.Enumeration;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
7 import java.util.Vector;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
8 import org.apache.tools.ant.BuildException;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
9 import org.apache.tools.ant.Project;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
10 import org.apache.tools.ant.Task;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
11 import org.apache.tools.ant.taskdefs.Checksum;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
12 import org.apache.tools.ant.taskdefs.Echo;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
13 import org.apache.tools.ant.taskdefs.Echo.EchoLevel;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
14 import org.apache.tools.ant.taskdefs.Mkdir;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
15 import org.apache.tools.ant.taskdefs.MatchingTask;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
16 import org.apache.tools.ant.taskdefs.Tar;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
17 import org.apache.tools.ant.taskdefs.Tar.TarCompressionMethod;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
18 import org.apache.tools.ant.taskdefs.Tar.TarFileSet;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
19 import org.apache.tools.ant.util.FileUtils;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
20 import org.apache.tools.ant.util.MergingMapper;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
21 import org.apache.tools.ant.util.SourceFileScanner;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
22
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
23 /**
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
24 * Creates a deb package.
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
25 *
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
26 * @ant.task category="packaging"
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
27 */
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
28 public class Deb extends MatchingTask {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
29 Vector controlFileSets = new Vector();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
30 Vector dataFileSets = new Vector();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
31 File baseDir;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
32 File destFile;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
33 File tempDir;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
34 boolean deleteTempFiles = true;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
35 boolean includeMd5sums = false;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
36 Tar controlTarGz = new Tar();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
37 Tar dataTarGz = new Tar();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
38 Ar debPackage = new Ar();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
39
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
40 {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
41 fileset = dataTarGz.createTarFileSet();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
42 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
43
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
44 /**
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
45 * Add a new fileset for the control files with the option to specify permissions
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
46 *
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
47 * @return the tar fileset to be used as the nested element.
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
48 */
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
49 public TarFileSet createControlFileSet() {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
50 TarFileSet fileSet = controlTarGz.createTarFileSet();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
51 controlFileSets.addElement(fileSet);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
52 return fileSet;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
53 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
54
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
55 /**
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
56 * Add a new fileset for the data files with the option to specify permissions
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
57 *
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
58 * @return the tar fileset to be used as the nested element.
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
59 */
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
60 public TarFileSet createDataFileSet() {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
61 TarFileSet fileSet = dataTarGz.createTarFileSet();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
62 dataFileSets.addElement(fileSet);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
63 return fileSet;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
64 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
65
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
66 /**
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
67 * Set the name/location of where to create the deb file.
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
68 *
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
69 * @param destFile The output of the deb
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
70 */
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
71 public void setDestFile(File destFile) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
72 this.destFile = destFile;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
73 debPackage.setDestFile(destFile);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
74 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
75
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
76 /**
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
77 * This is the base directory to look in for things to include in the data files.
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
78 *
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
79 * @param baseDir the base directory.
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
80 */
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
81 public void setBaseDir(File baseDir) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
82 this.baseDir = baseDir;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
83 fileset.setDir(baseDir);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
84 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
85
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
86 /**
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
87 * This is the temp directory where to create the temporary files.
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
88 * If not set, the current projects baseDir is used.
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
89 *
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
90 * @param tempDir the temp directory.
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
91 */
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
92 public void setTempDir(File tempDir) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
93 this.tempDir = tempDir;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
94 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
95
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
96 /**
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
97 * This specifies if the temporary files should get deleted.
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
98 *
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
99 * @param deleteTempFiles whether to delete the temporary files or not.
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
100 */
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
101 public void setDeleteTempFiles(boolean deleteTempFiles) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
102 this.deleteTempFiles = deleteTempFiles;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
103 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
104
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
105 /**
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
106 * This specifies if the MD5 sums of the files in the data section should be
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
107 * included in the file "md5sums" in the control section.
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
108 *
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
109 * @param includeMd5sums whether to include MD5 sums in the control section or not.
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
110 */
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
111 public void setIncludeMd5sums(boolean includeMd5sums) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
112 this.includeMd5sums = includeMd5sums;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
113 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
114
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
115 /**
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
116 * do the business
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
117 *
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
118 * @throws BuildException on error
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
119 */
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
120 public void execute() throws BuildException {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
121 prepareTask(controlTarGz);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
122 prepareTask(dataTarGz);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
123 prepareTask(debPackage);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
124 TarFileSet tarFileSet = controlTarGz.createTarFileSet();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
125 tarFileSet.setFile(new File(System.getProperty("user.dir")));
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
126 tarFileSet.setUserName("root");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
127 tarFileSet.setGroup("root");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
128 tarFileSet.setFullpath("./");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
129 tarFileSet = dataTarGz.createTarFileSet();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
130 tarFileSet.setFile(new File(System.getProperty("user.dir")));
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
131 tarFileSet.setUserName("root");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
132 tarFileSet.setGroup("root");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
133 tarFileSet.setFullpath("./");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
134
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
135 if (null == tempDir) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
136 tempDir = getProject().getBaseDir();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
137 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
138
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
139 if (null != baseDir) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
140 // add the main fileset to the list of filesets to process.
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
141 dataFileSets.addElement(fileset);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
142 } else {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
143 fileset.setDir(new File(System.getProperty("user.dir")));
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
144 fileset.setExcludes("**");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
145 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
146
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
147 boolean controlFound = false;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
148 for (Enumeration e=controlFileSets.elements() ; e.hasMoreElements() ; ) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
149 TarFileSet fileSet = (TarFileSet)e.nextElement();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
150 String[] files = fileSet.getFiles(getProject());
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
151 int i = 0;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
152 int c;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
153
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
154 for (c=files.length ; i<c && !controlFound ; i++) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
155 if (files[i].endsWith("control")
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
156 && (new File(fileSet.getDir(getProject()),files[i])).isFile()) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
157 controlFound = true;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
158 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
159 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
160 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
161 if (!controlFound) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
162 throw new BuildException("The control fileset must contain a file \"control\"", getLocation());
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
163 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
164
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
165 // check if deb is out of date with respect to each fileset
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
166 boolean upToDate = true;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
167 for (Enumeration e=controlFileSets.elements() ; e.hasMoreElements() ; ) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
168 TarFileSet fileSet = (TarFileSet)e.nextElement();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
169 String[] files = fileSet.getFiles(getProject());
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
170
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
171 if (!packageIsUpToDate(files,fileSet.getDir(getProject()))) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
172 upToDate = false;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
173 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
174 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
175
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
176 for (Enumeration e=dataFileSets.elements() ; e.hasMoreElements() ; ) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
177 TarFileSet fileSet = (TarFileSet)e.nextElement();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
178 String[] files = fileSet.getFiles(getProject());
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
179
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
180 if (!packageIsUpToDate(files,fileSet.getDir(getProject()))) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
181 upToDate = false;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
182 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
183 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
184
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
185 if (upToDate) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
186 log("Nothing to do: " + destFile.getAbsolutePath()
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
187 + " is up to date.", Project.MSG_INFO);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
188 return;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
189 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
190
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
191 log("Building deb: " + destFile.getAbsolutePath(), Project.MSG_INFO);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
192
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
193 Mkdir mkdir = new Mkdir();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
194 prepareTask(mkdir);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
195 mkdir.setDir(tempDir);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
196 mkdir.perform();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
197
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
198 EchoLevel echoLevel = new EchoLevel();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
199 echoLevel.setValue("error");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
200 File debianBinaryFile = new File(tempDir,"debian-binary");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
201 Echo echo = new Echo();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
202 prepareTask(echo);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
203 echo.setFile(debianBinaryFile);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
204 echo.setLevel(echoLevel);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
205 echo.setMessage("2.0\n");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
206 echo.perform();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
207
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
208 for (Enumeration e=controlFileSets.elements() ; e.hasMoreElements() ; ) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
209 TarFileSet fileSet = (TarFileSet)e.nextElement();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
210 String prefix = fileSet.getPrefix();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
211 String fullpath = fileSet.getFullpath();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
212 if ("".equals(fullpath) && !prefix.startsWith("./")) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
213 if (prefix.startsWith("/")) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
214 fileSet.setPrefix("." + prefix);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
215 } else {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
216 fileSet.setPrefix("./" + prefix);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
217 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
218 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
219 if ((fullpath.length() > 0) && !fullpath.startsWith("./")) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
220 fileSet.setPrefix("");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
221 if (fullpath.startsWith("/")) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
222 fileSet.setFullpath("." + fullpath);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
223 } else {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
224 fileSet.setFullpath("./" + fullpath);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
225 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
226 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
227 if ((0 == fileSet.getUid()) && ("" == fileSet.getUserName())) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
228 fileSet.setUserName("root");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
229 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
230 if ((0 == fileSet.getGid()) && ("" == fileSet.getGroup())) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
231 fileSet.setGroup("root");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
232 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
233 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
234
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
235 for (Enumeration e=dataFileSets.elements() ; e.hasMoreElements() ; ) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
236 TarFileSet fileSet = (TarFileSet)e.nextElement();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
237 String prefix = fileSet.getPrefix();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
238 String fullpath = fileSet.getFullpath();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
239 if ("".equals(fullpath) && !prefix.startsWith("./")) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
240 if (prefix.startsWith("/")) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
241 fileSet.setPrefix("." + prefix);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
242 } else {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
243 fileSet.setPrefix("./" + prefix);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
244 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
245 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
246 if ((fullpath.length() > 0) && !fullpath.startsWith("./")) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
247 fileSet.setPrefix("");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
248 if (fullpath.startsWith("/")) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
249 fileSet.setFullpath("." + fullpath);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
250 } else {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
251 fileSet.setFullpath("./" + fullpath);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
252 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
253 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
254 if ((0 == fileSet.getUid()) && ("" == fileSet.getUserName())) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
255 fileSet.setUserName("root");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
256 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
257 if ((0 == fileSet.getGid()) && ("" == fileSet.getGroup())) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
258 fileSet.setGroup("root");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
259 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
260 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
261
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
262 File md5sumsFile = new File(tempDir,"md5sums");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
263 if (includeMd5sums) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
264 Checksum md5 = new Checksum();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
265 prepareTask(md5);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
266 int md5Count = 0;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
267 StringBuffer md5sums = new StringBuffer();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
268 for (Enumeration e=dataFileSets.elements() ; e.hasMoreElements() ; ) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
269 TarFileSet fileSet = (TarFileSet)e.nextElement();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
270 String[] files = fileSet.getDirectoryScanner(getProject()).getIncludedFiles();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
271 File fileSetDir = fileSet.getDir(getProject());
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
272 for (int i=0, c=files.length ; i<c ; i++) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
273 md5.setFile(new File(fileSetDir,files[i]));
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
274 md5.setProperty("md5_"+md5Count);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
275 md5.perform();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
276 md5sums.append(getProject().getProperty("md5_"+md5Count)).append(" ");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
277 String fullpath = fileSet.getFullpath();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
278 if (fullpath.length() > 0) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
279 md5sums.append(fullpath.substring(2));
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
280 } else {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
281 md5sums.append(fileSet.getPrefix().substring(2)).append(files[i].replace('\\','/'));
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
282 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
283 md5sums.append("\n");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
284 md5Count++;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
285 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
286 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
287 echo = new Echo();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
288 prepareTask(echo);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
289 echo.setFile(md5sumsFile);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
290 echo.setLevel(echoLevel);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
291 echo.setMessage(md5sums.toString());
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
292 echo.perform();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
293 tarFileSet = controlTarGz.createTarFileSet();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
294 tarFileSet.setFile(md5sumsFile);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
295 tarFileSet.setUserName("root");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
296 tarFileSet.setGroup("root");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
297 tarFileSet.setPrefix("./");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
298 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
299
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
300 TarCompressionMethod tarCompressionMethod = new TarCompressionMethod();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
301 tarCompressionMethod.setValue("gzip");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
302 controlTarGz.setCompression(tarCompressionMethod);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
303 File controlTarGzFile = new File(tempDir,"control.tar.gz");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
304 controlTarGz.setDestFile(controlTarGzFile);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
305 controlTarGz.perform();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
306
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
307 dataTarGz.setCompression(tarCompressionMethod);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
308 File dataTarGzFile = new File(tempDir,"data.tar.gz");
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
309 dataTarGz.setDestFile(dataTarGzFile);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
310 dataTarGz.perform();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
311
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
312 FileUtils.delete(destFile);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
313 ArFileSet fileSet = debPackage.createArFileSet();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
314 fileSet.setFile(debianBinaryFile);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
315 fileSet = debPackage.createArFileSet();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
316 fileSet.setFile(controlTarGzFile);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
317 fileSet = debPackage.createArFileSet();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
318 fileSet.setFile(dataTarGzFile);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
319 debPackage.perform();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
320
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
321 if (deleteTempFiles) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
322 FileUtils.delete(debianBinaryFile);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
323 FileUtils.delete(controlTarGzFile);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
324 FileUtils.delete(dataTarGzFile);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
325 FileUtils.delete(md5sumsFile);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
326 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
327 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
328
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
329 /**
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
330 * Checks whether the package is up to date in relationship to a list of files.
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
331 *
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
332 * @param files the files to check
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
333 * @param dir the base directory for the files.
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
334 * @return true if the archive is up to date.
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
335 */
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
336 protected boolean packageIsUpToDate(String[] files, File dir) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
337 SourceFileScanner sfs = new SourceFileScanner(this);
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
338 MergingMapper mm = new MergingMapper();
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
339 mm.setTo(destFile.getAbsolutePath());
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
340 return sfs.restrict(files, dir, null, mm).length == 0;
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
341 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
342
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
343 /**
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
344 * Prepares a task for execution.
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
345 *
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
346 * @param task the task to prepare
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
347 */
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
348 protected void prepareTask(Task task) {
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
349 task.setProject(getProject());
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
350 task.setOwningTarget(getOwningTarget());
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
351 task.setTaskName(getTaskName());
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
352 task.setTaskType(getTaskType());
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
353 }
3d86f0391168 Work on improving the build system.
David Barts <davidb@stashtea.com>
parents:
diff changeset
354 }