Package aQute.bnd.build

Examples of aQute.bnd.build.Project


        context.registerService(Workspace.class.getName(), ws, null);
    }

    public Project getModel(IJavaProject project) {
        try {
            Project model = javaProjectToModel.get(project);
            if (model == null) {
                File projectDir = project.getProject().getLocation()
                        .makeAbsolute().toFile();
                model = Workspace.getProject(projectDir);
                if (workspace == null) {
                    model.getWorkspace();
                }
                if (model != null) {
                    javaProjectToModel.put(project, model);
                }
            }
View Full Code Here


                                                .getCurrentProjects());
                                    }
                                    return false;
                                }
                                if (workspace.isPresent(file.getName())) {
                                    Project project = workspace.getProject(file
                                            .getName());
                                    changed.add(project);
                                } else {
                                    ; // Project not created yet, so we
                                    // have
View Full Code Here

        throw new BuildException("The given base dir does not exist " + basedir);

      Workspace workspace = Workspace.getWorkspace(basedir.getParentFile());
      workspace.addBasicPlugin(new ConsoleProgress());
     
      Project project = workspace.getProject(basedir.getName());
      if (project == null)
        throw new BuildException("Unable to find bnd project in directory: " + basedir);

      project.setProperty("in.ant", "true");
      project.setProperty("environment", "ant");

      // Check if we are in a sub build, in that case
      // top will be set to the target directory at the
      // top project.
      if (top != null && top.length() > 0 && !top.startsWith("$"))
        project.setProperty("top", top);

      project.setExceptions(true);
      Properties properties = project.getFlattenedProperties();
      if (report() || report(project))
        throw new BuildException("Errors during Eclipse Path inspection");

      copyProperties(properties);
    }
