Ejemplo n.º 1
0
  public void writeConfiguration(ProjectDescriptor pd, final PrintWriter out) {
    out.println("id: " + myId);

    out.println(
        JDOMUtil.writeElement(XmlSerializer.serialize(JpsFlexBCState.getState(myBC)), "\n"));

    final JpsFlexModuleOrProjectCompilerOptions moduleOptions =
        myBC.getModule().getProperties().getModuleLevelCompilerOptions();
    out.println(
        JDOMUtil.writeElement(
            XmlSerializer.serialize(((JpsFlexCompilerOptionsImpl) moduleOptions).getState()),
            "\n"));

    final JpsFlexModuleOrProjectCompilerOptions projectOptions =
        JpsFlexProjectLevelCompilerOptionsExtension.getProjectLevelCompilerOptions(
            myBC.getModule().getProject());
    out.println(
        JDOMUtil.writeElement(
            XmlSerializer.serialize(((JpsFlexCompilerOptionsImpl) projectOptions).getState()),
            "\n"));
  }
Ejemplo n.º 2
0
  public Collection<BuildTarget<?>> computeDependencies(
      BuildTargetRegistry targetRegistry, TargetOutputIndex outputIndex) {
    final ArrayList<BuildTarget<?>> result = new ArrayList<BuildTarget<?>>();

    final FlexResourceBuildTargetType type =
        FlexCommonUtils.isFlexUnitBC(myBC)
            ? FlexResourceBuildTargetType.TEST
            : FlexResourceBuildTargetType.PRODUCTION;
    result.add(new FlexResourceBuildTarget(type, myBC.getModule()));

    for (JpsFlexDependencyEntry entry : myBC.getDependencies().getEntries()) {
      if (entry instanceof JpsFlexBCDependencyEntry) {
        final JpsFlexBuildConfiguration dependencyBC = ((JpsFlexBCDependencyEntry) entry).getBC();
        if (dependencyBC != null) {
          result.add(create(dependencyBC, null));
        }
      }
    }
    result.trimToSize();
    return result;
  }
Ejemplo n.º 3
0
  /**
   * @param forcedDebugStatus <code>true</code> or <code>false</code> means that this bc is compiled
   *     for further packaging and we need swf to have corresponding debug status; <code>null</code>
   *     means that bc is compiled as is (i.e. as configured) without any modifications
   */
  @NotNull
  public static FlexBuildTarget create(
      final @NotNull JpsFlexBuildConfiguration bc, final @Nullable Boolean forcedDebugStatus) {
    final String id =
        FlexCommonUtils.getBuildTargetId(bc.getModule().getName(), bc.getName(), forcedDebugStatus);

    if (forcedDebugStatus == null) {
      return new FlexBuildTarget(bc, id);
    } else {
      // must not use getTemporaryCopyForCompilation() here because additional config file must not
      // be merged with the generated one when compiling swf for release or AIR package
      final JpsFlexBuildConfiguration bcCopy = bc.getModule().getProperties().createCopy(bc);
      final String additionalOptions =
          FlexCommonUtils.removeOptions(
              bc.getCompilerOptions().getAdditionalOptions(), "debug", "compiler.debug");
      bcCopy
          .getCompilerOptions()
          .setAdditionalOptions(additionalOptions + " -debug=" + forcedDebugStatus.toString());
      return new FlexBuildTarget(bcCopy, id);
    }
  }
Ejemplo n.º 4
0
 @NotNull
 public Collection<File> getOutputRoots(CompileContext context) {
   return Collections.singleton(
       new File(PathUtilRt.getParentPath(myBC.getActualOutputFilePath())));
 }
Ejemplo n.º 5
0
 @NotNull
 public String getPresentableName() {
   return FlexCommonBundle.message("bc.0.module.1", myBC.getName(), myBC.getModule().getName());
 }
Ejemplo n.º 6
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;
  }