本文整理汇总了Java中org.jetbrains.jps.ModuleChunk类的典型用法代码示例。如果您正苦于以下问题:Java ModuleChunk类的具体用法?Java ModuleChunk怎么用?Java ModuleChunk使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModuleChunk类属于org.jetbrains.jps包,在下文中一共展示了ModuleChunk类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: updateMappingsOnRoundCompletion
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
public static boolean updateMappingsOnRoundCompletion(
CompileContext context, DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder, ModuleChunk chunk) throws IOException {
Mappings delta = null;
final Pair<Mappings, Callbacks.Backend> pair = MAPPINGS_DELTA_KEY.get(context);
if (pair != null) {
MAPPINGS_DELTA_KEY.set(context, null);
delta = pair.getFirst();
}
if (delta == null) {
return false;
}
final Set<File> compiledFiles = getFilesContainer(context, FILES_TO_COMPILE_KEY);
FILES_TO_COMPILE_KEY.set(context, null);
final Set<File> successfullyCompiled = getFilesContainer(context, SUCCESSFULLY_COMPILED_FILES_KEY);
SUCCESSFULLY_COMPILED_FILES_KEY.set(context, null);
return updateMappings(context, delta, dirtyFilesHolder, chunk, compiledFiles, successfullyCompiled);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JavaBuilderUtil.java
示例2: build
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
@Override
public ModuleLevelBuilder.ExitCode build(CompileContext context,
ModuleChunk chunk,
DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder,
OutputConsumer outputConsumer) throws ProjectBuildException {
if (!IS_ENABLED.get(context, Boolean.TRUE) || chunk.containsTests() || !AndroidJpsUtil.isAndroidProjectWithoutGradleFacet(chunk)) {
return ExitCode.NOTHING_DONE;
}
try {
return doBuild(context, chunk, dirtyFilesHolder);
}
catch (Exception e) {
return AndroidJpsUtil.handleException(context, e, BUILDER_NAME, LOG);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AndroidSourceGeneratingBuilder.java
示例3: build
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
@Override
public ExitCode build(final CompileContext context,
ModuleChunk chunk,
DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder,
OutputConsumer outputConsumer)
throws ProjectBuildException, IOException {
boolean doneSomething = false;
for (final JpsModule module : chunk.getModules()) {
JpsAppEngineModuleExtension extension = JpsAppEngineExtensionService.getInstance().getExtension(module);
if (extension != null && extension.isRunEnhancerOnMake()) {
doneSomething |= processModule(context, dirtyFilesHolder, extension);
}
}
return doneSomething ? ExitCode.OK : ExitCode.NOTHING_DONE;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AppEngineEnhancerBuilder.java
示例4: performCompilation
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
private boolean performCompilation(List<String> args, StringWriter out, StringWriter err, Map<String, List<String>> outputs, CompileContext context, ModuleChunk chunk) {
try {
Class<?> mainClass = Class.forName(GreclipseMain.class.getName(), true, myGreclipseLoader);
Constructor<?> constructor = mainClass.getConstructor(PrintWriter.class, PrintWriter.class, Map.class, Map.class);
Method compileMethod = mainClass.getMethod("compile", String[].class);
HashMap<String, Object> customDefaultOptions = ContainerUtil.newHashMap();
// without this greclipse won't load AST transformations
customDefaultOptions.put("org.eclipse.jdt.core.compiler.groovy.groovyClassLoaderPath", getClasspathString(chunk));
// used by greclipse to cache transform loaders
// names should be different for production & tests
customDefaultOptions.put("org.eclipse.jdt.core.compiler.groovy.groovyProjectName", chunk.getPresentableShortName());
Object main = constructor.newInstance(new PrintWriter(out), new PrintWriter(err), customDefaultOptions, outputs);
return (Boolean)compileMethod.invoke(main, new Object[]{ArrayUtil.toStringArray(args)});
}
catch (Exception e) {
context.processMessage(new CompilerMessage(getPresentableName(), e));
return false;
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GreclipseBuilder.java
示例5: getCanonicalModuleOutputs
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
@Nullable
public static Map<ModuleBuildTarget, String> getCanonicalModuleOutputs(CompileContext context, ModuleChunk chunk, Builder builder) {
Map<ModuleBuildTarget, String> finalOutputs = new LinkedHashMap<ModuleBuildTarget, String>();
for (ModuleBuildTarget target : chunk.getTargets()) {
File moduleOutputDir = target.getOutputDir();
if (moduleOutputDir == null) {
context.processMessage(new CompilerMessage(builder.getPresentableName(), BuildMessage.Kind.ERROR, "Output directory not specified for module " + target.getModule().getName()));
return null;
}
//noinspection ResultOfMethodCallIgnored
moduleOutputDir.mkdirs();
String moduleOutputPath = FileUtil.toCanonicalPath(moduleOutputDir.getPath());
assert moduleOutputPath != null;
finalOutputs.put(target, moduleOutputPath.endsWith("/") ? moduleOutputPath : moduleOutputPath + "/");
}
return finalOutputs;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GroovyBuilder.java
示例6: ensureCorrectOutput
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
private static String ensureCorrectOutput(ModuleChunk chunk,
GroovycOutputParser.OutputItem item,
Map<ModuleBuildTarget, String> generationOutputs,
String compilerOutput,
@NotNull ModuleBuildTarget srcTarget) throws IOException {
if (chunk.getModules().size() > 1 && !srcTarget.equals(chunk.representativeTarget())) {
File output = new File(item.outputPath);
String srcTargetOutput = generationOutputs.get(srcTarget);
if (srcTargetOutput == null) {
LOG.info("No output for " + srcTarget + "; outputs=" + generationOutputs + "; targets = " + chunk.getTargets());
return item.outputPath;
}
//todo honor package prefixes
File correctRoot = new File(srcTargetOutput);
File correctOutput = new File(correctRoot, FileUtil.getRelativePath(new File(compilerOutput), output));
FileUtil.rename(output, correctOutput);
return correctOutput.getPath();
}
return item.outputPath;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:GroovyBuilder.java
示例7: generateClasspath
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
private static Collection<String> generateClasspath(CompileContext context, ModuleChunk chunk) {
final Set<String> cp = new LinkedHashSet<String>();
//groovy_rt.jar
// IMPORTANT! must be the first in classpath
cp.addAll(getGroovyRtRoots());
for (File file : ProjectPaths.getCompilationClasspathFiles(chunk, chunk.containsTests(), false, false)) {
cp.add(FileUtil.toCanonicalPath(file.getPath()));
}
for (GroovyBuilderExtension extension : JpsServiceManager.getInstance().getExtensions(GroovyBuilderExtension.class)) {
cp.addAll(extension.getCompilationClassPath(context, chunk));
}
return cp;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:GroovyBuilder.java
示例8: buildClassToSourceMap
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
private static Map<String, String> buildClassToSourceMap(ModuleChunk chunk, CompileContext context, Set<String> toCompilePaths, Map<ModuleBuildTarget, String> finalOutputs) throws IOException {
final Map<String, String> class2Src = new HashMap<String, String>();
JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(
context.getProjectDescriptor().getProject());
for (ModuleBuildTarget target : chunk.getTargets()) {
String moduleOutputPath = finalOutputs.get(target);
final SourceToOutputMapping srcToOut = context.getProjectDescriptor().dataManager.getSourceToOutputMap(target);
for (String src : srcToOut.getSources()) {
if (!toCompilePaths.contains(src) && isGroovyFile(src) &&
!configuration.getCompilerExcludes().isExcluded(new File(src))) {
final Collection<String> outs = srcToOut.getOutputs(src);
if (outs != null) {
for (String out : outs) {
if (out.endsWith(".class") && out.startsWith(moduleOutputPath)) {
final String className = out.substring(moduleOutputPath.length(), out.length() - ".class".length()).replace('/', '.');
class2Src.put(className, src);
}
}
}
}
}
}
return class2Src;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:GroovyBuilder.java
示例9: getModulesToBuild
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
private List<JpsModule> getModulesToBuild(final ModuleChunk chunk) {
final List<JpsModule> modules = new ArrayList<>();
for (final JpsModule module : chunk.getModules()) {
@Nullable final JpsMetaborgModuleFacetConfig facetConfiguration
= this.extensionService.getFacetConfiguration(module);
// The module must have a Metaborg facet and NOT have a Metaborg configuration,
// as a Metaborg configuration indicates it's a Language Specification project
// which is treated differently.
if (facetConfiguration == null) continue;
if (this.extensionService.hasModuleConfiguration(module)) {
this.logger.warn("Language Specification module should not have Metaborg facet: {}", module);
continue;
}
modules.add(module);
}
return modules;
}
开发者ID:metaborg,项目名称:spoofax-intellij,代码行数:23,代码来源:MetaborgLanguageBuilder.java
示例10: getBindingFileList
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
private String[] getBindingFileList(final ModuleChunk moduleChunk) {
HashSet<String> bindings = new HashSet<String>();
for (JpsModule module : moduleChunk.getModules()){
for (String rootUrl : module.getContentRootsList().getUrls()){
File root = JpsPathUtil.urlToFile(rootUrl);
File jibxRoot = new File(root, "jibx");
if (jibxRoot.exists() && jibxRoot.isDirectory()){
File[] files = jibxRoot.listFiles();
if (files != null) {
for (File binding : files) {
bindings.add(binding.getAbsolutePath());
}
}
}
}
}
return bindings.toArray(new String[bindings.size()]);
}
开发者ID:aweigold,项目名称:idea-plugin-jibx,代码行数:19,代码来源:JibxBuilder.java
示例11: resolveInstrumentatorVersion
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
@Nonnull
private Version resolveInstrumentatorVersion(CompileContext context, ModuleChunk chunk) {
Version runtimeVersion = findRuntimeVersion(context, chunk);
if (runtimeVersion == null) {
return new Version(MxCache.getCompatibleVersion());
} else {
TreeSet<Version> versions = new TreeSet<Version>();
for (String instrVersions : InstrumentatorProvider.getAvailableVersions().keySet()) {
versions.add(new Version(instrVersions));
}
Version result = versions.floor(runtimeVersion);
if (result == null) {
return new Version(MxCache.getCompatibleVersion());
}
return result;
}
}
开发者ID:maxifier,项目名称:mxcache,代码行数:18,代码来源:MxCacheBuildInstrumentator.java
示例12: ensureCorrectOutput
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
private static String ensureCorrectOutput(ModuleChunk chunk,
GroovycOSProcessHandler.OutputItem item,
Map<ModuleBuildTarget, String> generationOutputs,
String compilerOutput,
ModuleBuildTarget srcTarget) throws IOException {
if (chunk.getModules().size() > 1 && !srcTarget.equals(chunk.representativeTarget())) {
File output = new File(item.outputPath);
//todo honor package prefixes
File correctRoot = new File(generationOutputs.get(srcTarget));
File correctOutput = new File(correctRoot, FileUtil.getRelativePath(new File(compilerOutput), output));
FileUtil.rename(output, correctOutput);
return correctOutput.getPath();
}
return item.outputPath;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:GroovyBuilder.java
示例13: generateClasspath
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
private static Collection<String> generateClasspath(CompileContext context, ModuleChunk chunk) {
final Set<String> cp = new LinkedHashSet<String>();
//groovy_rt.jar
// IMPORTANT! must be the first in classpath
cp.add(getGroovyRtRoot().getPath());
for (File file : ProjectPaths.getCompilationClasspathFiles(chunk, chunk.containsTests(), false, false)) {
cp.add(FileUtil.toCanonicalPath(file.getPath()));
}
for (GroovyBuilderExtension extension : JpsServiceManager.getInstance().getExtensions(GroovyBuilderExtension.class)) {
cp.addAll(extension.getCompilationClassPath(context, chunk));
}
return cp;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:GroovyBuilder.java
示例14: build
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
@Override
public ExitCode build(CompileContext context,
ModuleChunk chunk,
DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder,
OutputConsumer outputConsumer)
throws ProjectBuildException, IOException {
boolean doneSomething = false;
// Don't do this. HaxeCompiler already does it, and doing it here just
// does it again.
// for (final JpsModule module : chunk.getModules()) {
// if (module.getModuleType() == JpsHaxeModuleType.INSTANCE) {
// doneSomething |= processModule(context, dirtyFilesHolder, module);
// }
// }
return doneSomething ? ExitCode.OK : ExitCode.NOTHING_DONE;
}
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:19,代码来源:HaxeModuleLevelBuilder.java
示例15: build
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
public ExitCode build(@NotNull CompileContext context,
@NotNull ModuleChunk chunk,
@NotNull DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder,
@NotNull OutputConsumer outputConsumer) throws ProjectBuildException, IOException {
JavaCompilingTool compilingTool = COMPILING_TOOL.get(context);
if (!IS_ENABLED.get(context, Boolean.TRUE) || compilingTool == null) {
return ExitCode.NOTHING_DONE;
}
return doBuild(context, chunk, dirtyFilesHolder, outputConsumer, compilingTool);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:JavaBuilder.java
示例16: getCompilationOptions
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
private static List<String> getCompilationOptions(CompileContext context,
ModuleChunk chunk,
@Nullable ProcessorConfigProfile profile,
@NotNull JavaCompilingTool compilingTool) {
List<String> cached = JAVAC_OPTIONS.get(context);
if (cached == null) {
loadCommonJavacOptions(context, compilingTool);
cached = JAVAC_OPTIONS.get(context);
assert cached != null : context;
}
List<String> options = new ArrayList<String>();
JpsModule module = chunk.representativeTarget().getModule();
File baseDirectory = JpsModelSerializationDataService.getBaseDirectory(module);
if (baseDirectory != null) {
//this is a temporary workaround to allow passing per-module compiler options for Eclipse compiler in form
// -properties $MODULE_DIR$/.settings/org.eclipse.jdt.core.prefs
String stringToReplace = "$" + PathMacroUtil.MODULE_DIR_MACRO_NAME + "$";
String moduleDirPath = FileUtil.toCanonicalPath(baseDirectory.getAbsolutePath());
for (String s : cached) {
options.add(StringUtil.replace(s, stringToReplace, moduleDirPath));
}
}
else {
options.addAll(cached);
}
addCompilationOptions(options, context, chunk, profile);
return options;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:JavaBuilder.java
示例17: getChunkSdkVersion
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
private static int getChunkSdkVersion(ModuleChunk chunk) {
int chunkSdkVersion = -1;
for (JpsModule module : chunk.getModules()) {
final JpsSdk<JpsDummyElement> sdk = module.getSdk(JpsJavaSdkType.INSTANCE);
if (sdk != null) {
final int moduleSdkVersion = convertToNumber(sdk.getVersionString());
if (moduleSdkVersion != 0 /*could determine the version*/&& (chunkSdkVersion < 0 || chunkSdkVersion > moduleSdkVersion)) {
chunkSdkVersion = moduleSdkVersion;
}
}
}
return chunkSdkVersion;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:JavaBuilder.java
示例18: getChunkSdkHome
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
private static String getChunkSdkHome(ModuleChunk chunk) {
for (JpsModule module : chunk.getModules()) {
final JpsSdk<JpsDummyElement> sdk = module.getSdk(JpsJavaSdkType.INSTANCE);
if (sdk != null) {
return sdk.getHomePath();
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JavaBuilder.java
示例19: buildOutputDirectoriesMap
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
private static Map<File, Set<File>> buildOutputDirectoriesMap(CompileContext context, ModuleChunk chunk) {
final Map<File, Set<File>> map = new THashMap<File, Set<File>>(FileUtil.FILE_HASHING_STRATEGY);
for (ModuleBuildTarget target : chunk.getTargets()) {
final File outputDir = target.getOutputDir();
if (outputDir == null) {
continue;
}
final Set<File> roots = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
for (JavaSourceRootDescriptor descriptor : context.getProjectDescriptor().getBuildRootIndex().getTargetRoots(target, context)) {
roots.add(descriptor.root);
}
map.put(outputDir, roots);
}
return map;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:JavaBuilder.java
示例20: shouldDifferentiate
import org.jetbrains.jps.ModuleChunk; //导入依赖的package包/类
@Override
public boolean shouldDifferentiate(ModuleChunk chunk) {
if (myNonIncrementalModules.isEmpty()) {
return true;
}
for (ModuleBuildTarget target : chunk.getTargets()) {
if (myNonIncrementalModules.contains(target)) {
return false;
}
}
return true;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:CompileContextImpl.java
注:本文中的org.jetbrains.jps.ModuleChunk类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论