use of aQute.lib.osgi.Instruction in project hazelcast by hazelcast.
the class HazelcastManifestTransformer method overridePackageDefinitionResolution.
private PackageDefinition overridePackageDefinitionResolution(PackageDefinition packageDefinition) {
for (InstructionDefinition instructionDefinition : importOverrideInstructions) {
Instruction instruction = instructionDefinition.instruction;
if (instruction.matches(packageDefinition.packageName)) {
// is remove instruction?
if (instruction.isNegated()) {
System.out.println("Instruction '" + instruction + "' -> package '" + packageDefinition.packageName + "'");
return null;
}
System.out.println("Instruction '" + instruction + "' -> package '" + packageDefinition.packageName + "'");
PackageDefinition override = instructionDefinition.packageDefinition;
String packageName = packageDefinition.packageName;
String version = packageDefinition.version;
Set<String> uses = packageDefinition.uses;
return new PackageDefinition(packageName, override.resolutionOptional, version, uses);
}
}
return packageDefinition;
}
use of aQute.lib.osgi.Instruction in project hazelcast by hazelcast.
the class InstructionDefinitionTest method setUp.
@Before
public void setUp() {
PackageDefinition definition = new PackageDefinition("packageName", true, "version", Collections.<String>emptySet());
Instruction instruction = mock(Instruction.class);
instructionDefinition = new InstructionDefinition(definition, instruction);
}
use of aQute.lib.osgi.Instruction in project hazelcast by hazelcast.
the class HazelcastManifestTransformer method precompileOverrideInstructions.
@SuppressFBWarnings(value = "NP_UNWRITTEN_FIELD", justification = "Field is set by Maven")
private void precompileOverrideInstructions() {
String importPackageInstructions = overrideInstructions.get(IMPORT_PACKAGE);
if (importPackageInstructions != null) {
List<String> packageInstructions = ElementParser.parseDelimitedString(importPackageInstructions, ',', true);
for (String packageInstruction : packageInstructions) {
PackageDefinition packageDefinition = new PackageDefinition(packageInstruction);
Instruction instruction = Instruction.getPattern(packageDefinition.packageName);
System.out.println("Compiled import instruction '" + packageInstruction + "' -> " + instruction);
importOverrideInstructions.add(new InstructionDefinition(packageDefinition, instruction));
}
}
String exportPackageInstructions = overrideInstructions.get(EXPORT_PACKAGE);
if (exportPackageInstructions != null) {
List<String> packageInstructions = ElementParser.parseDelimitedString(exportPackageInstructions, ',', true);
for (String packageInstruction : packageInstructions) {
PackageDefinition packageDefinition = new PackageDefinition(packageInstruction);
Instruction instruction = Instruction.getPattern(packageDefinition.packageName);
System.out.println("Compiled export instruction '" + packageInstruction + "' -> " + instruction);
exportOverrideInstructions.add(new InstructionDefinition(packageDefinition, instruction));
}
}
}
Aggregations