View Full Code Here

  String  releaseRepo  = null;

  @Override
  public void execute() throws BuildException {
    try {
      Project project = Workspace.getProject(getProject().getBaseDir());
      if (releaseRepo == null) {
        project.release(false);
      } else {
        project.release(releaseRepo);
      }

      if (report(project))
        throw new BuildException("Release failed");
    }
View Full Code Here

  public void execute() throws BuildException {
    try {
      if (basedir == null || !basedir.isDirectory())
        throw new BuildException("The given base dir does not exist " + basedir);

      Project project = Workspace.getProject(basedir);
      project.build(underTest);
      report(project);
    }
    catch (Exception e) {
      e.printStackTrace();
      throw new BuildException(e);
View Full Code Here

  @Override
  public void execute() throws BuildException {
    try {
      createReleaseDir();
      Project bndProject = new Project(new Workspace(rootDir), buildProject, bndFile);
      List<RepositoryPlugin> repositories = bndProject.getPlugins(RepositoryPlugin.class);
      if (allowSnapshots) {
        snapshots = indexBundleSnapshots();
      }

      for (Container runBundle : bndProject.getRunbundles()) {
        String bsn = runBundle.getBundleSymbolicName();
        if (bsn.endsWith(".jar")) {
          bsn = bsn.substring(0, bsn.indexOf(".jar"));
        }
        if (allowSnapshots && snapshots.containsKey(bsn)) {
          Jar jar = snapshots.get(bsn);
          jar.write(new File(outputDir, runBundle.getFile().getName()));
        } else {
          Version version = null;
          File foundJar = null;

          for (RepositoryPlugin repo : repositories) {
            SortedSet<Version> versions = repo.versions(bsn);
            if (!versions.isEmpty()) {
              Version foundVersion = versions.last();
              if (version == null || foundVersion.compareTo(version) == 1) {
                version = foundVersion;
                foundJar = repo.get(bsn, version, null);
              }
            }
          }

          if (foundJar != null) {
            File outputFile = new File(outputDir, foundJar.getName());
            FileChannel source = null;
            FileChannel destination = null;

            try {
              source = new FileInputStream(foundJar).getChannel();
              destination = new FileOutputStream(outputFile).getChannel();
              destination.transferFrom(source, 0, source.size());
            }
            finally {
              if (source != null) {
                source.close();
              }

              if (destination != null) {
                destination.close();
              }
            }
          } else {
            log(bsn + " could not be found in any repository");
          }
        }
      }

      bndProject.close();
    }
    catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

    OutputStream outStream = null;
    try {
      // Prepare the project to be packaged
      List<Project> projects;
      File baseDir = getProject().getBaseDir();
      Project baseProject = Workspace.getProject(baseDir);

      Project packageProject;
      if (runFilePath == null || runFilePath.length() == 0 || ".".equals(runFilePath)) {
        packageProject = baseProject;
      } else {
        File runFile = new File(baseDir, runFilePath);
        if (!runFile.isFile())
          throw new BuildException(String.format("Run file %s does not exist (or is not a file).", runFile.getAbsolutePath()));
        packageProject = new Project(baseProject.getWorkspace(), baseDir, runFile);
        packageProject.setParent(baseProject);
      }

      // Package it
      packageProject.clear();
      ProjectLauncher launcher = packageProject.getProjectLauncher();
      launcher.setKeep(keep);
      Jar jar = launcher.executable();

      outStream = new FileOutputStream(output);
      jar.write(outStream);
View Full Code Here

    try {
      // Prepare list of projects...
      List<Project> projects;
      File baseDir = getProject().getBaseDir();
      Project baseProject = Workspace.getProject(baseDir);
      if (runFiles == null) {
        projects = Collections.singletonList(baseProject);
      } else {
        StringTokenizer tokenizer = new StringTokenizer(runFiles, ",");
        projects = new LinkedList<Project>();
        while (tokenizer.hasMoreTokens()) {
          String runFilePath = tokenizer.nextToken().trim();
          Project runProject;
          if (".".equals(runFilePath)) {
            runProject = baseProject;
          } else {
            File runFile = new File(baseDir, runFilePath);
            if (!runFile.isFile())
              throw new BuildException(String.format("Run file %s does not exist (or is not a file).",
                  runFile.getAbsolutePath()));
            runProject = new Project(baseProject.getWorkspace(), baseDir, runFile);
            runProject.setParent(baseProject);
          }
          projects.add(runProject);
        }
      }
View Full Code Here

    if (basedir == null)
      throw new BuildException("No basedir set");

    try {
      Project project = Workspace.getProject(basedir);

      Workspace ws = project.getWorkspace();
      for (Property prop : workspaceProps) {
        ws.setProperty(prop.getName(), prop.getValue());
      }

      project.setProperty("in.ant", "true");
      project.setProperty("environment", "ant");
      project.setExceptions(true);
      project.setTrace(trace);
      project.setPedantic(pedantic);

      for (Property prop : properties) {
        project.setProperty(prop.getName(), prop.getValue());
      }

      project.action(command);

      for (Project p : ws.getCurrentProjects())
        ws.getInfo(p, p + ":");

      if (report(ws))
View Full Code Here

  List<FileSet>  filesets  = new ArrayList<FileSet>();

  @Override
  public void execute() throws BuildException {
    try {
      Project project = Workspace.getProject(getProject().getBaseDir());

      // Deploy the files that need to be released
      for (FileSet fileset : filesets) {
        DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
        String[] files = ds.getIncludedFiles();
        if (files.length == 0)
          trace("No files included");

        for (int i = 0; i < files.length; i++) {
          File file = new File(ds.getBasedir(), files[i]);
          try {
            if (file.isFile() && file.getName().endsWith(".jar")) {
              if (deployRepo != null)
                project.deploy(deployRepo, file);
              else
                project.deploy(file);
            } else
              messages.NotAJarFile_(file);
          }
          catch (Exception e) {
            messages.FailedToDeploy_Exception_(file, e);
          }
        }
      }
      report(project);
      if (project.getErrors().size() > 0)
        throw new BuildException("Deploy failed");
    }
    catch (Throwable t) {
      t.printStackTrace();
      throw new BuildException(t);
View Full Code Here

TOP

Related Classes of aQute.bnd.build.Project

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.