@@ -61,6 +62,10 @@ public final class RunMap<R extends Run<?,R>> extends AbstractLazyLoadRunMap<R>
privateConstructor<R>cons;
/** Normally overwritten by {@link LazyBuildMixIn#onLoad} or {@link LazyBuildMixIn#onCreatedFromScratch}, in turn created during {@link Job#onLoad}. */
LOGGER.log(Level.WARNING,"could not save changes to "+f,x);
}
}
/**
* Called when a job is first created.
* Just saves an empty marker indicating that this job needs no migration.
* @param dir as in {@link Job#getBuildDir}
*/
publicvoidcreated(Filedir){
save(dir);
}
/**
* Perform one-time migration if this has not been done already.
* Where previously there would be a {@code 2014-01-02_03-04-05/build.xml} specifying {@code <number>99</number>} plus a symlink {@code 99 → 2014-01-02_03-04-05},
* after migration there will be just {@code 99/build.xml} specifying {@code <id>2014-01-02_03-04-05</id>} and {@code <timestamp>…</timestamp>} according to local time zone at time of migration.
* Newly created builds are untouched.
* Does not throw {@link IOException} since we make a best effort to migrate but do not consider it fatal to job loading if we cannot.
* @param dir as in {@link Job#getBuildDir}
* @param jenkinsHome root directory of Jenkins (for logging only)
for(Class<?>c:newClass<?>[]{RunIdMigrator.class,/* TODO how to calculate transitive dependencies automatically? */Charsets.class,WriterOutputStream.class,BuildException.class,FastDateFormat.class}){
LOGGER.log(Level.WARNING,"Build record migration is one-way. If you need to downgrade Jenkins, run: java -classpath {0} {1} {2}",newObject[]{cp,RunIdMigrator.class.getName(),jenkinsHome});