本文整理汇总了Java中org.jetbrains.jps.builders.BuildTarget类的典型用法代码示例。如果您正苦于以下问题:Java BuildTarget类的具体用法?Java BuildTarget怎么用?Java BuildTarget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BuildTarget类属于org.jetbrains.jps.builders包,在下文中一共展示了BuildTarget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: markDirtyFiles
import org.jetbrains.jps.builders.BuildTarget; //导入依赖的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);
}
}
示例2: CompileScopeImpl
import org.jetbrains.jps.builders.BuildTarget; //导入依赖的package包/类
public CompileScopeImpl(Collection<? extends BuildTargetType<?>> types,
Collection<? extends BuildTargetType<?>> typesToForceBuild,
Collection<BuildTarget<?>> targets,
@NotNull Map<BuildTarget<?>, Set<File>> files) {
myTypes = types;
myTypesToForceBuild = new HashSet<BuildTargetType<?>>();
boolean forceBuildAllModuleBasedTargets = false;
for (BuildTargetType<?> type : typesToForceBuild) {
myTypesToForceBuild.add(type);
forceBuildAllModuleBasedTargets |= type instanceof JavaModuleBuildTargetType;
}
if (forceBuildAllModuleBasedTargets) {
for (BuildTargetType<?> targetType : TargetTypeRegistry.getInstance().getTargetTypes()) {
if (targetType instanceof ModuleBasedBuildTargetType<?>) {
myTypesToForceBuild.add(targetType);
}
}
}
myTargets = targets;
myFiles = files;
}
示例3: save
import org.jetbrains.jps.builders.BuildTarget; //导入依赖的package包/类
public synchronized void save() {
try {
FileUtil.createParentDirs(myTargetsFile);
DataOutputStream output = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(myTargetsFile)));
try {
output.writeInt(0);
output.writeInt(myTargetIds.size());
for (Map.Entry<BuildTarget<?>, Integer> entry : myTargetIds.entrySet()) {
IOUtil.writeString(entry.getKey().getId(), output);
output.writeInt(entry.getValue());
}
}
finally {
output.close();
}
}
catch (IOException e) {
LOG.info("Cannot save " + myTargetType.getTypeId() + " targets data: " + e.getMessage(), e);
}
}
示例4: cleanTargetStorages
import org.jetbrains.jps.builders.BuildTarget; //导入依赖的package包/类
public void cleanTargetStorages(BuildTarget<?> target) throws IOException {
try {
AtomicNotNullLazyValue<BuildTargetStorages> storages = myTargetStorages.remove(target);
if (storages != null) {
storages.getValue().close();
}
}
finally {
// delete all data except src-out mapping which is cleaned in a special way
final File[] targetData = myDataPaths.getTargetDataRoot(target).listFiles();
if (targetData != null) {
final File srcOutputMapRoot = getSourceToOutputMapRoot(target);
for (File dataFile : targetData) {
if (!FileUtil.filesEqual(dataFile, srcOutputMapRoot)) {
FileUtil.delete(dataFile);
}
}
}
}
}
示例5: removeStamp
import org.jetbrains.jps.builders.BuildTarget; //导入依赖的package包/类
public void removeStamp(File file, BuildTarget<?> buildTarget) throws IOException {
TimestampPerTarget[] state = getState(file);
if (state != null) {
int targetId = myTargetsState.getBuildTargetId(buildTarget);
for (int i = 0; i < state.length; i++) {
TimestampPerTarget timestampPerTarget = state[i];
if (timestampPerTarget.targetId == targetId) {
if (state.length == 1) {
remove(file);
}
else {
TimestampPerTarget[] newState = ArrayUtil.remove(state, i);
update(file, newState);
break;
}
}
}
}
}
示例6: accept
import org.jetbrains.jps.builders.BuildTarget; //导入依赖的package包/类
@Override
public boolean accept(File file) {
final JavaSourceRootDescriptor rd = myBuildRootIndex.findJavaRootDescriptor(myContext, file);
if (rd == null) {
return true;
}
final ModuleBuildTarget targetOfFile = rd.target;
if (myChunkTargets.contains(targetOfFile)) {
return true;
}
Set<BuildTarget<?>> targetOfFileWithDependencies = myCache.get(targetOfFile);
if (targetOfFileWithDependencies == null) {
targetOfFileWithDependencies = myBuildTargetIndex.getDependenciesRecursively(targetOfFile, myContext);
myCache.put(targetOfFile, targetOfFileWithDependencies);
}
return ContainerUtil.intersects(targetOfFileWithDependencies, myChunkTargets);
}
示例7: getTargetsByOutputFile
import org.jetbrains.jps.builders.BuildTarget; //导入依赖的package包/类
@Override
public Collection<BuildTarget<?>> getTargetsByOutputFile(@NotNull File file) {
File current = file;
Collection<BuildTarget<?>> result = null;
while (current != null) {
List<BuildTarget<?>> targets = myOutputToTargets.get(current);
if (targets != null) {
if (result == null) {
result = targets;
}
else {
result = new ArrayList<BuildTarget<?>>(result);
result.addAll(targets);
}
}
current = FileUtilRt.getParentFile(current);
}
return result != null ? result : Collections.<BuildTarget<?>>emptyList();
}
示例8: BuildTargetRegistryImpl
import org.jetbrains.jps.builders.BuildTarget; //导入依赖的package包/类
public BuildTargetRegistryImpl(JpsModel model) {
myTargets = new THashMap<BuildTargetType<?>, List<? extends BuildTarget<?>>>();
myModuleBasedTargets = new THashMap<JpsModule, List<ModuleBasedTarget>>();
List<List<? extends BuildTarget<?>>> targetsByType = new ArrayList<List<? extends BuildTarget<?>>>();
for (BuildTargetType<?> type : TargetTypeRegistry.getInstance().getTargetTypes()) {
List<? extends BuildTarget<?>> targets = type.computeAllTargets(model);
myTargets.put(type, targets);
targetsByType.add(targets);
for (BuildTarget<?> target : targets) {
if (target instanceof ModuleBasedTarget) {
final ModuleBasedTarget t = (ModuleBasedTarget)target;
final JpsModule module = t.getModule();
List<ModuleBasedTarget> list = myModuleBasedTargets.get(module);
if (list == null) {
list = new ArrayList<ModuleBasedTarget>();
myModuleBasedTargets.put(module, list);
}
list.add(t);
}
}
}
myAllTargets = Collections.unmodifiableList(ContainerUtil.concat(targetsByType));
}
示例9: getAdditionalRoots
import org.jetbrains.jps.builders.BuildTarget; //导入依赖的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;
}
示例10: processFilesToRecompile
import org.jetbrains.jps.builders.BuildTarget; //导入依赖的package包/类
public <R extends BuildRootDescriptor, T extends BuildTarget<R>> boolean processFilesToRecompile(CompileContext context, final T target, final FileProcessor<R, T> processor) throws IOException {
final Map<BuildRootDescriptor, Set<File>> data = getSourcesToRecompile(context, target);
final CompileScope scope = context.getScope();
synchronized (data) {
for (Map.Entry<BuildRootDescriptor, Set<File>> entry : data.entrySet()) {
//noinspection unchecked
R root = (R)entry.getKey();
for (File file : entry.getValue()) {
if (!scope.isAffected(target, file)) {
continue;
}
if (!processor.apply(target, file, root)) {
return false;
}
}
}
}
return true;
}
示例11: markDirtyFiles
import org.jetbrains.jps.builders.BuildTarget; //导入依赖的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);
}
}
示例12: createLoader
import org.jetbrains.jps.builders.BuildTarget; //导入依赖的package包/类
@NotNull
@Override
public BuildTargetLoader createLoader(@NotNull JpsModel model) {
return new BuildTargetLoader() {
@Nullable
@Override
public BuildTarget<?> createTarget(@NotNull String targetId) {
return null;
}
};
}
示例13: getTargetCompiledClasses
import org.jetbrains.jps.builders.BuildTarget; //导入依赖的package包/类
@Override
public Collection<CompiledClass> getTargetCompiledClasses(BuildTarget<?> target) {
final Collection<CompiledClass> classes = myTargetToClassesMap.get(target);
if (classes != null) {
return Collections.unmodifiableCollection(classes);
}
return Collections.emptyList();
}
示例14: registerCompiledClass
import org.jetbrains.jps.builders.BuildTarget; //导入依赖的package包/类
@Override
public void registerCompiledClass(BuildTarget<?> target, CompiledClass compiled) throws IOException {
if (compiled.getClassName() != null) {
myClasses.put(compiled.getClassName(), compiled);
Collection<CompiledClass> classes = myTargetToClassesMap.get(target);
if (classes == null) {
classes = new ArrayList<CompiledClass>();
myTargetToClassesMap.put(target, classes);
}
classes.add(compiled);
}
registerOutputFile(target, compiled.getOutputFile(), Collections.<String>singleton(compiled.getSourceFile().getPath()));
}
示例15: registerOutputFile
import org.jetbrains.jps.builders.BuildTarget; //导入依赖的package包/类
@Override
public void registerOutputFile(BuildTarget<?> target, File outputFile, Collection<String> sourcePaths) throws IOException {
BuildOutputConsumerImpl consumer = myTarget2Consumer.get(target);
if (consumer == null) {
consumer = new BuildOutputConsumerImpl(target, myContext);
myTarget2Consumer.put(target, consumer);
}
consumer.registerOutputFile(outputFile, sourcePaths);
}