當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。