当前位置: 首页>>代码示例>>Java>>正文


Java CompilationLevel.ADVANCED_OPTIMIZATIONS属性代码示例

本文整理汇总了Java中com.google.javascript.jscomp.CompilationLevel.ADVANCED_OPTIMIZATIONS属性的典型用法代码示例。如果您正苦于以下问题:Java CompilationLevel.ADVANCED_OPTIMIZATIONS属性的具体用法?Java CompilationLevel.ADVANCED_OPTIMIZATIONS怎么用?Java CompilationLevel.ADVANCED_OPTIMIZATIONS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.javascript.jscomp.CompilationLevel的用法示例。


在下文中一共展示了CompilationLevel.ADVANCED_OPTIMIZATIONS属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: GccMinifier

public GccMinifier(MinifyBuilder builder, IFile srcFile, IFile destFile, 
		OutputStream out, IEclipsePreferences prefs)
	throws IOException, CoreException {
	super(builder);
	this.srcFile = srcFile;
	this.out = out;
	this.outCharset = destFile.exists() ? destFile.getCharset() : "ascii";
	console = builder.minifierConsole();

	String optLevel = prefs.get(PrefsAccess.preferenceKey(
			srcFile, MinifyBuilder.GCC_OPTIMIZATION),
			MinifyBuilder.GCC_OPT_WHITESPACE_ONLY);
	switch (optLevel) {
	case MinifyBuilder.GCC_OPT_ADVANCED:
		compilationLevel = CompilationLevel.ADVANCED_OPTIMIZATIONS;
		break;
	case MinifyBuilder.GCC_OPT_SIMPLE:
		compilationLevel = CompilationLevel.SIMPLE_OPTIMIZATIONS;
		break;
	default:
		compilationLevel = CompilationLevel.WHITESPACE_ONLY;
	}
}
 
开发者ID:mnlipp,项目名称:EclipseMinifyBuilder,代码行数:23,代码来源:GccMinifier.java

示例2: setCompilationLevel

/**
 * Set the compilation level.
 * @param value The optimization level by string name.
 *     (whitespace, simple, advanced).
 */
public void setCompilationLevel(String value) {
  if ("simple".equalsIgnoreCase(value)) {
    this.compilationLevel = CompilationLevel.SIMPLE_OPTIMIZATIONS;
  } else if ("advanced".equalsIgnoreCase(value)) {
    this.compilationLevel = CompilationLevel.ADVANCED_OPTIMIZATIONS;
  } else if ("whitespace".equalsIgnoreCase(value)) {
    this.compilationLevel = CompilationLevel.WHITESPACE_ONLY;
  } else {
    throw new BuildException(
        "Unrecognized 'compilation' option value (" + value + ")");
  }
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:17,代码来源:CompileTask.java

示例3: testEnumToArgv

@Test
public static void testEnumToArgv() throws Exception {
  JsOptions opts = new JsOptions();
  opts.compilationLevel = CompilationLevel.ADVANCED_OPTIMIZATIONS;

  assertEquals(
      ImmutableList.of("--compilation_level", "ADVANCED_OPTIMIZATIONS"),
      sanityCheckArgv(opts));
}
 
开发者ID:mikesamuel,项目名称:closure-maven-plugin,代码行数:9,代码来源:JsOptionsTest.java

示例4: testAggregatedSourceMapIsCreated

@Test
public void testAggregatedSourceMapIsCreated() throws IOException, MojoExecutionException, MojoFailureException {
    JavaScriptCompilerMojo mojo = new JavaScriptCompilerMojo();
    mojo.googleClosureMinifierSuffix = "-min";
    mojo.basedir = new File("target/junk/root");
    mojo.buildDirectory = new File(mojo.basedir, "target");
    MavenProject project = mock(MavenProject.class);
    when(project.getArtifactId()).thenReturn("my-artifact");
    mojo.project = project;
    mojo.googleClosureCompilationLevel = CompilationLevel.ADVANCED_OPTIMIZATIONS;
    mojo.googleClosureMap = true;

    Aggregation aggregation = new Aggregation();
    aggregation.setMinification(true);

    JavaScript javascript = new JavaScript();
    javascript.setAggregations(singletonList(new Aggregation()));
    mojo.javascript = javascript;

    mojo.execute();

    File map = new File(mojo.getDefaultOutputFile(aggregation).getParentFile(), "my-artifact-min.js.map");

    assertThat(mojo.getDefaultOutputFile(aggregation)).hasContent("\n//# sourceMappingURL=my-artifact-min.js.map");
    assertThat(map).exists();
    assertThat(lineIterator(map)).contains("\"file\":\"my-artifact-min.js\",");
}
 
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:27,代码来源:JavaScriptCompilerMojoTest.java


注:本文中的com.google.javascript.jscomp.CompilationLevel.ADVANCED_OPTIMIZATIONS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。