in atomos.utils/atomos.utils.core/src/main/java/org/apache/felix/atomos/utils/core/plugins/index/IndexPlugin.java [199:284]
public void postJars(Context context)
{
try
{
final List<String> bundleIndexLines = new ArrayList<>();
final Collection<String> resources = new LinkedHashSet<>();
indexInfos.stream() //
.filter((i) -> i.getBundleSymbolicName() != null) //
.sorted((i1, i2) -> i1.getBundleSymbolicName().compareTo(
i2.getBundleSymbolicName())) //
.forEach((i) -> {
bundleIndexLines.add(ATOMOS_BUNDLE_SEPARATOR);
bundleIndexLines.add(i.getId());
bundleIndexLines.add(i.getBundleSymbolicName());
bundleIndexLines.add(i.getVersion());
i.getFiles().forEach(f -> {
bundleIndexLines.add(f);
if (!isClass(f))
{
if (Boolean.FALSE == uniquePaths.get(f))
{
resources.add(
ATOMOS_BUNDLES_BASE_PATH + i.getId() + "/" + f);
}
if (!f.endsWith("/") && !"META-INF/MANIFEST.MF".equals(f))
{
resources.add(f);
}
}
});
});
ByteArrayOutputStream indexBytes;
try (final ByteArrayOutputStream out = new ByteArrayOutputStream();
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out)))
{
indexBytes = out;
bundleIndexLines.forEach((l) -> {
try
{
writer.append(l).append('\n');
}
catch (final IOException ex)
{
throw new UncheckedIOException(ex);
}
});
}
writeIndexFile(indexBytes.toByteArray(), context);
if (isJarType())
{
writeGraalResourceConfig(resources, context);
}
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
if (jos != null)
{
try
{
jos.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
//after closing
if (isJarType())
{
context.addFile(substrateJar, FileType.INDEX_JAR);
}
else
{
context.addFile(config.indexOutputDirectory(), FileType.INDEX_DIR);
}
}