use of org.eclipse.tycho.core.shared.BuildPropertiesImpl in project tycho by eclipse.
the class LicenseFeatureHelper method getLicenseFeatureFileSet.
/**
* Get all files included in license feature jar (via build.properties
* bin.includes/bin.excludes) exept for feature.xml, feature.properties and build.properties as
* an archived fileset so they can be added to another feature jar.
*
* @param licenseFeature
* license feature jar
*/
public ArchivedFileSet getLicenseFeatureFileSet(File licenseFeature) throws IOException {
// copy all files from license feature's build.properties file except
// feature.properties, feature.xml and build.properties itself
BuildProperties buildProperties;
ZipFile zip = new ZipFile(licenseFeature);
try {
ZipEntry entry = zip.getEntry(BuildPropertiesParser.BUILD_PROPERTIES);
if (entry != null) {
InputStream is = zip.getInputStream(entry);
Properties p = new Properties();
p.load(is);
buildProperties = new BuildPropertiesImpl(p);
} else {
throw new IllegalArgumentException("license feature must include build.properties file");
}
} finally {
zip.close();
}
List<String> includes = buildProperties.getBinIncludes();
Set<String> excludes = new HashSet<>(buildProperties.getBinExcludes());
excludes.add(Feature.FEATURE_XML);
excludes.add("feature.properties");
excludes.add(BuildPropertiesParser.BUILD_PROPERTIES);
// mavenArchiver ignores license feature files that are also present in 'this' feature
// i.e. if there is a conflict, files from 'this' feature win
DefaultArchivedFileSet result = new DefaultArchivedFileSet(licenseFeature);
result.setIncludes(includes.toArray(new String[includes.size()]));
result.setExcludes(excludes.toArray(new String[excludes.size()]));
return result;
}
use of org.eclipse.tycho.core.shared.BuildPropertiesImpl in project tycho by eclipse.
the class FeatureRootfileArtifactRepositoryTest method rootPropertiesWithGlobalAndWindowsFiles.
private BuildProperties rootPropertiesWithGlobalAndWindowsFiles() {
Properties buildProperties = new Properties();
buildProperties.put("root.win32.win32.x86", "file:rootfiles/file1.txt");
buildProperties.put("root", "file:rootfiles/file2.txt");
return new BuildPropertiesImpl(buildProperties);
}
use of org.eclipse.tycho.core.shared.BuildPropertiesImpl in project tycho by eclipse.
the class BuildPropertiesParserImpl method parse.
@Override
public BuildProperties parse(File baseDir) {
File propsFile = new File(baseDir, BUILD_PROPERTIES);
String filePath = propsFile.getAbsolutePath();
BuildProperties buildProperties = cache.get(filePath);
if (buildProperties == null) {
Properties properties = readProperties(propsFile);
interpolate(properties, baseDir);
buildProperties = new BuildPropertiesImpl(properties);
cache.put(filePath, buildProperties);
}
return buildProperties;
}
use of org.eclipse.tycho.core.shared.BuildPropertiesImpl in project tycho by eclipse.
the class IncludeValidationHelperTest method createBuildProperties.
private BuildPropertiesImpl createBuildProperties(String key, String value) {
Properties properties = new Properties();
properties.setProperty(key, value);
BuildPropertiesImpl buildProperties = new BuildPropertiesImpl(properties);
return buildProperties;
}
use of org.eclipse.tycho.core.shared.BuildPropertiesImpl in project tycho by eclipse.
the class IncludeValidationHelperTest method testCheckBinIncludesNotSpecified.
@Test
public void testCheckBinIncludesNotSpecified() throws Exception {
BuildPropertiesImpl buildProperties = createBuildProperties("no.bin.includes", "bin.includes is not specified");
try {
subject.checkBinIncludesExist(createMockProject(), buildProperties, true);
fail();
} catch (MojoExecutionException e) {
assertStringContains("bin.includes value(s) must be specified", e.getMessage());
}
}
Aggregations