Search in sources :

Example 1 with Instruction

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;
}
Also used : Instruction(aQute.lib.osgi.Instruction)

Example 2 with Instruction

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);
}
Also used : PackageDefinition(com.hazelcast.buildutils.HazelcastManifestTransformer.PackageDefinition) InstructionDefinition(com.hazelcast.buildutils.HazelcastManifestTransformer.InstructionDefinition) Instruction(aQute.lib.osgi.Instruction) Before(org.junit.Before)

Example 3 with 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));
        }
    }
}
Also used : Instruction(aQute.lib.osgi.Instruction) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Aggregations

Instruction (aQute.lib.osgi.Instruction)3 InstructionDefinition (com.hazelcast.buildutils.HazelcastManifestTransformer.InstructionDefinition)1 PackageDefinition (com.hazelcast.buildutils.HazelcastManifestTransformer.PackageDefinition)1 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 Before (org.junit.Before)1