本文整理汇总了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;
}
示例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);
}
}
};
}
示例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()));
}
示例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()));
}
示例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()));
}
示例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()));
}
示例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()));
}
示例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);
}
}
};
}
示例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));
}
}
示例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);
}
}
示例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()));
}
示例12: newCompiler
import org.gradle.language.base.internal.compile.CompileSpec; //导入依赖的package包/类
@Override
public <T extends CompileSpec> Compiler<T> newCompiler(Class<T> specType) {
throw failure();
}
示例13: createForJointCompilation
import org.gradle.language.base.internal.compile.CompileSpec; //导入依赖的package包/类
@Override
public Compiler<JavaCompileSpec> createForJointCompilation(Class<? extends CompileSpec> type) {
return createTargetCompiler(type, true);
}
示例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);
}
示例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());
}