Search in sources :

Example 6 with IFeatureRootAdvice

use of org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice in project tycho by eclipse.

the class FeatureRootAdviceTest method testParseBuildPropertiesWithDotsInPath.

@Test
public void testParseBuildPropertiesWithDotsInPath() {
    Properties buildProperties = createBuildPropertiesWithDefaultRootFiles();
    buildProperties.put("root.folder.../folder.with.dots", "rootfiles");
    IFeatureRootAdvice advice = createAdvice(buildProperties);
    assert (advice != null);
}
Also used : IFeatureRootAdvice(org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice) Properties(java.util.Properties) Test(org.junit.Test)

Example 7 with IFeatureRootAdvice

use of org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice in project tycho by eclipse.

the class FeatureRootAdviceTest method testFeatureRootAdviceComputePath.

@Test
public void testFeatureRootAdviceComputePath() throws Exception {
    IFeatureRootAdvice rootFileAdvice = FeatureRootAdvice.createRootFileAdvice(createDefaultArtifactMock(), new BuildPropertiesParserForTesting());
    File file1 = new File(FEATURE_PROJECT_TEST_RESOURCE_ROOT, ROOT_FILE_NAME).getCanonicalFile();
    IPath expectedPathFile1 = new Path(ROOT_FILE_NAME);
    IPath actualPathFile1 = rootFileAdvice.getRootFileComputer(GLOBAL_SPEC).computePath(file1);
    assertEquals(expectedPathFile1, actualPathFile1);
    File file2 = new File(FEATURE_PROJECT_TEST_RESOURCE_ROOT, ROOT_FILE2_REL_PATH).getCanonicalFile();
    IPath expectedPathFile2 = new Path(ROOT_FILE2_NAME);
    IPath actualPathFile2 = rootFileAdvice.getRootFileComputer(GLOBAL_SPEC).computePath(file2);
    assertEquals(expectedPathFile2, actualPathFile2);
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) IFeatureRootAdvice(org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice) File(java.io.File) BuildPropertiesParserForTesting(org.eclipse.tycho.test.util.BuildPropertiesParserForTesting) Test(org.junit.Test)

Example 8 with IFeatureRootAdvice

use of org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice in project tycho by eclipse.

the class FeatureRootAdviceFilesTest method createAdviceAndGetFilesMap.

private static FileToPathMap createAdviceAndGetFilesMap(Properties buildProperties, String configSpec) {
    IFeatureRootAdvice advice = createAdvice(buildProperties);
    FileToPathMap defaultRootFilesMap = getSourceToDestinationMap(advice, configSpec);
    return defaultRootFilesMap;
}
Also used : IFeatureRootAdvice(org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice)

Example 9 with IFeatureRootAdvice

use of org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice in project tycho by eclipse.

the class FeatureRootAdviceFilesTest method testRootFilesWithFoldersAndConfig.

@Test
public void testRootFilesWithFoldersAndConfig() {
    Properties buildProperties = createBuildPropertiesWithoutRootKeys();
    buildProperties.put("root.folder.foo", "file:rootfiles/dir/file3.txt");
    buildProperties.put("root." + WINDOWS_SPEC_FOR_PROPERTIES_KEY + ".folder.windir", "file:rootfiles/file1.txt");
    buildProperties.put("root." + LINUX_SPEC_FOR_PROPERTIES_KEY + ".folder.linuxdir", "file:rootfiles/file2.txt");
    IFeatureRootAdvice advice = createAdvice(buildProperties);
    FileToPathMap winFilesMap = getSourceToDestinationMap(advice, WINDOWS_SPEC_FOR_ADVICE);
    assertEquals(1, winFilesMap.size());
    assertRootFileEntry(winFilesMap, "rootfiles/file1.txt", "windir/file1.txt");
    FileToPathMap linuxFilesMap = getSourceToDestinationMap(advice, LINUX_SPEC_FOR_ADVICE);
    assertEquals(1, linuxFilesMap.size());
    assertRootFileEntry(linuxFilesMap, "rootfiles/file2.txt", "linuxdir/file2.txt");
    FileToPathMap globalFilesMap = getSourceToDestinationMap(advice, GLOBAL_SPEC);
    assertEquals(1, globalFilesMap.size());
    assertRootFileEntry(globalFilesMap, "rootfiles/dir/file3.txt", "foo/file3.txt");
}
Also used : IFeatureRootAdvice(org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice) Properties(java.util.Properties) Test(org.junit.Test)

Example 10 with IFeatureRootAdvice

use of org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice in project tycho by eclipse.

the class P2GeneratorImpl method getPublisherAdvice.

@Override
protected List<IPublisherAdvice> getPublisherAdvice(IArtifactFacade artifact) {
    ArrayList<IPublisherAdvice> advice = new ArrayList<>();
    advice.add(new MavenPropertiesAdvice(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getClassifier()));
    advice.add(getExtraEntriesAdvice(artifact));
    IFeatureRootAdvice featureRootAdvice = FeatureRootAdvice.createRootFileAdvice(artifact, getBuildPropertiesParser());
    if (featureRootAdvice != null) {
        advice.add(featureRootAdvice);
    }
    return advice;
}
Also used : IPublisherAdvice(org.eclipse.equinox.p2.publisher.IPublisherAdvice) ArrayList(java.util.ArrayList) IFeatureRootAdvice(org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice)

Aggregations

IFeatureRootAdvice (org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice)17 Test (org.junit.Test)15 Properties (java.util.Properties)14 File (java.io.File)1 ArrayList (java.util.ArrayList)1 IPath (org.eclipse.core.runtime.IPath)1 Path (org.eclipse.core.runtime.Path)1 IPublisherAdvice (org.eclipse.equinox.p2.publisher.IPublisherAdvice)1 BuildPropertiesParserForTesting (org.eclipse.tycho.test.util.BuildPropertiesParserForTesting)1