Search in sources :

Example 1 with DefaultBundleReader

use of org.eclipse.tycho.core.osgitools.DefaultBundleReader in project tycho by eclipse.

the class TychoMavenLifecycleParticipant method configureComponents.

private void configureComponents(MavenSession session) {
    // TODO why does the bundle reader need to cache stuff in the local maven repository?
    File localRepository = new File(session.getLocalRepository().getBasedir());
    ((DefaultBundleReader) bundleReader).setLocationRepository(localRepository);
}
Also used : DefaultBundleReader(org.eclipse.tycho.core.osgitools.DefaultBundleReader) File(java.io.File)

Example 2 with DefaultBundleReader

use of org.eclipse.tycho.core.osgitools.DefaultBundleReader in project tycho by eclipse.

the class JarDirectoryBundlesTest method test.

@Test
public void test() throws Exception {
    Verifier verifier = getVerifier("MNGECLIPSE949jarDirectoryBundles");
    verifier.executeGoal("package");
    verifier.verifyErrorFreeLog();
    File[] sitePlugins = new File(verifier.getBasedir(), "site/target/site/plugins").listFiles(new FileFilter() {

        @Override
        public boolean accept(File pathname) {
            return pathname.isFile() && pathname.getName().startsWith("org.eclipse.platform") && pathname.getName().endsWith(".jar");
        }
    });
    Assert.assertEquals(1, sitePlugins.length);
    // verify the bundle actually makes sense
    DefaultBundleReader reader = new DefaultBundleReader();
    OsgiManifest siteBundleManifest = reader.loadManifest(sitePlugins[0]);
    Assert.assertEquals("platform.jar", siteBundleManifest.getBundleClasspath()[0]);
    Assert.assertEquals("org.eclipse.platform", siteBundleManifest.getBundleSymbolicName());
    File[] productPlugins = new File(verifier.getBasedir(), "product/target/product/eclipse/plugins").listFiles(new FileFilter() {

        @Override
        public boolean accept(File pathname) {
            return pathname.isDirectory() && pathname.getName().startsWith("org.eclipse.platform");
        }
    });
    Assert.assertEquals(1, productPlugins.length);
    // verify directory actually makes sense
    OsgiManifest productBundleManifest = reader.loadManifest(productPlugins[0]);
    Assert.assertEquals("platform.jar", productBundleManifest.getBundleClasspath()[0]);
    Assert.assertEquals("org.eclipse.platform", productBundleManifest.getBundleSymbolicName());
}
Also used : DefaultBundleReader(org.eclipse.tycho.core.osgitools.DefaultBundleReader) OsgiManifest(org.eclipse.tycho.core.osgitools.OsgiManifest) Verifier(org.apache.maven.it.Verifier) FileFilter(java.io.FileFilter) File(java.io.File) Test(org.junit.Test) AbstractTychoIntegrationTest(org.eclipse.tycho.test.AbstractTychoIntegrationTest)

Aggregations

File (java.io.File)2 DefaultBundleReader (org.eclipse.tycho.core.osgitools.DefaultBundleReader)2 FileFilter (java.io.FileFilter)1 Verifier (org.apache.maven.it.Verifier)1 OsgiManifest (org.eclipse.tycho.core.osgitools.OsgiManifest)1 AbstractTychoIntegrationTest (org.eclipse.tycho.test.AbstractTychoIntegrationTest)1 Test (org.junit.Test)1