<commit_before>package org.jetbrains.idea.devkit.build;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.projectRoots.ProjectJdk;
import com.intellij.openapi.roots.LibraryOrderEntry;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.OrderEntry;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.util.Computable;
import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.devkit.projectRoots.IdeaJdk;
import org.jetbrains.idea.devkit.projectRoots.Sandbox;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Set;

/**
 * User: anna
 * Date: Nov 24, 2004
 */
public class PluginBuildUtil {

  @Nullable public static String getPluginExPath(Module module) {
    final ProjectJdk jdk = ModuleRootManager.getInstance(module).getJdk();
    if (jdk == null || !(jdk.getSdkType() instanceof IdeaJdk)) {
      return null;
    }
    String sandboxHome = ((Sandbox)jdk.getSdkAdditionalData()).getSandboxHome();
    try {
      sandboxHome = new File(sandboxHome).getCanonicalPath();
    }
    catch (IOException e) {
      return null;
    }
    return sandboxHome + File.separator + "plugins" + File.separator + module.getName();
  }

  public static void getDependencies(Module module, Set<Module> modules) {
    if (modules.contains(module)) return;
    Module[] dependencies = ModuleRootManager.getInstance(module).getDependencies();
    for (int i = 0; i < dependencies.length; i++) {
      Module dependency = dependencies[i];
      if (dependency.getModuleType() == ModuleType.JAVA) {
        modules.add(dependency);
        getDependencies(dependency, modules);
      }
    }
  }

  public static Module[] getWrongSetDependencies(final Module module) {
    return ApplicationManager.getApplication().runReadAction(new Computable<Module[]>() {
      public Module[] compute() {
        ArrayList<Module> result = new ArrayList<Module>();
        final Module[] projectModules = ModuleManager.getInstance(module.getProject()).getModules();
        for (int i = 0; i < projectModules.length; i++) {<commit_msg>SCR # 48003<commit_after>package org.jetbrains.idea.devkit.build;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.projectRoots.ProjectJdk;
import com.intellij.openapi.roots.LibraryOrderEntry;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.OrderEntry;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.util.Computable;
import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.devkit.projectRoots.IdeaJdk;
import org.jetbrains.idea.devkit.projectRoots.Sandbox;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Set;

/**
 * User: anna
 * Date: Nov 24, 2004
 */
public class PluginBuildUtil {

  @Nullable public static String getPluginExPath(Module module) {
    final ProjectJdk jdk = ModuleRootManager.getInstance(module).getJdk();
    if (jdk == null || !(jdk.getSdkType() instanceof IdeaJdk)) {
      return null;
    }
    String sandboxHome = ((Sandbox)jdk.getSdkAdditionalData()).getSandboxHome();
    if (sandboxHome == null) return null;
    try {
      sandboxHome = new File(sandboxHome).getCanonicalPath();
    }
    catch (IOException e) {
      return null;
    }
    return sandboxHome + File.separator + "plugins" + File.separator + module.getName();
  }

  public static void getDependencies(Module module, Set<Module> modules) {
    if (modules.contains(module)) return;
    Module[] dependencies = ModuleRootManager.getInstance(module).getDependencies();
    for (int i = 0; i < dependencies.length; i++) {
      Module dependency = dependencies[i];
      if (dependency.getModuleType() == ModuleType.JAVA) {
        modules.add(dependency);
        getDependencies(dependency, modules);
      }
    }
  }

  public static Module[] getWrongSetDependencies(final Module module) {
    return ApplicationManager.getApplication().runReadAction(new Computable<Module[]>() {
      public Module[] compute() {
        ArrayList<Module> result = new ArrayList<Module>();
        final Module[] projectModules = ModuleManager.getInstance(module.getProject()).getModules();
        for (int i = 0; i < projectModules.length; i++) {
{'fraction_non_alphanumeric': 0.1184934405416843, 'fraction_numerical': 0.004443504020313161, 'mean_word_length': 4.427095292766935, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7549148', 'n_tokens_mistral': 1475, 'n_tokens_neox': 1405, 'n_words': 284}