コード例 #1
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());
        }
      }
    }
  }
コード例 #2
0
  private void addMandatoryOptions(final Element rootElement) {
    if (!FlexCommonUtils.isRLMTemporaryBC(myBC)
        && !FlexCommonUtils.isRuntimeStyleSheetBC(myBC)
        && FlexCommonUtils.canHaveRLMsAndRuntimeStylesheets(myBC)
        && myBC.getRLMs().size() > 0) {
      addOption(rootElement, CompilerOptionInfo.LINK_REPORT_INFO, getLinkReportFilePath(myBC));
    }

    if (FlexCommonUtils.isRLMTemporaryBC(myBC) && !myBC.getOptimizeFor().isEmpty()) {
      final String customLinkReportPath = getCustomLinkReportPath(myBC);
      final String linkReportPath =
          StringUtil.notNullize(customLinkReportPath, getLinkReportFilePath(myBC));
      addOption(rootElement, CompilerOptionInfo.LOAD_EXTERNS_INFO, linkReportPath);
    }

    addOption(rootElement, CompilerOptionInfo.WARN_NO_CONSTRUCTOR_INFO, "false");
    if (myFlexmojos) return;

    final BuildConfigurationNature nature = myBC.getNature();
    final String targetPlayer =
        nature.isWebPlatform()
            ? myBC.getDependencies().getTargetPlayer()
            : FlexCommonUtils.getMaximumTargetPlayer(mySdk.getHomePath());
    addOption(rootElement, CompilerOptionInfo.TARGET_PLAYER_INFO, targetPlayer);

    if (FlexCommonUtils.isAirSdkWithoutFlex(mySdk)
        || StringUtil.compareVersionNumbers(mySdk.getVersionString(), "4.5") >= 0) {
      final String swfVersion;
      if (nature.isWebPlatform()) {
        swfVersion = FlexCommonUtils.getSwfVersionForTargetPlayer(targetPlayer);
      } else {
        String airVersion = getAirVersionIfCustomDescriptor(myBC);
        if (airVersion == null) {
          airVersion = FlexCommonUtils.getAirVersion(mySdk.getHomePath(), mySdk.getVersionString());
        }
        swfVersion =
            airVersion != null
                ? FlexCommonUtils.getSwfVersionForAirVersion(airVersion)
                : FlexCommonUtils.getSwfVersionForSdk_THE_WORST_WAY(mySdk.getVersionString());
      }

      addOption(rootElement, CompilerOptionInfo.SWF_VERSION_INFO, swfVersion);
    }

    if (nature.isMobilePlatform()) {
      addOption(rootElement, CompilerOptionInfo.MOBILE_INFO, "true");
      addOption(rootElement, CompilerOptionInfo.PRELOADER_INFO, "spark.preloaders.SplashScreen");
    }

    if (!FlexCommonUtils.isAirSdkWithoutFlex(mySdk)) {
      final String accessible =
          nature.isMobilePlatform()
              ? "false"
              : StringUtil.compareVersionNumbers(mySdk.getVersionString(), "4") >= 0
                  ? "true"
                  : "false";
      addOption(rootElement, CompilerOptionInfo.ACCESSIBLE_INFO, accessible);

      final String fontManagers =
          StringUtil.compareVersionNumbers(mySdk.getVersionString(), "4") >= 0
              ? "flash.fonts.JREFontManager"
                  + CompilerOptionInfo.LIST_ENTRIES_SEPARATOR
                  + "flash.fonts.BatikFontManager"
                  + CompilerOptionInfo.LIST_ENTRIES_SEPARATOR
                  + "flash.fonts.AFEFontManager"
                  + CompilerOptionInfo.LIST_ENTRIES_SEPARATOR
                  + "flash.fonts.CFFFontManager"
              : "flash.fonts.JREFontManager"
                  + CompilerOptionInfo.LIST_ENTRIES_SEPARATOR
                  + "flash.fonts.AFEFontManager"
                  + CompilerOptionInfo.LIST_ENTRIES_SEPARATOR
                  + "flash.fonts.BatikFontManager";
      addOption(rootElement, CompilerOptionInfo.FONT_MANAGERS_INFO, fontManagers);

      addOption(rootElement, CompilerOptionInfo.STATIC_RSLS_INFO, "false");
    }
  }
