}
private static boolean release(ReleaseContext context, List<IReleaseParticipant> participants, Builder builder) throws Exception {
Jar jar;
if (context.getReleaseOption() == ReleaseOption.UPDATE_RELEASE) {
jar = builder.build();
} else {
// No need to rebuild if release only
File jarFile = new File(context.getProject().getTarget(), builder.getBsn() + ".jar");
if (jarFile.isFile()) {
jar = new Jar(jarFile);
} else {
jar = builder.build();
}
}
handleBuildErrors(context, builder, jar);
String symbName = ReleaseUtils.getBundleSymbolicName(jar);
String version = ReleaseUtils.getBundleVersion(jar);
boolean proceed = preJarRelease(context, participants, jar);
if (!proceed) {
postRelease(context, participants, false);
displayErrors(context);
return false;
}
JarResource jr = new JarResource(jar);
InputStream is = new BufferedInputStream(jr.openInputStream());
try {
context.getProject().release(context.getReleaseRepository().getName(), jar.getName(), is);
} finally {
is.close();
}
File file = context.getReleaseRepository().get(symbName, Version.parseVersion(version), null);
Jar releasedJar = null;
if (file != null && file.exists()) {
IResource resource = ReleaseUtils.toResource(file);
if (resource != null) {
resource.refreshLocal(IResource.DEPTH_ZERO, null);
}