コード例 #1
0
  LaunchConfiguration createCommandLine(EquinoxInstallation testRuntime, File workspace)
      throws MalformedURLException {
    EquinoxLaunchConfiguration cli = new EquinoxLaunchConfiguration(testRuntime);

    cli.setWorkingDirectory(project.getBasedir());

    if (debugPort > 0) {
      cli.addVMArguments(
          "-Xdebug", "-Xrunjdwp:transport=dt_socket,address=" + debugPort + ",server=y,suspend=y");
    }

    cli.addVMArguments("-Dosgi.noShutdown=false");

    Properties properties =
        (Properties) project.getContextValue(TychoConstants.CTX_MERGED_PROPERTIES);
    cli.addVMArguments(
        "-Dosgi.os=" + PlatformPropertiesUtils.getOS(properties), //
        "-Dosgi.ws=" + PlatformPropertiesUtils.getWS(properties), //
        "-Dosgi.arch=" + PlatformPropertiesUtils.getArch(properties));

    if (argLine != null) {
      cli.addVMArguments(true, argLine);
    }

    if (systemProperties != null) {
      for (Map.Entry<String, String> entry : systemProperties.entrySet()) {
        cli.addVMArguments(true, "-D" + entry.getKey() + "=" + entry.getValue());
      }
    }

    if (getLog().isDebugEnabled() || showEclipseLog) {
      cli.addProgramArguments("-debug", "-consolelog");
    }

    cli.addProgramArguments(
        "-data", workspace.getAbsolutePath(), //
        "-dev", devProperties.toURI().toURL().toExternalForm(), //
        "-install", testRuntime.getLocation().getAbsolutePath(), //
        "-configuration", new File(work, "configuration").getAbsolutePath(), //
        "-application", getTestApplication(testRuntime.getInstallationDescription()), //
        "-testproperties", surefireProperties.getAbsolutePath());
    if (application != null) {
      cli.addProgramArguments("-testApplication", application);
    }
    if (product != null) {
      cli.addProgramArguments("-product", product);
    }
    if (useUIHarness && !useUIThread) {
      cli.addProgramArguments("-nouithread");
    }
    if (appArgLine != null) {
      cli.addProgramArguments(true, appArgLine);
    }
    if (environmentVariables != null) {
      cli.addEnvironmentVariables(environmentVariables);
    }
    return cli;
  }
コード例 #2
0
  @Override
  protected void doExecute() throws MojoExecutionException, MojoFailureException {
    final MavenProject project = buildContext.getSession().getCurrentProject();

    @SuppressWarnings("unchecked")
    final Collection<Artifact> artifacts =
        (Collection<Artifact>) project.getContextValue("osgified-artifacts");

    final RepositorySystemSession session = buildContext.getRepositorySession();

    final InstallRequest installRequest = new InstallRequest();
    installRequest.setArtifacts(artifacts);
    try {
      repositorySystem.install(session, installRequest);
    } catch (InstallationException e) {
      throw pipe(e);
    }
  }
コード例 #3
0
  public void setupProjects(
      final MavenSession session, final MavenProject project, final ReactorProject reactorProject) {
    TargetPlatformConfiguration configuration =
        (TargetPlatformConfiguration)
            project.getContextValue(TychoConstants.CTX_TARGET_PLATFORM_CONFIGURATION);
    List<Map<String, String>> environments = getEnvironments(configuration);

    CompilerOptions compilerOptions = compilerOptionsManager.getCompilerOptions(project);

    IDependencyMetadata metadata =
        generator.generateMetadata(
            new ReactorArtifactFacade(reactorProject, null),
            environments,
            compilerOptions.getOptionalResolutionAction());
    reactorProject.setDependencyMetadata(null, true, metadata.getMetadata(true));
    reactorProject.setDependencyMetadata(null, false, metadata.getMetadata(false));

    // let external providers contribute additional metadata
    try {
      pluginRealmHelper.execute(
          session,
          project,
          new Runnable() {
            public void run() {
              try {
                for (P2MetadataProvider provider : plexus.lookupList(P2MetadataProvider.class)) {
                  provider.setupProject(session, project, reactorProject);
                }
              } catch (ComponentLookupException e) {
                // have not found anything
              }
            }
          },
          new PluginFilter() {
            public boolean accept(PluginDescriptor descriptor) {
              return isTychoP2Plugin(descriptor);
            }
          });
    } catch (MavenExecutionException e) {
      throw new RuntimeException(e);
    }
  }
