Search in sources :

Example 1 with ProvisionedInstallationBuilder

use of org.eclipse.tycho.surefire.provisioning.ProvisionedInstallationBuilder in project tycho by eclipse.

the class TestMojo method createProvisionedInstallation.

private EquinoxInstallation createProvisionedInstallation() throws MojoExecutionException {
    try {
        TestFrameworkProvider provider = providerHelper.selectProvider(getProjectType().getClasspath(project), getMergedProviderProperties(), providerHint);
        createSurefireProperties(provider);
        ProvisionedInstallationBuilder installationBuilder = provisionedInstallationBuilderFactory.createInstallationBuilder();
        Set<Artifact> testHarnessArtifacts = providerHelper.filterTestFrameworkBundles(provider, pluginArtifacts);
        for (Artifact testHarnessArtifact : testHarnessArtifacts) {
            installationBuilder.addBundleJar(testHarnessArtifact.getFile());
        }
        RepositoryReferences sources = repositoryReferenceTool.getVisibleRepositories(project, session, RepositoryReferenceTool.REPOSITORIES_INCLUDE_CURRENT_MODULE);
        installationBuilder.addMetadataRepositories(sources.getMetadataRepositories());
        installationBuilder.addArtifactRepositories(sources.getArtifactRepositories());
        installationBuilder.setProfileName(profileName);
        installationBuilder.addIUsToBeInstalled(getIUsToInstall(testHarnessArtifacts));
        File workingDir = new File(project.getBuild().getDirectory(), "p2temp");
        workingDir.mkdirs();
        installationBuilder.setWorkingDir(workingDir);
        installationBuilder.setDestination(work);
        return installationBuilder.install();
    } catch (Exception ex) {
        throw new MojoExecutionException(ex.getMessage(), ex);
    }
}
Also used : ProvisionedInstallationBuilder(org.eclipse.tycho.surefire.provisioning.ProvisionedInstallationBuilder) RepositoryReferences(org.eclipse.tycho.p2.tools.RepositoryReferences) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) TestFrameworkProvider(org.eclipse.tycho.surefire.provider.spi.TestFrameworkProvider) File(java.io.File) Artifact(org.apache.maven.artifact.Artifact) MalformedURLException(java.net.MalformedURLException) ArtifactResolutionException(org.apache.maven.artifact.resolver.ArtifactResolutionException) IOException(java.io.IOException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MojoFailureException(org.apache.maven.plugin.MojoFailureException)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 Artifact (org.apache.maven.artifact.Artifact)1 ArtifactResolutionException (org.apache.maven.artifact.resolver.ArtifactResolutionException)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 MojoFailureException (org.apache.maven.plugin.MojoFailureException)1 RepositoryReferences (org.eclipse.tycho.p2.tools.RepositoryReferences)1 TestFrameworkProvider (org.eclipse.tycho.surefire.provider.spi.TestFrameworkProvider)1 ProvisionedInstallationBuilder (org.eclipse.tycho.surefire.provisioning.ProvisionedInstallationBuilder)1