コード例 #3
0
  @NotNull
  public List<BuildRootDescriptor> computeRootDescriptors(
      final JpsModel model,
      final ModuleExcludeIndex index,
      final IgnoredFileIndex ignoredFileIndex,
      final BuildDataPaths dataPaths) {
    final List<BuildRootDescriptor> result = new ArrayList<BuildRootDescriptor>();

    final Collection<File> srcRoots = new ArrayList<File>();

    for (JpsModuleSourceRoot sourceRoot :
        myBC.getModule().getSourceRoots(JavaSourceRootType.SOURCE)) {
      final File root = JpsPathUtil.urlToFile(sourceRoot.getUrl());
      result.add(new FlexSourceRootDescriptor(this, root));
      srcRoots.add(root);
    }

    if (FlexCommonUtils.isFlexUnitBC(myBC)) {
      for (JpsModuleSourceRoot sourceRoot :
          myBC.getModule().getSourceRoots(JavaSourceRootType.TEST_SOURCE)) {
        final File root = JpsPathUtil.urlToFile(sourceRoot.getUrl());
        result.add(new FlexSourceRootDescriptor(this, root));
        srcRoots.add(root);
      }
    }

    for (final JpsFlexDependencyEntry entry : myBC.getDependencies().getEntries()) {
      if (entry instanceof JpsFlexBCDependencyEntry) {
        final JpsFlexBuildConfiguration dependencyBC = ((JpsFlexBCDependencyEntry) entry).getBC();
        if (dependencyBC != null) {
          result.add(
              new FlexSourceRootDescriptor(this, new File(dependencyBC.getActualOutputFilePath())));
        }
      } else if (entry instanceof JpsLibraryDependencyEntry) {
        final JpsLibrary library = ((JpsLibraryDependencyEntry) entry).getLibrary();
        if (library != null) {
          for (String rootUrl : library.getRootUrls(JpsOrderRootType.COMPILED)) {
            result.add(new FlexSourceRootDescriptor(this, JpsPathUtil.urlToFile(rootUrl)));
          }
        }
      }
    }

    final BuildConfigurationNature nature = myBC.getNature();

    if (nature.isWebPlatform()
        && nature.isApp()
        && myBC.isUseHtmlWrapper()
        && !myBC.getWrapperTemplatePath().isEmpty()) {
      addIfNotUnderRoot(result, new File(myBC.getWrapperTemplatePath()), srcRoots);
    }

    if (FlexCommonUtils.canHaveRLMsAndRuntimeStylesheets(myBC)) {
      for (String cssPath : myBC.getCssFilesToCompile()) {
        if (!cssPath.isEmpty()) {
          addIfNotUnderRoot(result, new File(cssPath), srcRoots);
        }
      }
    }

    if (!myBC.getCompilerOptions().getAdditionalConfigFilePath().isEmpty()) {
      addIfNotUnderRoot(
          result, new File(myBC.getCompilerOptions().getAdditionalConfigFilePath()), srcRoots);
    }

    if (nature.isApp()) {
      if (nature.isDesktopPlatform()) {
        addAirDescriptorPathIfCustom(result, myBC.getAirDesktopPackagingOptions(), srcRoots);
      } else if (nature.isMobilePlatform()) {
        if (myBC.getAndroidPackagingOptions().isEnabled()) {
          addAirDescriptorPathIfCustom(result, myBC.getAndroidPackagingOptions(), srcRoots);
        }
        if (myBC.getIosPackagingOptions().isEnabled()) {
          addAirDescriptorPathIfCustom(result, myBC.getIosPackagingOptions(), srcRoots);
        }
      }
    }

    return result;
  }