private void populate() {
    List<IModule> modules = collectModules();
    {
      ModulePoolNamespaceBuilder builder = new ModulePoolNamespaceBuilder();
      TextTreeNode solutions = new TextTreeNode("Solutions");
      for (IModule s : modules) {
        if (s instanceof Solution || s instanceof ProjectStructureModule) {
          builder.addNode(ProjectModuleTreeNode.createFor(myProject, s, true));
        }
      }
      builder.fillNode(solutions);
      add(solutions);
    }

    {
      ModulePoolNamespaceBuilder builder = new ModulePoolNamespaceBuilder();
      TextTreeNode languages = new TextTreeNode("Languages");
      for (Language l : CollectionUtil.filter(Language.class, modules)) {
        builder.addNode(ProjectModuleTreeNode.createFor(myProject, l, true));
      }
      builder.fillNode(languages);
      add(languages);
    }

    {
      ModulePoolNamespaceBuilder builder = new ModulePoolNamespaceBuilder();
      TextTreeNode devkits = new TextTreeNode("DevKits");
      for (DevKit devKit : CollectionUtil.filter(DevKit.class, modules)) {
        builder.addNode(ProjectModuleTreeNode.createFor(myProject, devKit, true));
      }
      builder.fillNode(devkits);
      add(devkits);
    }
  }
示例#2
0
    public void test_checkContract() throws Exception {
      this.addNodeById("8150353254540236423");
      this.addNodeById("8150353254540236549");
      this.addNodeById("4195712261513743410");
      Set<String> savedMethods = this.getPreviousISNodeMethodsNames();
      Set<String> currentMethods = this.getISNodeMethodsNames(true);
      List<String> newContract = CollectionUtil.subtract(currentMethods, savedMethods);
      List<String> deletedContract = CollectionUtil.subtract(savedMethods, currentMethods);

      StringBuilder error = new StringBuilder("Contract for SNode changed!");
      error = new StringBuilder("Contract for SNode changed!");
      error.append(System.getProperty("line.separator"));
      error.append("New methods in SNode:");
      error.append(System.getProperty("line.separator"));
      for (String s : newContract) {
        error.append(s);
        error.append(System.getProperty("line.separator"));
      }
      error.append(System.getProperty("line.separator"));
      error.append("Deleted methods in SNode:");
      error.append(System.getProperty("line.separator"));
      for (String s : deletedContract) {
        error.append(s);
        error.append(System.getProperty("line.separator"));
      }

      Assert.assertTrue(error.toString(), newContract.isEmpty() && deletedContract.isEmpty());
    }
示例#3
0
 protected IModule[] getVariants() {
   List<IModule> solutionsList =
       CollectionUtil.filter(
           this.myMpsProject.getModules(),
           new Condition<IModule>() {
             public boolean met(IModule module) {
               return module instanceof Solution;
             }
           });
   return ListSequence.fromList(solutionsList).toGenericArray(IModule.class);
 }
示例#4
0
  @Override
  protected void executeTask(Project project, MpsWorker.ObjectsToProcess go) {
    Set<SModule> toCompile = SetSequence.fromSet(new LinkedHashSet<SModule>());
    SetSequence.fromSet(toCompile).addSequence(SetSequence.fromSet(go.getModules()));
    for (Project p : go.getProjects()) {
      SetSequence.fromSet(toCompile).addSequence(SetSequence.fromSet(go.getModules()));
    }
    for (final SModel modelDescriptor : go.getModels()) {
      SModule owningModule =
          ModelAccess.instance()
              .runReadAction(
                  new Computable<SModule>() {
                    public SModule compute() {
                      return modelDescriptor.getModule();
                    }
                  });
      SetSequence.fromSet(toCompile).addElement(owningModule);
    }
    final Set<SModule> finalToCompile =
        CollectionUtil.filter(
            toCompile,
            new Condition<SModule>() {
              public boolean met(SModule module) {
                boolean compileInMps =
                    !(module instanceof IModule) || ((IModule) module).isCompileInMPS();
                return compileInMps && !(module.isPackaged());
              }
            });
    if (finalToCompile.isEmpty()) {
      return;
    }
    info("Starting compilation:");
    StringBuffer sb = new StringBuffer();
    for (SModule m : finalToCompile) {
      sb.append("    ");
      sb.append(m.getModuleName());
      sb.append("\n");
    }
    info(sb.toString());
    MPSCompilationResult result =
        ModelAccess.instance()
            .runReadAction(
                new Computable<MPSCompilationResult>() {
                  public MPSCompilationResult compute() {
                    return new ModuleMaker()
                        .make(
                            finalToCompile,
                            new EmptyProgressMonitor() {
                              @Override
                              public void step(String text) {
                                info("    " + text);
                              }

                              @Override
                              public void start(String taskName, int work) {
                                info(taskName);
                              }
                            });
                  }
                });
    info(result.toString());
  }
示例#5
0
 protected Collection<Language> getInitialUsedLanguages() {
   return CollectionUtil.filter(Language.class, getInitialModules());
 }