コード例 #4
0
 /**
  * Return the {@link MavenProject} which is the base module for scanning and analysis.
  *
  * <p>The base module is by searching with the module tree starting from the current module over
  * its parents until a module is found containing a directory "jqassistant" or no parent can be
  * determined.
  *
  * @param module The current module.
  * @param rulesDirectory The name of the directory used for identifying the root module
  * @return The {@link MavenProject} containing a rules directory.
  * @throws MojoExecutionException If the directory cannot be resolved.
  */
 static MavenProject getRootModule(MavenProject module, String rulesDirectory)
     throws MojoExecutionException {
   String rootModuleContextKey = ProjectResolver.class.getName() + "#rootModule";
   MavenProject rootModule = (MavenProject) module.getContextValue(rootModuleContextKey);
   if (rootModule == null) {
     File directory = getRulesDirectory(module, rulesDirectory);
     if (directory.exists() && directory.isDirectory()) {
       rootModule = module;
     } else {
       MavenProject parent = module.getParent();
       if (parent != null && parent.getBasedir() != null) {
         rootModule = getRootModule(parent, rulesDirectory);
       } else {
         rootModule = module;
       }
     }
     module.setContextValue(rootModuleContextKey, rootModule);
   }
   return rootModule;
 }
コード例 #5
0
  public TargetPlatformConfiguration getTargetPlatformConfiguration(
      MavenSession session, MavenProject project) {
    TargetPlatformConfiguration result = new TargetPlatformConfiguration();

    // Use org.eclipse.tycho:target-platform-configuration/configuration/environment, if provided
    Plugin plugin = project.getPlugin("org.eclipse.tycho:target-platform-configuration");

    if (plugin != null) {
      Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration();
      if (configuration != null) {
        if (logger.isDebugEnabled()) {
          logger.debug(
              "target-platform-configuration for "
                  + project.toString()
                  + ":\n"
                  + configuration.toString());
        }

        addTargetEnvironments(result, project, configuration);

        setTargetPlatformResolver(result, configuration);

        setTarget(result, session, project, configuration);

        setPomDependencies(result, configuration);

        setAllowConflictingDependencies(result, configuration);

        setDisableP2Mirrors(result, configuration);

        setExecutionEnvironment(result, configuration);

        readFilters(result, configuration);

        readExtraRequirements(result, configuration);

        setOptionalDependencies(result, configuration);

        setIncludePackedArtifacts(result, configuration);
      }
    }

    if (result.getEnvironments().isEmpty()) {
      TychoProject projectType = projectTypes.get(project.getPackaging());
      if (projectType != null) {
        TargetEnvironment env = projectType.getImplicitTargetEnvironment(project);
        if (env != null) {
          if (logger.isDebugEnabled()) {
            logger.debug(
                "Implicit target environment for " + project.toString() + ": " + env.toString());
          }

          result.addEnvironment(env);
        }
      }
    }

    if (result.getEnvironments().isEmpty()) {
      // applying defaults
      logger.warn(
          "No explicit target runtime environment configuration. Build is platform dependent.");

      // Otherwise, use project or execution properties, if provided
      Properties properties =
          (Properties) project.getContextValue(TychoConstants.CTX_MERGED_PROPERTIES);

      // Otherwise, use current system os/ws/nl/arch
      String os = PlatformPropertiesUtils.getOS(properties);
      String ws = PlatformPropertiesUtils.getWS(properties);
      String arch = PlatformPropertiesUtils.getArch(properties);

      result.addEnvironment(new TargetEnvironment(os, ws, arch));

      result.setImplicitTargetEnvironment(true);
    } else {
      result.setImplicitTargetEnvironment(false);
    }

    return result;
  }