本文整理汇总了Java中org.jetbrains.jps.builders.java.JavaSourceRootDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java JavaSourceRootDescriptor类的具体用法?Java JavaSourceRootDescriptor怎么用?Java JavaSourceRootDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavaSourceRootDescriptor类属于org.jetbrains.jps.builders.java包,在下文中一共展示了JavaSourceRootDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeRootDescriptors
import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor; //导入依赖的package包/类
@NotNull
@Override
public List<JavaSourceRootDescriptor> computeRootDescriptors(JpsModel model, ModuleExcludeIndex index, IgnoredFileIndex ignoredFileIndex, BuildDataPaths dataPaths) {
List<JavaSourceRootDescriptor> roots = new ArrayList<JavaSourceRootDescriptor>();
JavaSourceRootType type = isTests() ? JavaSourceRootType.TEST_SOURCE : JavaSourceRootType.SOURCE;
Iterable<ExcludedJavaSourceRootProvider> excludedRootProviders = JpsServiceManager.getInstance().getExtensions(ExcludedJavaSourceRootProvider.class);
final Set<File> moduleExcludes = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
moduleExcludes.addAll(index.getModuleExcludes(myModule));
roots_loop:
for (JpsTypedModuleSourceRoot<JavaSourceRootProperties> sourceRoot : myModule.getSourceRoots(type)) {
if (JpsPathUtil.isUnder(moduleExcludes, sourceRoot.getFile())) {
continue;
}
for (ExcludedJavaSourceRootProvider provider : excludedRootProviders) {
if (provider.isExcludedFromCompilation(myModule, sourceRoot)) {
continue roots_loop;
}
}
final String packagePrefix = sourceRoot.getProperties().getPackagePrefix();
roots.add(new JavaSourceRootDescriptor(sourceRoot.getFile(), this, false, false, packagePrefix,
computeRootExcludes(sourceRoot.getFile(), index)));
}
return roots;
}
示例2: markDirtyFiles
import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor; //导入依赖的package包/类
static void markDirtyFiles(CompileContext context,
BuildTarget<?> target,
final CompilationRound round,
Timestamps timestamps,
boolean forceMarkDirty,
@Nullable THashSet<File> currentFiles,
@Nullable FileFilter filter) throws IOException {
if (filter == null && forceMarkDirty) {
addCompletelyMarkedDirtyTarget(context, target);
}
for (BuildRootDescriptor rd : context.getProjectDescriptor().getBuildRootIndex().getTargetRoots(target, context)) {
if (!rd.getRootFile().exists() ||
//temp roots are managed by compilers themselves
(rd instanceof JavaSourceRootDescriptor && ((JavaSourceRootDescriptor)rd).isTemp)) {
continue;
}
if (filter == null) {
context.getProjectDescriptor().fsState.clearRecompile(rd);
}
final FSCache fsCache = rd.canUseFileCache() ? context.getProjectDescriptor().getFSCache() : FSCache.NO_CACHE;
traverseRecursively(context, rd, round, rd.getRootFile(), timestamps, forceMarkDirty, currentFiles, filter, fsCache);
}
}
示例3: build
import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor; //导入依赖的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);
}
}
示例4: getAdditionalRoots
import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor; //导入依赖的package包/类
@NotNull
@Override
public List<JavaSourceRootDescriptor> getAdditionalRoots(@NotNull BuildTarget<JavaSourceRootDescriptor> target, BuildDataPaths dataPaths) {
ModuleBuildTarget buildTarget = (ModuleBuildTarget)target;
final File generatedSourcesRoot = AndroidJpsUtil.getGeneratedSourcesStorage(buildTarget.getModule(), dataPaths);
final List<JavaSourceRootDescriptor> result = new ArrayList<JavaSourceRootDescriptor>();
addRoot(result, buildTarget, new File(generatedSourcesRoot, AndroidJpsUtil.AAPT_GENERATED_SOURCE_ROOT_NAME));
addRoot(result, buildTarget, new File(generatedSourcesRoot, AndroidJpsUtil.AIDL_GENERATED_SOURCE_ROOT_NAME));
addRoot(result, buildTarget, new File(generatedSourcesRoot, AndroidJpsUtil.RENDERSCRIPT_GENERATED_SOURCE_ROOT_NAME));
addRoot(result, buildTarget, new File(generatedSourcesRoot, AndroidJpsUtil.BUILD_CONFIG_GENERATED_SOURCE_ROOT_NAME));
addRoot(result, buildTarget, AndroidJpsUtil.getCopiedSourcesStorage(buildTarget.getModule(), dataPaths));
return result;
}
示例5: build
import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor; //导入依赖的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;
}
示例6: findSourceForClass
import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor; //导入依赖的package包/类
@Nullable
private static File findSourceForClass(JavaSourceRootDescriptor rd, final @Nullable String boundClassName) throws IOException {
if (boundClassName == null) {
return null;
}
String relPath = suggestRelativePath(rd, boundClassName);
while (true) {
final File candidate = new File(rd.getRootFile(), relPath);
if (candidate.exists()) {
return candidate.isFile() ? candidate : null;
}
final int index = relPath.lastIndexOf('/');
if (index <= 0) {
return null;
}
relPath = relPath.substring(0, index) + JAVA_EXTENSION;
}
}
示例7: findPossibleSourcesForClass
import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor; //导入依赖的package包/类
@NotNull
private static Collection<File> findPossibleSourcesForClass(JavaSourceRootDescriptor rd, final @Nullable String boundClassName) throws IOException {
if (boundClassName == null) {
return Collections.emptyList();
}
String relPath = suggestRelativePath(rd, boundClassName);
final File containingDirectory = new File(rd.getRootFile(), relPath).getParentFile();
if (containingDirectory == null) {
return Collections.emptyList();
}
final File[] files = containingDirectory.listFiles(FileFilters.withExtension("java"));
if (files == null || files.length == 0) {
return Collections.emptyList();
}
return Arrays.asList(files);
}
示例8: computeRootDescriptors
import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor; //导入依赖的package包/类
@NotNull
@Override
public List<JavaSourceRootDescriptor> computeRootDescriptors(JpsModel model, ModuleExcludeIndex index, IgnoredFileIndex ignoredFileIndex, BuildDataPaths dataPaths) {
List<JavaSourceRootDescriptor> roots = new ArrayList<JavaSourceRootDescriptor>();
JavaSourceRootType type = isTests() ? JavaSourceRootType.TEST_SOURCE : JavaSourceRootType.SOURCE;
Iterable<ExcludedJavaSourceRootProvider> excludedRootProviders = JpsServiceManager.getInstance().getExtensions(ExcludedJavaSourceRootProvider.class);
final Set<File> moduleExcludes = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
moduleExcludes.addAll(index.getModuleExcludes(myModule));
roots_loop:
for (JpsTypedModuleSourceRoot<JpsSimpleElement<JavaSourceRootProperties>> sourceRoot : myModule.getSourceRoots(type)) {
if (JpsPathUtil.isUnder(moduleExcludes, sourceRoot.getFile())) {
continue;
}
for (ExcludedJavaSourceRootProvider provider : excludedRootProviders) {
if (provider.isExcludedFromCompilation(myModule, sourceRoot)) {
continue roots_loop;
}
}
final String packagePrefix = sourceRoot.getProperties().getData().getPackagePrefix();
roots.add(new JavaSourceRootDescriptor(sourceRoot.getFile(), this, false, false, packagePrefix,
computeRootExcludes(sourceRoot.getFile(), index)));
}
return roots;
}
示例9: markDirtyFiles
import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor; //导入依赖的package包/类
static void markDirtyFiles(CompileContext context,
BuildTarget<?> target,
Timestamps timestamps,
boolean forceMarkDirty,
@Nullable THashSet<File> currentFiles,
@Nullable FileFilter filter) throws IOException {
for (BuildRootDescriptor rd : context.getProjectDescriptor().getBuildRootIndex().getTargetRoots(target, context)) {
if (!rd.getRootFile().exists() ||
//temp roots are managed by compilers themselves
(rd instanceof JavaSourceRootDescriptor && ((JavaSourceRootDescriptor)rd).isTemp)) {
continue;
}
if (filter == null) {
context.getProjectDescriptor().fsState.clearRecompile(rd);
}
final FSCache fsCache = rd.canUseFileCache() ? context.getProjectDescriptor().getFSCache() : FSCache.NO_CACHE;
traverseRecursively(context, rd, rd.getRootFile(), timestamps, forceMarkDirty, currentFiles, filter, fsCache);
}
}
示例10: findPossibleSourcesForClass
import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor; //导入依赖的package包/类
@Nullable
private static Collection<File> findPossibleSourcesForClass(JavaSourceRootDescriptor rd, final @Nullable String boundClassName) throws IOException {
if (boundClassName == null) {
return Collections.emptyList();
}
String relPath = suggestRelativePath(rd, boundClassName);
final File containingDirectory = new File(rd.getRootFile(), relPath).getParentFile();
if (containingDirectory == null) {
return Collections.emptyList();
}
final File[] files = containingDirectory.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.endsWith(JAVA_EXTENSION);
}
});
if (files == null || files.length == 0) {
return Collections.emptyList();
}
return Arrays.asList(files);
}
示例11: collectChangedFiles
import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor; //导入依赖的package包/类
private List<File> collectChangedFiles(CompileContext context,
DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder, final JpsGroovySettings settings) throws IOException {
final JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getCompilerConfiguration(context.getProjectDescriptor().getProject());
assert configuration != null;
final List<File> toCompile = new ArrayList<File>();
dirtyFilesHolder.processDirtyFiles(new FileProcessor<JavaSourceRootDescriptor, ModuleBuildTarget>() {
public boolean apply(ModuleBuildTarget target, File file, JavaSourceRootDescriptor sourceRoot) throws IOException {
final String path = file.getPath();
if (isGroovyFile(path) && !configuration.isResourceFile(file, sourceRoot.root)) { //todo file type check
if (myForStubs && settings.isExcludedFromStubGeneration(file)) {
return true;
}
toCompile.add(file);
}
return true;
}
});
return toCompile;
}
示例12: build
import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor; //导入依赖的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;
}
示例13: build
import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor; //导入依赖的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);
}
示例14: buildOutputDirectoriesMap
import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor; //导入依赖的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;
}
示例15: writeConfiguration
import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor; //导入依赖的package包/类
@Override
public void writeConfiguration(ProjectDescriptor pd, PrintWriter out) {
final JpsModule module = getModule();
int fingerprint = getDependenciesFingerprint();
for (JavaSourceRootDescriptor root : pd.getBuildRootIndex().getTargetRoots(this, null)) {
fingerprint += FileUtil.fileHashCode(root.getRootFile());
}
final LanguageLevel level = JpsJavaExtensionService.getInstance().getLanguageLevel(module);
if (level != null) {
fingerprint += level.name().hashCode();
}
final JpsJavaCompilerConfiguration config = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(module.getProject());
final String bytecodeTarget = config.getByteCodeTargetLevel(module.getName());
if (bytecodeTarget != null) {
fingerprint += bytecodeTarget.hashCode();
}
final CompilerEncodingConfiguration encodingConfig = pd.getEncodingConfiguration();
final String encoding = encodingConfig.getPreferredModuleEncoding(module);
if (encoding != null) {
fingerprint += encoding.hashCode();
}
out.write(Integer.toHexString(fingerprint));
}