コード例 #1
0
 @NotNull
 @Override
 public List<PantsSourceRootDescriptor> computeRootDescriptors(
     final JpsModel model,
     final ModuleExcludeIndex index,
     final IgnoredFileIndex ignoredFileIndex,
     final BuildDataPaths dataPaths) {
   final Set<PantsSourceRootDescriptor> result = new HashSet<PantsSourceRootDescriptor>();
   processJavaModuleTargets(
       model.getProject(),
       new Processor<ModuleBuildTarget>() {
         @Override
         public boolean process(ModuleBuildTarget target) {
           final JpsPantsModuleExtension moduleExtension =
               PantsJpsModelSerializerExtension.findPantsModuleExtension(target.getModule());
           final Set<String> targetAddresses =
               moduleExtension != null
                   ? moduleExtension.getTargetAddresses()
                   : Collections.<String>emptySet();
           final List<JavaSourceRootDescriptor> descriptors =
               target.computeRootDescriptors(model, index, ignoredFileIndex, dataPaths);
           for (JavaSourceRootDescriptor javaSourceRootDescriptor : descriptors) {
             result.add(
                 new PantsSourceRootDescriptor(
                     PantsBuildTarget.this,
                     targetAddresses,
                     javaSourceRootDescriptor.getRootFile(),
                     javaSourceRootDescriptor.isGenerated(),
                     javaSourceRootDescriptor.getExcludedRoots()));
           }
           return true;
         }
       });
   return new ArrayList<PantsSourceRootDescriptor>(result);
 }
コード例 #2
0
 protected JpsSdk<JpsDummyElement> addJdk(final String name, final String path) {
   String homePath = System.getProperty("java.home");
   String versionString = System.getProperty("java.version");
   JpsTypedLibrary<JpsSdk<JpsDummyElement>> jdk =
       myModel.getGlobal().addSdk(name, homePath, versionString, JpsJavaSdkType.INSTANCE);
   jdk.addRoot(JpsPathUtil.pathToUrl(path), JpsOrderRootType.COMPILED);
   return jdk.getProperties();
 }
コード例 #3
0
 public void exportModuleOutputProperties() {
   for (JpsModule module : myModel.getProject().getModules()) {
     for (boolean test : new boolean[] {true, false}) {
       myProject.setProperty(
           "module." + module.getName() + ".output." + (test ? "test" : "main"),
           getModuleOutput(module, test));
     }
   }
 }
コード例 #4
0
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   myModel = JpsElementFactory.getInstance().createModel();
   myProject = myModel.getProject();
   myDataStorageRoot = FileUtil.createTempDirectory("compile-server-" + getProjectName(), null);
   myLogger = new TestProjectBuilderLogger();
   myBuildParams = new HashMap<String, String>();
 }
コード例 #5
0
 @NotNull
 @Override
 public List<AndroidProjectBuildTarget> computeAllTargets(@NotNull JpsModel model) {
   if (!AndroidJpsUtil.containsAndroidFacet(model.getProject())) {
     return Collections.emptyList();
   }
   return Arrays.asList(
       new AndroidProjectBuildTarget(AndroidBuilderKind.DEX, model),
       new AndroidProjectBuildTarget(AndroidBuilderKind.PACKAGING, model));
 }
コード例 #6
0
 @Override
 public Collection<BuildTarget<?>> computeDependencies() {
   List<BuildTarget<?>> result = new ArrayList<BuildTarget<?>>();
   if (myKind == AndroidBuilderKind.PACKAGING) {
     result.add(new AndroidProjectBuildTarget(AndroidBuilderKind.DEX, myModel));
   }
   for (JpsModule module : myModel.getProject().getModules()) {
     if (AndroidJpsUtil.getExtension(module) != null) {
       result.add(new ModuleBuildTarget(module, JavaModuleBuildTargetType.PRODUCTION));
     }
   }
   return result;
 }
コード例 #7
0
  public void cleanOutput() {
    if (myDryRun) {
      info("Cleaning skipped as we're running dry");
      return;
    }

    for (JpsModule module : myModel.getProject().getModules()) {
      for (boolean test : new boolean[] {false, true}) {
        File output = JpsJavaExtensionService.getInstance().getOutputDirectory(module, test);
        if (output != null) {
          FileUtil.delete(output);
        }
      }
    }
  }
コード例 #8
0
 public void setTargetFolder(String targetFolder) {
   String url = "file://" + FileUtil.toSystemIndependentName(targetFolder);
   JpsJavaExtensionService.getInstance()
       .getOrCreateProjectExtension(myModel.getProject())
       .setOutputUrl(url);
 }