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


Java CompileSpec类代码示例

本文整理汇总了Java中org.gradle.language.base.internal.compile.CompileSpec的典型用法代码示例。如果您正苦于以下问题:Java CompileSpec类的具体用法?Java CompileSpec怎么用?Java CompileSpec使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createTargetCompiler

import org.gradle.language.base.internal.compile.CompileSpec; //导入依赖的package包/类
private Compiler<JavaCompileSpec> createTargetCompiler(Class<? extends CompileSpec> type, boolean jointCompilation) {
    if (!JavaCompileSpec.class.isAssignableFrom(type)) {
        throw new IllegalArgumentException(String.format("Cannot create a compiler for a spec with type %s", type.getSimpleName()));
    }

    if (CommandLineJavaCompileSpec.class.isAssignableFrom(type)) {
        return new CommandLineJavaCompiler();
    }

    Compiler<JavaCompileSpec> compiler = new JdkJavaCompiler(javaHomeBasedJavaCompilerFactory);
    if (ForkingJavaCompileSpec.class.isAssignableFrom(type) && !jointCompilation) {
        return new DaemonJavaCompiler(daemonWorkingDir, compiler, compilerDaemonFactory);
    }

    return compiler;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:DefaultJavaCompilerFactory.java

示例2: getDaemon

import org.gradle.language.base.internal.compile.CompileSpec; //导入依赖的package包/类
public CompilerDaemon getDaemon(File workingDir, final DaemonForkOptions forkOptions) {
    return new CompilerDaemon() {
        public <T extends CompileSpec> CompileResult execute(Compiler<T> compiler, T spec) {
            ClassLoader groovyClassLoader = classLoaderFactory.createIsolatedClassLoader(new DefaultClassPath(forkOptions.getClasspath()));
            FilteringClassLoader filteredGroovy = classLoaderFactory.createFilteringClassLoader(groovyClassLoader);
            for (String packageName : forkOptions.getSharedPackages()) {
                filteredGroovy.allowPackage(packageName);
            }

            ClassLoader workerClassLoader = new MutableURLClassLoader(filteredGroovy, ClasspathUtil.getClasspath(compiler.getClass().getClassLoader()));

            try {
                byte[] serializedWorker = GUtil.serialize(new Worker<T>(compiler, spec));
                ClassLoaderObjectInputStream inputStream = new ClassLoaderObjectInputStream(new ByteArrayInputStream(serializedWorker), workerClassLoader);
                Callable<?> worker = (Callable<?>) inputStream.readObject();
                Object result = worker.call();
                byte[] serializedResult = GUtil.serialize(result);
                inputStream = new ClassLoaderObjectInputStream(new ByteArrayInputStream(serializedResult), getClass().getClassLoader());
                return (CompileResult) inputStream.readObject();
            } catch (Exception e) {
                throw UncheckedException.throwAsUncheckedException(e);
            }
        }
    };
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:26,代码来源:InProcessCompilerDaemonFactory.java

示例3: newCompiler

import org.gradle.language.base.internal.compile.CompileSpec; //导入依赖的package包/类
@Override
public <T extends CompileSpec> org.gradle.language.base.internal.compile.Compiler<T> newCompiler(Class<T> spec) {
    if (CppCompileSpec.class.isAssignableFrom(spec)) {
        return CompilerUtil.castCompiler(createCppCompiler());
    }
    if (CppPCHCompileSpec.class.isAssignableFrom(spec)) {
        return CompilerUtil.castCompiler(createCppPCHCompiler());
    }
    if (CCompileSpec.class.isAssignableFrom(spec)) {
        return CompilerUtil.castCompiler(createCCompiler());
    }
    if (CPCHCompileSpec.class.isAssignableFrom(spec)) {
        return CompilerUtil.castCompiler(createCPCHCompiler());
    }
    if (ObjectiveCppCompileSpec.class.isAssignableFrom(spec)) {
        return CompilerUtil.castCompiler(createObjectiveCppCompiler());
    }
    if (ObjectiveCppPCHCompileSpec.class.isAssignableFrom(spec)) {
        return CompilerUtil.castCompiler(createObjectiveCppPCHCompiler());
    }
    if (ObjectiveCCompileSpec.class.isAssignableFrom(spec)) {
        return CompilerUtil.castCompiler(createObjectiveCCompiler());
    }
    if (ObjectiveCPCHCompileSpec.class.isAssignableFrom(spec)) {
        return CompilerUtil.castCompiler(createObjectiveCPCHCompiler());
    }
    if (WindowsResourceCompileSpec.class.isAssignableFrom(spec)) {
        return CompilerUtil.castCompiler(createWindowsResourceCompiler());
    }
    if (AssembleSpec.class.isAssignableFrom(spec)) {
        return CompilerUtil.castCompiler(createAssembler());
    }
    if (LinkerSpec.class.isAssignableFrom(spec)) {
        return CompilerUtil.castCompiler(createLinker());
    }
    if (StaticLibraryArchiverSpec.class.isAssignableFrom(spec)) {
        return CompilerUtil.castCompiler(createStaticLibraryArchiver());
    }
    throw new IllegalArgumentException(String.format("Don't know how to compile from a spec of type %s.", spec.getClass().getSimpleName()));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:41,代码来源:AbstractPlatformToolProvider.java

示例4: newCompiler

import org.gradle.language.base.internal.compile.CompileSpec; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <T extends CompileSpec> org.gradle.language.base.internal.compile.Compiler<T> newCompiler(Class<T> spec) {
    if (ScalaJavaJointCompileSpec.class.isAssignableFrom(spec)) {
        Compiler<ScalaJavaJointCompileSpec> scalaCompiler = new ZincScalaCompiler(resolvedScalaClasspath, resolvedZincClasspath, gradleUserHomeDir);
        return (Compiler<T>) new NormalizingScalaCompiler(new DaemonScalaCompiler<ScalaJavaJointCompileSpec>(rootProjectDir, scalaCompiler, compilerDaemonManager, resolvedZincClasspath));
    }
    throw new IllegalArgumentException(String.format("Cannot create Compiler for unsupported CompileSpec type '%s'", spec.getSimpleName()));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:DefaultScalaToolProvider.java

示例5: newCompiler

import org.gradle.language.base.internal.compile.CompileSpec; //导入依赖的package包/类
@Override
public <T extends CompileSpec> Compiler<T> newCompiler(Class<T> spec) {
    if (TwirlCompileSpec.class.isAssignableFrom(spec)) {
        TwirlCompiler twirlCompiler = TwirlCompilerFactory.create(targetPlatform);
        return cast(new DaemonPlayCompiler<TwirlCompileSpec>(fileResolver.resolve("."), twirlCompiler, compilerDaemonManager, twirlClasspath, twirlCompiler.getClassLoaderPackages()));
    } else if (RoutesCompileSpec.class.isAssignableFrom(spec)) {
        RoutesCompiler routesCompiler = RoutesCompilerFactory.create(targetPlatform);
        return cast(new DaemonPlayCompiler<RoutesCompileSpec>(fileResolver.resolve("."), routesCompiler, compilerDaemonManager, routesClasspath, routesCompiler.getClassLoaderPackages()));
    } else if (JavaScriptCompileSpec.class.isAssignableFrom(spec)) {
        GoogleClosureCompiler javaScriptCompiler = new GoogleClosureCompiler();
        return cast(new DaemonPlayCompiler<JavaScriptCompileSpec>(fileResolver.resolve("."), javaScriptCompiler, compilerDaemonManager, javaScriptClasspath, javaScriptCompiler.getClassLoaderPackages()));
    }
    throw new IllegalArgumentException(String.format("Cannot create Compiler for unsupported CompileSpec type '%s'", spec.getSimpleName()));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:15,代码来源:DefaultPlayToolProvider.java

示例6: newCompiler

import org.gradle.language.base.internal.compile.CompileSpec; //导入依赖的package包/类
public <T extends CompileSpec> Compiler<T> newCompiler(T spec) {
    if (spec instanceof CppCompileSpec) {
        return castCompiler(createCppCompiler());
    }
    if (spec instanceof CCompileSpec) {
        return castCompiler(createCCompiler());
    }
    if (spec instanceof ObjectiveCppCompileSpec) {
        return castCompiler(createObjectiveCppCompiler());
    }
    if (spec instanceof ObjectiveCCompileSpec) {
        return castCompiler(createObjectiveCCompiler());
    }
    if (spec instanceof WindowsResourceCompileSpec) {
        throw new RuntimeException("Windows resource compiler is not available");
    }
    if (spec instanceof AssembleSpec) {
        return castCompiler(createAssembler());
    }
    if (spec instanceof LinkerSpec) {
        return castCompiler(createLinker());
    }
    if (spec instanceof StaticLibraryArchiverSpec) {
        return castCompiler(createStaticLibraryArchiver());
    }
    throw new IllegalArgumentException(String.format("Don't know how to compile from a spec of type %s.", spec.getClass().getSimpleName()));
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:28,代码来源:GccPlatformToolProvider.java

示例7: newCompiler

import org.gradle.language.base.internal.compile.CompileSpec; //导入依赖的package包/类
public <T extends CompileSpec> Compiler<T> newCompiler(T spec) {
    if (spec instanceof CppCompileSpec) {
        return castCompiler(createCppCompiler());
    }
    if (spec instanceof CCompileSpec) {
        return castCompiler(createCCompiler());
    }
    if (spec instanceof ObjectiveCppCompileSpec) {
        throw new RuntimeException("Objective-C++ is not available on the Visual C++ toolchain");
    }
    if (spec instanceof ObjectiveCCompileSpec) {
        throw new RuntimeException("Objective-C is not available on the Visual C++ toolchain");
    }
    if (spec instanceof WindowsResourceCompileSpec) {
        return castCompiler(createWindowsResourceCompiler());
    }
    if (spec instanceof AssembleSpec) {
        return castCompiler(createAssembler());
    }
    if (spec instanceof LinkerSpec) {
        return castCompiler(createLinker());
    }
    if (spec instanceof StaticLibraryArchiverSpec) {
        return castCompiler(createStaticLibraryArchiver());
    }
    throw new IllegalArgumentException(String.format("Don't know how to compile from a spec of type %s.", spec.getClass().getSimpleName()));
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:28,代码来源:VisualCppToolChain.java

示例8: getDaemon

import org.gradle.language.base.internal.compile.CompileSpec; //导入依赖的package包/类
public CompilerDaemon getDaemon(final File workingDir, final DaemonForkOptions forkOptions) {
    return new CompilerDaemon() {
        public <T extends CompileSpec> CompileResult execute(org.gradle.language.base.internal.compile.Compiler<T> compiler, T spec) {
            CompilerDaemonClient client = clientsManager.reserveIdleClient(forkOptions);
            if (client == null) {
                client = clientsManager.reserveNewClient(workingDir, forkOptions);
            }
            try {
                return client.execute(compiler, spec);
            } finally {
                clientsManager.release(client);
            }
        }
    };
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:16,代码来源:CompilerDaemonManager.java

示例9: execute

import org.gradle.language.base.internal.compile.CompileSpec; //导入依赖的package包/类
public <T extends CompileSpec> void execute(Compiler<T> compiler, T spec) {
    try {
        LOGGER.info("Executing {} in compiler daemon.", compiler);
        WorkResult result = compiler.execute(spec);
        LOGGER.info("Successfully executed {} in compiler daemon.", compiler);
        client.executed(new CompileResult(result.getDidWork(), null));
    } catch (Throwable t) {
        LOGGER.info("Exception executing {} in compiler daemon: {}.", compiler, t);
        client.executed(new CompileResult(true, t));
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:12,代码来源:CompilerDaemonServer.java

示例10: execute

import org.gradle.language.base.internal.compile.CompileSpec; //导入依赖的package包/类
public <T extends CompileSpec> CompileResult execute(Compiler<T> compiler, T spec) {
    // currently we just allow a single compilation thread at a time (per compiler daemon)
    // one problem to solve when allowing multiple threads is how to deal with memory requirements specified by compile tasks
    try {
        server.execute(compiler, spec);
        return compileResults.take();
    } catch (InterruptedException e) {
        throw UncheckedException.throwAsUncheckedException(e);
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:11,代码来源:CompilerDaemonClient.java

示例11: newCompiler

import org.gradle.language.base.internal.compile.CompileSpec; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public <T extends CompileSpec> Compiler<T> newCompiler(Class<T> spec) {
  if (JavaCompileSpec.class.isAssignableFrom(spec)) {
    return (Compiler<T>) new NormalizingJavaCompiler(new ErrorProneCompiler(configuration));
  }
  throw new IllegalArgumentException(
      String.format("Don't know how to compile using spec of type %s.", spec.getSimpleName()));
}
 
开发者ID:tbroyer,项目名称:gradle-errorprone-plugin,代码行数:10,代码来源:ErrorProneToolChain.java

示例12: newCompiler

import org.gradle.language.base.internal.compile.CompileSpec; //导入依赖的package包/类
@Override
public <T extends CompileSpec> Compiler<T> newCompiler(Class<T> specType) {
    throw failure();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:5,代码来源:UnavailablePlatformToolProvider.java

示例13: createForJointCompilation

import org.gradle.language.base.internal.compile.CompileSpec; //导入依赖的package包/类
@Override
public Compiler<JavaCompileSpec> createForJointCompilation(Class<? extends CompileSpec> type) {
    return createTargetCompiler(type, true);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:5,代码来源:DefaultJavaCompilerFactory.java

示例14: create

import org.gradle.language.base.internal.compile.CompileSpec; //导入依赖的package包/类
@Override
public Compiler<JavaCompileSpec> create(Class<? extends CompileSpec> type) {
    Compiler<JavaCompileSpec> result = createTargetCompiler(type, false);
    return new NormalizingJavaCompiler(result);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:6,代码来源:DefaultJavaCompilerFactory.java

示例15: newCompiler

import org.gradle.language.base.internal.compile.CompileSpec; //导入依赖的package包/类
@Override
public <T extends CompileSpec> Compiler<T> newCompiler(Class<T> spec) {
    throw new IllegalArgumentException(getMessage());
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:5,代码来源:DefaultJavaToolChain.java


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