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);
}
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);
}
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;
}
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");
}
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;
}
Aggregations