{@inheritDoc} @since 2016/10/26
()
| 182 | * @since 2016/10/26 |
| 183 | */ |
| 184 | @Override |
| 185 | public void run() |
| 186 | { |
| 187 | // {@squirreljme.error NB03 The entry point project does not exist.} |
| 188 | Map<String, BuildProject> projects = this.projects; |
| 189 | BuildProject bp = projects.get("builder"); |
| 190 | if (bp == null) |
| 191 | throw new IllegalStateException("NB03"); |
| 192 | |
| 193 | // Could fail |
| 194 | Path tempjar = null; |
| 195 | try |
| 196 | { |
| 197 | // Compile JARs to be merged together as one |
| 198 | Set<BuildProject> mergethese = bp.compile(); |
| 199 | |
| 200 | // Get the time and date for the JARs to merge |
| 201 | Path bootjar = this.bootstrapout; |
| 202 | Long[] out = new Long[1]; |
| 203 | out[0] = Long.MIN_VALUE; |
| 204 | NewBootstrap.<Long[]>__walk(this.buildjarout, out, DATE); |
| 205 | long depjartime = out[0]; |
| 206 | |
| 207 | // Get the time of the output JAR |
| 208 | long bootjartime; |
| 209 | if (Files.exists(bootjar)) |
| 210 | { |
| 211 | out[0] = Long.MIN_VALUE; |
| 212 | NewBootstrap.<Long[]>__walk(bootjar, out, DATE); |
| 213 | bootjartime = out[0]; |
| 214 | } |
| 215 | else |
| 216 | bootjartime = Long.MIN_VALUE; |
| 217 | |
| 218 | // Repackage |
| 219 | if (bootjartime == Long.MIN_VALUE || depjartime > bootjartime) |
| 220 | { |
| 221 | // {@squirreljme.error NB0a Merging output JAR file.} |
| 222 | System.err.println("NB0a"); |
| 223 | |
| 224 | // {@squirreljme.error NB0b Expected the entry point boot JAR |
| 225 | // to be within the merge JAR set.} |
| 226 | List<BuildProject> mergeorder = new ArrayList<>(mergethese); |
| 227 | if (!mergeorder.remove(bp)) |
| 228 | throw new RuntimeException("NB0b"); |
| 229 | |
| 230 | // Make the boot JAR always first |
| 231 | mergeorder.add(0, bp); |
| 232 | |
| 233 | // {@squirreljme.error NB0d Expected the CLDC libraries to be |
| 234 | // present in the build.} |
| 235 | BuildProject cldccompact = projects.get("cldc-compact"); |
| 236 | if (!mergeorder.remove(cldccompact)) |
| 237 | throw new RuntimeException("NB0d"); |
| 238 | |
| 239 | // Make the CLDC compact JAR always last, so that its system |
| 240 | // entries are always shaded last. This is because they need |
| 241 | // to be replaced accordingly to operate correctly |
no test coverage detected