コード例 #1
0
  @Nullable
  public static FlexUnitSupport getSupport(
      @Nullable FlexBuildConfiguration bc, final Module module) {
    if (bc == null) return null;

    return getSupport(FlexUtils.getModuleWithDependenciesAndLibrariesScope(module, bc, true));
  }
コード例 #2
0
  @Nullable
  public static FlexUnitSupport getSupport(@Nullable Module module) {
    if (module == null) return null;
    if (ModuleType.get(module) != FlexModuleType.getInstance()
        || FlexUtils.getSdkForActiveBC(module) == null) return null;

    return getSupport(GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module));
  }
コード例 #3
0
  public void cacheBC(
      final Module module, final FlexBuildConfiguration bc, final List<VirtualFile> configFiles) {
    Collection<BCInfo> infosForModule = myCache.get(module);
    if (infosForModule == null) {
      infosForModule = new ArrayList<BCInfo>();
      myCache.put(module, infosForModule);
    } else {
      final BCInfo existingInfo = findCacheForBC(infosForModule, bc);
      if (existingInfo != null) {
        infosForModule.remove(existingInfo);
      }
    }

    final VirtualFile outputFile =
        FlexCompilationManager.refreshAndFindFileInWriteAction(bc.getActualOutputFilePath());
    if (outputFile == null) return;

    final BCInfo bcInfo =
        new BCInfo(Factory.getCopy(bc), ModuleRootManager.getInstance(module).getSourceRootUrls());
    infosForModule.add(bcInfo);

    bcInfo.addFileDependency(outputFile.getPath());

    final String workDirPath = FlexUtils.getFlexCompilerWorkDirPath(module.getProject(), null);
    for (VirtualFile configFile : configFiles) {
      addFileDependencies(bcInfo, configFile, workDirPath);
    }

    if (bc.isTempBCForCompilation()
        && !bc.getCompilerOptions().getAdditionalConfigFilePath().isEmpty()) {
      bcInfo.addFileDependency(bc.getCompilerOptions().getAdditionalConfigFilePath());
    }

    final BuildConfigurationNature nature = bc.getNature();
    if (nature.isApp() && !nature.isWebPlatform()) {
      if (nature.isDesktopPlatform()) {
        if (!bc.getAirDesktopPackagingOptions().isUseGeneratedDescriptor()) {
          bcInfo.addFileDependency(bc.getAirDesktopPackagingOptions().getCustomDescriptorPath());
        }
      } else {
        if (bc.getAndroidPackagingOptions().isEnabled()
            && !bc.getAndroidPackagingOptions().isUseGeneratedDescriptor()) {
          bcInfo.addFileDependency(bc.getAndroidPackagingOptions().getCustomDescriptorPath());
        }
        if (bc.getIosPackagingOptions().isEnabled()
            && !bc.getIosPackagingOptions().isUseGeneratedDescriptor()) {
          bcInfo.addFileDependency(bc.getIosPackagingOptions().getCustomDescriptorPath());
        }
      }
    }
  }
コード例 #4
0
  private static void addFileDependencies(
      final BCInfo bcInfo, final VirtualFile configFile, final String workDirPath) {
    bcInfo.addFileDependency(configFile.getPath());

    try {
      final Map<String, List<String>> elementsMap =
          FlexUtils.findXMLElements(
              configFile.getInputStream(), Arrays.asList(TAGS_FOR_FILE_PATHS_IN_CONFIG_FILE));
      for (List<String> filePathList : elementsMap.values()) {
        for (String filePath : filePathList) {
          bcInfo.addFileDependency(filePath, configFile.getParent().getPath(), workDirPath);
        }
      }
    } catch (IOException e) {
      /*ignore*/
    }
  }