use of org.eclipse.tycho.core.shared.BuildProperties in project tycho by eclipse.
the class BuildPropertiesParserForTesting method parse.
@Override
public BuildProperties parse(File baseDir) {
Properties props = new Properties();
readBuildProperties(baseDir, props);
return new BuildPropertiesImpl(props);
}
use of org.eclipse.tycho.core.shared.BuildProperties in project tycho by eclipse.
the class OsgiSourceMojo method isRelevantProjectImpl.
protected static boolean isRelevantProjectImpl(MavenProject project, BuildPropertiesParser buildPropertiesParser) {
String packaging = project.getPackaging();
boolean relevant = PackagingType.TYPE_ECLIPSE_PLUGIN.equals(packaging) || PackagingType.TYPE_ECLIPSE_TEST_PLUGIN.equals(packaging);
if (!relevant) {
return false;
}
// this assumes that sources generation has to be explicitly enabled in pom.xml
Plugin plugin = project.getPlugin("org.eclipse.tycho:tycho-source-plugin");
if (plugin == null) {
return false;
}
for (PluginExecution execution : plugin.getExecutions()) {
if (execution.getGoals().contains(GOAL)) {
boolean requireSourceRoots = Boolean.parseBoolean(getParameterValue(execution, "requireSourceRoots", "false"));
if (requireSourceRoots) {
return true;
}
boolean hasAdditionalFilesets = getConfigurationElement((Xpp3Dom) execution.getConfiguration(), "additionalFileSets") != null;
if (hasAdditionalFilesets) {
return true;
}
BuildProperties buildProperties = buildPropertiesParser.parse(project.getBasedir());
if (buildProperties.getJarToSourceFolderMap().size() > 0 || buildProperties.getSourceIncludes().size() > 0) {
return true;
}
}
}
return false;
}
use of org.eclipse.tycho.core.shared.BuildProperties in project tycho by eclipse.
the class OsgiSourceMojo method getResources.
/**
* {@inheritDoc}
*/
@Override
protected List<Resource> getResources(MavenProject p) throws MojoExecutionException {
if (excludeResources) {
return Collections.emptyList();
}
BuildProperties buildProperties = buildPropertiesParser.parse(p.getBasedir());
List<String> srcIncludesList = buildProperties.getSourceIncludes();
List<Resource> resources = new ArrayList<>();
if (!srcIncludesList.isEmpty()) {
includeValidationHelper.checkSourceIncludesExist(p, buildProperties, strictSrcIncludes);
resources.add(createResource(project.getBasedir().getAbsolutePath(), srcIncludesList, buildProperties.getSourceExcludes()));
}
if (additionalFileSets != null) {
for (DefaultFileSet fileSet : additionalFileSets) {
if (fileSet.getIncludes() != null && fileSet.getIncludes().length > 0) {
resources.add(createResource(fileSet.getDirectory().getAbsolutePath(), asList(fileSet.getIncludes()), asList(fileSet.getExcludes())));
}
}
}
if (!srcIncludesList.contains(MANIFEST_BUNDLE_LOCALIZATION_FILENAME)) {
resources.add(generateL10nFile());
}
return resources;
}
use of org.eclipse.tycho.core.shared.BuildProperties in project tycho by eclipse.
the class AbstractMetadataGenerator method extractExtraEntriesAsIURequirement.
private IRequirement[] extractExtraEntriesAsIURequirement(File location) {
BuildProperties buildProps = buildPropertiesParser.parse(location);
ArrayList<IRequirement> result = new ArrayList<>();
for (Entry<String, List<String>> entry : buildProps.getJarToExtraClasspathMap().entrySet()) {
createRequirementFromExtraClasspathProperty(result, entry.getValue());
}
createRequirementFromExtraClasspathProperty(result, buildProps.getJarsExtraClasspath());
if (result.isEmpty())
return null;
return result.toArray(new IRequirement[result.size()]);
}
use of org.eclipse.tycho.core.shared.BuildProperties 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;
}
Aggregations