use of org.sonatype.nexus.repository.apt.internal.AptProperties.P_INDEX_SECTION in project nexus-public by sonatype.
the class AptHostedFacet method createMetadataFileWithData.
private void createMetadataFileWithData(final List<AssetChange> changes, final CompressingTempFileStore result, final Map<String, Writer> streams, final List<FluentAsset> assets) throws IOException {
// NOTE: We exclude added assets as well to account for the case where we are replacing an asset
Set<String> excludeNames = changes.stream().map(c -> c.getAsset().path()).collect(Collectors.toSet());
for (FluentAsset asset : assets) {
final String name = asset.path();
final String arch = (String) FormatAttributesUtils.getFormatAttributes(asset).get(P_ARCHITECTURE);
Writer outWriter = streams.computeIfAbsent(arch, result::openOutput);
if (!excludeNames.contains(name)) {
final String indexSection = (String) FormatAttributesUtils.getFormatAttributes(asset).get(P_INDEX_SECTION);
outWriter.write(indexSection);
outWriter.write("\n\n");
}
}
List<FluentAsset> addAssets = changes.stream().filter(c -> c.getAction() == AssetAction.ADDED).map(AssetChange::getAsset).collect(Collectors.toList());
// HACK: tx.browse won't see changes in the current transaction, so we have to manually add these in here
for (FluentAsset asset : addAssets) {
String arch = (String) FormatAttributesUtils.getFormatAttributes(asset).get(P_ARCHITECTURE);
String indexSection = (String) FormatAttributesUtils.getFormatAttributes(asset).get(P_INDEX_SECTION);
Writer outWriter = streams.computeIfAbsent(arch, result::openOutput);
outWriter.write(indexSection);
outWriter.write("\n\n");
}
}
Aggregations