IJPL-797 intellij.platform.jps.build review internal API

GitOrigin-RevId: 427a8ed45317296f90062605c81fa17bcc5c5288
This commit is contained in:
Eugene Zhuravlev
2024-06-24 23:51:52 +02:00
committed by intellij-monorepo-bot
parent 97bec9de03
commit eda69e546f
91 changed files with 331 additions and 1531 deletions

View File

@@ -1,15 +0,0 @@
org/jetbrains/jps/builders/java/JavaModuleBuildTargetType$Loader
org/jetbrains/jps/builders/java/ResourcesTargetType$Loader
org/jetbrains/jps/builders/java/dependencyView/DependencyContext
org/jetbrains/jps/builders/java/dependencyView/FieldRepr
org/jetbrains/jps/builders/java/dependencyView/IntIntMultiMaplet
org/jetbrains/jps/builders/java/dependencyView/IntIntTransientMultiMaplet
org/jetbrains/jps/builders/java/dependencyView/IntObjectMultiMaplet
org/jetbrains/jps/builders/java/dependencyView/MethodRepr
org/jetbrains/jps/builders/java/dependencyView/ObjectObjectMultiMaplet
org/jetbrains/jps/builders/java/dependencyView/Proto
org/jetbrains/jps/builders/java/dependencyView/Streamable
org/jetbrains/jps/builders/java/dependencyView/TypeRepr$AbstractType
org/jetbrains/jps/builders/java/dependencyView/UsageRepr$Usage
org/jetbrains/jps/incremental/storage/FileStampStorage$FileStamp
org/jetbrains/jps/incremental/storage/FileTimestampStorage$Timestamp

View File

@@ -9,10 +9,5 @@ com/google/protobuf/Internal$EnumVerifier
com/google/protobuf/MessageLiteOrBuilder
com/google/protobuf/Parser
com/intellij/compiler/instrumentation/InstrumentationClassFinder
io/netty/channel/Channel
it/unimi/dsi/fastutil/Hash$Strategy
it/unimi/dsi/fastutil/ints/IntSet
javax/tools/JavaCompiler
org/apache/http/HttpEntity
org/jetbrains/org/objectweb/asm/ClassReader
org/jetbrains/org/objectweb/asm/ClassWriter

View File

@@ -1,14 +1,16 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.ApiStatus;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@ApiStatus.Internal
public final class FreezeDetector {
private static final Logger LOG = Logger.getInstance(FreezeDetector.class);

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.api;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.Semaphore;
@@ -8,9 +9,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* @author Eugene Zhuravlev
*/
@ApiStatus.Internal
public class BasicFuture<T> implements TaskFuture<T> {
private final Semaphore mySemaphore = new Semaphore(1);
private final AtomicBoolean myDone = new AtomicBoolean(false);

View File

@@ -1,14 +1,13 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.api;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.UUID;
/**
* @author Eugene Zhuravlev
*/
@ApiStatus.Internal
public final class RequestFuture<T> extends BasicFuture<T> {
private final T myHandler;
private final UUID myRequestID;

View File

@@ -1,23 +1,12 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.api;
import org.jetbrains.annotations.ApiStatus;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
@ApiStatus.Internal
public interface TaskFuture<T> extends Future<T> {
void waitFor();

View File

@@ -1,13 +1,12 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.api;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.*;
/**
* Makes TaskFuture from the supplied Future
*/
@ApiStatus.Internal
public final class TaskFutureAdapter<T> implements TaskFuture<T> {
private final @NotNull Future<? extends T> myFuture;

View File

@@ -0,0 +1,6 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.backwardRefs.index;
import org.jetbrains.annotations.ApiStatus;

View File

@@ -0,0 +1,6 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.backwardRefs;
import org.jetbrains.annotations.ApiStatus;

View File

@@ -0,0 +1,6 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.builders.artifacts.impl;
import org.jetbrains.annotations.ApiStatus;

View File

@@ -1,7 +1,8 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.impl;
import com.intellij.util.PathUtilRt;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.builders.BuildTarget;
import org.jetbrains.jps.builders.BuildTargetType;
@@ -9,6 +10,7 @@ import org.jetbrains.jps.builders.storage.BuildDataPaths;
import java.io.File;
@ApiStatus.Internal
public final class BuildDataPathsImpl implements BuildDataPaths {
private final File myDataStorageRoot;

View File

@@ -1,9 +1,10 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.impl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.containers.CollectionFactory;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.builders.BuildOutputConsumer;
import org.jetbrains.jps.builders.BuildTarget;
@@ -18,9 +19,7 @@ import java.io.IOException;
import java.util.Collection;
import java.util.Set;
/**
* @author Eugene Zhuravlev
*/
@ApiStatus.Internal
public final class BuildOutputConsumerImpl implements BuildOutputConsumer {
private static final Logger LOG = Logger.getInstance(BuildOutputConsumerImpl.class);
private final BuildTarget<?> myTarget;

View File

@@ -1,27 +1,15 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.impl;
import com.intellij.openapi.util.io.FileUtilRt;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.builders.BuildRootDescriptor;
import org.jetbrains.jps.builders.BuildTarget;
import java.io.File;
@ApiStatus.Internal
public class BuildRootDescriptorImpl extends BuildRootDescriptor {
private final File myRoot;
private final BuildTarget myTarget;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.impl;
import com.intellij.openapi.util.Key;
@@ -6,6 +6,7 @@ import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.util.SmartList;
import com.intellij.util.containers.FileCollectionFactory;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.builders.*;
@@ -25,6 +26,7 @@ import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@ApiStatus.Internal
public final class BuildRootIndexImpl implements BuildRootIndex {
private static final Key<Map<File, BuildRootDescriptor>> ROOT_DESCRIPTOR_MAP = Key.create("_root_to_descriptor_map");
private static final Key<Map<BuildTarget<?>, List<? extends BuildRootDescriptor>>> TEMP_TARGET_ROOTS_MAP = Key.create("_module_to_root_map");

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.impl;
import com.intellij.tracing.Tracer;
@@ -7,6 +7,7 @@ import com.intellij.util.graph.DFSTBuilder;
import com.intellij.util.graph.Graph;
import com.intellij.util.graph.GraphGenerator;
import com.intellij.util.graph.InboundSemiGraph;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.builders.*;
import org.jetbrains.jps.incremental.CompileContext;
@@ -14,6 +15,7 @@ import org.jetbrains.jps.model.module.JpsModule;
import java.util.*;
@ApiStatus.Internal
public final class BuildTargetIndexImpl implements BuildTargetIndex {
private final BuildTargetRegistry myRegistry;
private final BuildRootIndexImpl myBuildRootIndex;

View File

@@ -1,8 +1,9 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.impl;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.builders.BuildTarget;
import org.jetbrains.jps.builders.BuildTargetRegistry;
@@ -14,6 +15,7 @@ import org.jetbrains.jps.model.module.JpsModule;
import java.util.*;
@ApiStatus.Internal
public final class BuildTargetRegistryImpl implements BuildTargetRegistry {
private final List<BuildTarget<?>> myAllTargets;
private final Map<BuildTargetType<?>, List<? extends BuildTarget<?>>> myTargets;

View File

@@ -1,7 +1,8 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.impl;
import com.intellij.openapi.util.Ref;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.builders.BuildRootDescriptor;
import org.jetbrains.jps.builders.BuildTarget;
@@ -16,6 +17,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Map;
@ApiStatus.Internal
public abstract class DirtyFilesHolderBase<R extends BuildRootDescriptor, T extends BuildTarget<R>> implements DirtyFilesHolder<R, T> {
protected final CompileContext myContext;

View File

@@ -1,9 +1,10 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.impl;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.util.SmartList;
import com.intellij.util.containers.FileCollectionFactory;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.builders.BuildTarget;
import org.jetbrains.jps.builders.TargetOutputIndex;
@@ -12,6 +13,7 @@ import org.jetbrains.jps.incremental.CompileContext;
import java.io.File;
import java.util.*;
@ApiStatus.Internal
public final class TargetOutputIndexImpl implements TargetOutputIndex {
private final Map<File, List<BuildTarget<?>>> myOutputToTargets;

View File

@@ -0,0 +1,6 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.builders.impl.java;
import org.jetbrains.annotations.ApiStatus;

View File

@@ -0,0 +1,6 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.builders.impl.logging;
import org.jetbrains.annotations.ApiStatus;

View File

@@ -0,0 +1,6 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.builders.impl.storage;
import org.jetbrains.annotations.ApiStatus;

View File

@@ -1,10 +1,7 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.builders.java.dependencyView.Callbacks;
import org.jetbrains.jps.incremental.CompileContext;
import org.jetbrains.jps.model.module.JpsModuleType;
import java.io.File;
@@ -30,15 +27,4 @@ public abstract class JavaBuilderExtension {
return Collections.emptySet();
}
/**
* @deprecated is not called anymore from dependency analysis, as the constant information is obtained directly from javac's AST
*
* Override this method to provide additional constant search capabilities that would augment the logic already built into the java builder
* Results from ConstantAffectionResolver extensions will be combined with the results found by the java ConstantAffectionResolver.
* The implementation should expect asynchronous execution.
*/
@Deprecated(forRemoval = true)
public @Nullable Callbacks.ConstantAffectionResolver getConstantSearch(CompileContext context) {
return null;
}
}

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.incremental.java.JavaBuilder;
import org.jetbrains.jps.model.java.JpsJavaModuleType;
@@ -10,6 +11,7 @@ import java.io.File;
import java.util.Collections;
import java.util.Set;
@ApiStatus.Internal
public final class JavaBuilderExtensionImpl extends JavaBuilderExtension {
@Override
public boolean shouldHonorFileEncodingForCompilation(@NotNull File file) {

View File

@@ -9,6 +9,7 @@ import com.intellij.util.ObjectUtils;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.FileCollectionFactory;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -46,11 +47,6 @@ import java.io.IOException;
import java.util.*;
public final class JavaBuilderUtil {
/**
* @deprecated This functionality is obsolete and is not used by dependency analysis anymore. To be removed in future releases
*/
@Deprecated(forRemoval = true)
public static final Key<Callbacks.ConstantAffectionResolver> CONSTANT_SEARCH_SERVICE = Key.create("_constant_search_service_");
private static final Logger LOG = Logger.getInstance(Builder.class);
private static final Key<Set<File>> ALL_AFFECTED_FILES_KEY = Key.create("_all_affected_files_");
@@ -120,6 +116,7 @@ public final class JavaBuilderUtil {
return pair.second;
}
@ApiStatus.Internal
public static boolean updateMappingsOnRoundCompletion(
CompileContext context, DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder, ModuleChunk chunk) throws IOException {
@@ -192,6 +189,7 @@ public final class JavaBuilderUtil {
* {@link #registerSuccessfullyCompiled(CompileContext, Collection)} instead.
*/
@Deprecated
@ApiStatus.Internal
public static boolean updateMappings(CompileContext context,
final Mappings delta,
DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder,

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java;
import org.jetbrains.annotations.NotNull;
@@ -37,7 +37,7 @@ public final class JavaModuleBuildTargetType extends ModuleBasedBuildTargetType<
}
@Override
public @NotNull Loader createLoader(@NotNull JpsModel model) {
public @NotNull BuildTargetLoader<ModuleBuildTarget> createLoader(@NotNull JpsModel model) {
return new Loader(model);
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java;
import org.jetbrains.annotations.NotNull;
@@ -37,7 +37,7 @@ public final class ResourcesTargetType extends ModuleBasedBuildTargetType<Resour
}
@Override
public @NotNull Loader createLoader(@NotNull JpsModel model) {
public @NotNull BuildTargetLoader<ResourcesTarget> createLoader(@NotNull JpsModel model) {
return new Loader(model);
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import org.jetbrains.annotations.ApiStatus;
@@ -25,8 +25,10 @@ import java.util.Set;
* <li>containing fully qualified name of extension implementation, e.g. "org.plugin-name.MyAnnotationsChangeTrackerImpl"
* </ul>
* </ul>
* @author Eugene Zhuravlev
* @deprecated Deprecated in favor of new implementation. See {{@link org.jetbrains.jps.dependency.java.AnnotationChangesTracker}}
*/
@Deprecated
@ApiStatus.Internal
public abstract class AnnotationsChangeTracker {
/**

View File

@@ -1,15 +1,12 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import com.intellij.util.SmartList;
import org.jetbrains.jps.dependency.Usage;
import org.jetbrains.org.objectweb.asm.ClassReader;
import java.io.File;
import java.nio.file.Path;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.Future;
public final class Callbacks {
@@ -54,57 +51,4 @@ public final class Callbacks {
};
}
public static final class ConstantAffection {
public static final ConstantAffection EMPTY = new ConstantAffection();
private final boolean myKnown;
private final Collection<File> myAffectedFiles;
public ConstantAffection(final Collection<File> affectedFiles) {
myAffectedFiles = affectedFiles;
myKnown = true;
}
public ConstantAffection() {
myKnown = false;
myAffectedFiles = null;
}
public boolean isKnown(){
return myKnown;
}
public Collection<File> getAffectedFiles (){
return myAffectedFiles;
}
public static ConstantAffection compose(final Collection<? extends ConstantAffection> affections) {
if (affections.isEmpty()) {
return new ConstantAffection(Collections.emptyList()); // return a 'known' affection here
}
if (affections.size() == 1) {
return affections.iterator().next();
}
for (ConstantAffection a : affections) {
if (!a.isKnown()) {
return EMPTY;
}
}
final Collection<File> affected = new SmartList<>();
for (ConstantAffection affection : affections) {
affected.addAll(affection.getAffectedFiles());
}
return new ConstantAffection(affected);
}
}
/**
* @deprecated This functionality is obsolete and is not used by dependency analysis anymore.
* To be removed in later releases
*/
@Deprecated(forRemoval = true)
public interface ConstantAffectionResolver {
Future<ConstantAffection> request(
final String ownerClassName, final String fieldName, int accessFlags, boolean fieldRemoved, boolean accessChanged
);
}
}

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.incremental.relativizer.PathRelativizerService;
import org.jetbrains.org.objectweb.asm.ClassReader;
@@ -11,6 +12,7 @@ import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
@ApiStatus.Internal
public final class ClassFileDependenciesAnalyzer {
private final DependencyContext myContext;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import com.intellij.util.io.DataInputOutputUtil;
@@ -12,10 +12,7 @@ import java.io.PrintStream;
import java.util.HashSet;
import java.util.Set;
/**
* @author Eugene Zhuravlev
*/
public abstract class ClassFileRepr extends Proto {
abstract class ClassFileRepr extends Proto {
protected final DependencyContext myContext;
private final int myFileName;
private final Set<UsageRepr.Usage> myUsages;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import com.intellij.util.io.DataExternalizer;
@@ -8,9 +8,6 @@ import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
/**
* @author Eugene Zhuravlev
*/
final class ClassFileReprExternalizer implements DataExternalizer<ClassFileRepr> {
private static final byte CLASS = 0x1;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import com.intellij.util.io.DataExternalizer;
@@ -14,7 +14,7 @@ import java.lang.annotation.RetentionPolicy;
import java.util.*;
import java.util.function.Predicate;
public final class ClassRepr extends ClassFileRepr {
final class ClassRepr extends ClassFileRepr {
private final TypeRepr.ClassType mySuperClass;
private final Set<TypeRepr.ClassType> myInterfaces;
private final Set<ElemType> myAnnotationTargets;

View File

@@ -1,23 +1,9 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
public interface CloseableMaplet {
interface CloseableMaplet {
/**
*/
void close() throws BuildDataCorruptedException;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import com.intellij.openapi.util.Pair;
@@ -7,7 +7,7 @@ import org.jetbrains.org.objectweb.asm.Opcodes;
import java.util.*;
public abstract class Difference {
abstract class Difference {
public static boolean weakerAccess(final int me, final int than) {
return (isPrivate(me) && !isPrivate(than)) || (isProtected(me) && isPublic(than)) || (isPackageLocal(me) && (than & (Opcodes.ACC_PROTECTED | Opcodes.ACC_PUBLIC)) != 0);

View File

@@ -1,11 +1,8 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import org.jetbrains.annotations.NotNull;
/**
* @author Eugene Zhuravlev
*/
class DifferenceImpl extends Difference{
private final Difference myDelegate;

View File

@@ -1,21 +1,7 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
public enum ElemType {
enum ElemType {
/** Class, interface (including annotation type), or enum declaration */
TYPE,

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import com.github.benmanes.caffeine.cache.Caffeine;
@@ -14,13 +14,13 @@ import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
import java.io.*;
import java.util.function.ObjIntConsumer;
public final class IntIntPersistentMultiMaplet extends IntIntMultiMaplet {
final class IntIntPersistentMultiMaplet extends IntIntMultiMaplet {
private static final IntSet NULL_COLLECTION = IntSets.emptySet();
private static final int CACHE_SIZE = 256;
private final PersistentHashMap<Integer, IntSet> map;
private final LoadingCache<Integer, IntSet> cache;
public IntIntPersistentMultiMaplet(@NotNull File file, final KeyDescriptor<Integer> keyExternalizer) throws IOException {
IntIntPersistentMultiMaplet(@NotNull File file, final KeyDescriptor<Integer> keyExternalizer) throws IOException {
map = new PersistentHashMap<>(file.toPath(), keyExternalizer, new IntSetExternalizer());
cache = Caffeine.newBuilder().maximumSize(CACHE_SIZE).build(key -> {
try {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import com.github.benmanes.caffeine.cache.Caffeine;
@@ -16,14 +16,14 @@ import java.util.Collections;
import java.util.function.ObjIntConsumer;
import java.util.function.Supplier;
public final class IntObjectPersistentMultiMaplet<V> extends IntObjectMultiMaplet<V> {
final class IntObjectPersistentMultiMaplet<V> extends IntObjectMultiMaplet<V> {
private static final Collection<?> NULL_COLLECTION = Collections.emptySet();
private static final int CACHE_SIZE = 256;
private final PersistentHashMap<Integer, Collection<V>> map;
private final DataExternalizer<V> valueExternalizer;
private final LoadingCache<Integer, Collection<V>> cache;
public IntObjectPersistentMultiMaplet(final File file,
IntObjectPersistentMultiMaplet(final File file,
final KeyDescriptor<Integer> keyExternalizer,
final DataExternalizer<V> valueExternalizer,
final Supplier<? extends Collection<V>> collectionFactory) throws IOException {

View File

@@ -1,12 +1,9 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import org.jetbrains.annotations.NotNull;
/**
* @author Eugene Zhuravlev
*/
public abstract class InternedString {
abstract class InternedString {
public abstract @NotNull DependencyContext getContext();
public abstract int asInt();

View File

@@ -1,21 +1,7 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
public interface LoggerWrapper<T> {
interface LoggerWrapper<T> {
boolean isDebugEnabled();
void debug(String comment, T t);
void debug(String comment, String t);

View File

@@ -13,6 +13,7 @@ import it.unimi.dsi.fastutil.ints.IntConsumer;
import it.unimi.dsi.fastutil.ints.IntIterator;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
@@ -37,6 +38,7 @@ import java.util.function.Predicate;
import java.util.function.Supplier;
// not final - used by Gosu plugin
@ApiStatus.Internal
public class Mappings {
private static final Logger LOG = Logger.getInstance(Mappings.class);
private boolean myProcessConstantsIncrementally = true;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import com.intellij.util.io.DataExternalizer;
@@ -11,10 +11,7 @@ import java.io.IOException;
import java.io.PrintStream;
import java.util.*;
/**
* @author Eugene Zhuravlev
*/
public final class ModulePackageRepr extends Proto {
final class ModulePackageRepr extends Proto {
private static final DataExternalizer<Integer> INT_EXTERNALIZER = new DataExternalizer<Integer>() {
@Override
public void save(@NotNull DataOutput out, Integer value) throws IOException {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import com.intellij.util.io.DataExternalizer;
@@ -12,15 +12,12 @@ import java.io.IOException;
import java.io.PrintStream;
import java.util.*;
/**
* @author Eugene Zhuravlev
*/
public final class ModuleRepr extends ClassFileRepr {
final class ModuleRepr extends ClassFileRepr {
private final int myVersion;
private final Set<ModuleRequiresRepr> myRequires; // module names
private final Set<ModulePackageRepr> myExports; // package names
public ModuleRepr(DependencyContext context, int access, int version, int fileName, int name, Set<ModuleRequiresRepr> requires, Set<ModulePackageRepr> exports, Set<UsageRepr.Usage> usages) {
ModuleRepr(DependencyContext context, int access, int version, int fileName, int name, Set<ModuleRequiresRepr> requires, Set<ModulePackageRepr> exports, Set<UsageRepr.Usage> usages) {
super(access, context.get(null), name, Collections.emptySet(), fileName, context, usages);
myVersion = version;
myRequires = requires;
@@ -28,7 +25,7 @@ public final class ModuleRepr extends ClassFileRepr {
updateClassUsages(context, usages);
}
public ModuleRepr(DependencyContext context, DataInput in) {
ModuleRepr(DependencyContext context, DataInput in) {
super(context, in);
try {
myVersion = DataInputOutputUtil.readINT(in);

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import com.intellij.util.io.DataExternalizer;
@@ -13,18 +13,15 @@ import java.io.IOException;
import java.io.PrintStream;
import java.util.Collections;
/**
* @author Eugene Zhuravlev
*/
public final class ModuleRequiresRepr extends Proto {
final class ModuleRequiresRepr extends Proto {
private final int myVersion;
public ModuleRequiresRepr(DependencyContext context, int access, int name, String version) {
ModuleRequiresRepr(DependencyContext context, int access, int name, String version) {
super(access, context.get(null), name, Collections.emptySet());
myVersion = context.get(version);
}
public ModuleRequiresRepr(DependencyContext context, DataInput in) {
ModuleRequiresRepr(DependencyContext context, DataInput in) {
super(context, in);
try {
myVersion = DataInputOutputUtil.readINT(in);

View File

@@ -1,23 +1,9 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import org.jetbrains.annotations.Nullable;
public interface NamingContext {
interface NamingContext {
/**
* @param val internal integer representation of some name in dependency graph (class name, methot name, field name, etc)

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import com.intellij.util.PairProcessor;
@@ -15,10 +15,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.function.Supplier;
/**
* @author Eugene Zhuravlev
*/
public class ObjectObjectPersistentMultiMaplet<K, V> extends ObjectObjectMultiMaplet<K, V>{
class ObjectObjectPersistentMultiMaplet<K, V> extends ObjectObjectMultiMaplet<K, V>{
private static final Collection<?> NULL_COLLECTION = Collections.emptySet();
private static final int CACHE_SIZE = 512;
private final PersistentHashMap<K, Collection<V>> myMap;

View File

@@ -10,14 +10,11 @@ import java.util.Collection;
import java.util.Map;
import java.util.function.Supplier;
/**
* @author Eugene Zhuravlev
*/
public final class ObjectObjectTransientMultiMaplet<K, V extends Streamable> extends ObjectObjectMultiMaplet<K, V>{
final class ObjectObjectTransientMultiMaplet<K, V extends Streamable> extends ObjectObjectMultiMaplet<K, V>{
private final Object2ObjectOpenCustomHashMap<K, Collection<V>> myMap;
private final Supplier<? extends Collection<V>> myCollectionFactory;
public ObjectObjectTransientMultiMaplet(Hash.Strategy<K> hashingStrategy, Supplier<? extends Collection<V>> collectionFactory) {
ObjectObjectTransientMultiMaplet(Hash.Strategy<K> hashingStrategy, Supplier<? extends Collection<V>> collectionFactory) {
myMap = new Object2ObjectOpenCustomHashMap<>(hashingStrategy);
myCollectionFactory = collectionFactory;
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import com.intellij.util.io.DataExternalizer;
@@ -10,21 +10,18 @@ import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
/**
* @author Eugene Zhuravlev
*/
public final class ParamAnnotation implements RW.Savable {
final class ParamAnnotation implements RW.Savable {
public static final ParamAnnotation[] EMPTY_ARRAY = new ParamAnnotation[0];
public final int paramIndex;
public final @NotNull TypeRepr.ClassType type;
public ParamAnnotation(int paramIndex, @NotNull TypeRepr.ClassType type) {
ParamAnnotation(int paramIndex, @NotNull TypeRepr.ClassType type) {
this.paramIndex = paramIndex;
this.type = type;
}
public ParamAnnotation(DataExternalizer<TypeRepr.ClassType> externalizer, DataInput in) {
ParamAnnotation(DataExternalizer<TypeRepr.ClassType> externalizer, DataInput in) {
try {
paramIndex = DataInputOutputUtil.readINT(in);
type = externalizer.read(in);

View File

@@ -1,15 +1,17 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import com.intellij.util.io.DataExternalizer;
import com.intellij.util.io.DataInputOutputUtil;
import com.intellij.util.io.IOUtil;
import it.unimi.dsi.fastutil.ints.IntSet;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
import java.io.*;
import java.util.Collection;
@ApiStatus.Internal
public final class RW {
private RW() {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
import com.intellij.util.io.DataExternalizer;
@@ -13,7 +13,7 @@ import java.io.IOException;
import java.util.Collection;
import java.util.Set;
public final class TypeRepr {
final class TypeRepr {
private static final byte PRIMITIVE_TYPE = 0x0;
private static final byte CLASS_TYPE = 0x1;
private static final byte ARRAY_TYPE = 0x2;

View File

@@ -1,10 +1,7 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.builders.java.dependencyView;
/**
* @author Eugene Zhuravlev
*/
public interface UsageConstraint {
interface UsageConstraint {
UsageConstraint ANY = residence -> true;
boolean checkResidence(final int residence);

View File

@@ -0,0 +1,6 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.cache.client;
import org.jetbrains.annotations.ApiStatus;

View File

@@ -0,0 +1,6 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.cache.loader;
import org.jetbrains.annotations.ApiStatus;

View File

@@ -0,0 +1,6 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.cache.model;
import org.jetbrains.annotations.ApiStatus;

View File

@@ -0,0 +1,6 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.cache;
import org.jetbrains.annotations.ApiStatus;

View File

@@ -0,0 +1,6 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.cache.statistics;
import org.jetbrains.annotations.ApiStatus;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.cmdline;
import com.intellij.openapi.diagnostic.Logger;
@@ -12,6 +12,7 @@ import io.netty.handler.codec.protobuf.ProtobufDecoder;
import io.netty.handler.codec.protobuf.ProtobufEncoder;
import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.api.CmdlineProtoUtil;
import org.jetbrains.jps.api.CmdlineRemoteProto;
@@ -34,6 +35,7 @@ import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
@SuppressWarnings("UseOfSystemOutOrSystemErr")
@ApiStatus.Internal
public final class BuildMain {
private static final String PRELOAD_PROJECT_PATH = "preload.project.path";
private static final String PRELOAD_CONFIG_PATH = "preload.config.path";

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.cmdline;
import com.github.benmanes.caffeine.cache.Caffeine;
@@ -25,6 +25,7 @@ import io.netty.resolver.AddressResolverGroup;
import io.netty.util.NetUtil;
import kotlinx.metadata.jvm.JvmMetadataUtil;
import net.n3.nanoxml.IXMLBuilder;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.maven.aether.ArtifactRepositoryManager;
@@ -47,9 +48,7 @@ import java.nio.file.Paths;
import java.util.*;
import java.util.function.Consumer;
/**
* @author Eugene Zhuravlev
*/
@ApiStatus.Internal
public final class ClasspathBootstrap {
private static final Logger LOG = Logger.getInstance(ClasspathBootstrap.class);

View File

@@ -1,8 +1,9 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.cmdline;
import com.intellij.openapi.diagnostic.JulLogger;
import com.intellij.openapi.diagnostic.Logger;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.api.GlobalOptions;
@@ -14,9 +15,7 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.logging.LogManager;
/**
* @author Eugene Zhuravlev
*/
@ApiStatus.Internal
public final class LogSetup {
public static final String LOG_CONFIG_FILE_NAME = "build-log-jul.properties";
private static final String LOG_FILE_NAME = "build.log";

View File

@@ -1,10 +1,11 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental;
import com.intellij.openapi.util.UserDataHolderBase;
import com.intellij.util.EventDispatcher;
import it.unimi.dsi.fastutil.objects.Object2LongMap;
import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
@@ -23,9 +24,7 @@ import org.jetbrains.jps.incremental.messages.ProgressMessage;
import java.util.*;
/**
* @author Eugene Zhuravlev
*/
@ApiStatus.Internal
public final class CompileContextImpl extends UserDataHolderBase implements CompileContext {
private final CompileScope myScope;
private final MessageHandler myDelegateMessageHandler;

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.builders.BuildTarget;
import org.jetbrains.jps.builders.BuildTargetType;
@@ -12,6 +13,7 @@ import org.jetbrains.jps.model.module.JpsModule;
import java.io.File;
import java.util.*;
@ApiStatus.Internal
public final class CompileScopeImpl extends CompileScope {
private final Collection<? extends BuildTargetType<?>> myTypes;
private final Collection<BuildTargetType<?>> myTypesToForceBuild;

View File

@@ -13,6 +13,7 @@ import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.FileCollectionFactory;
import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.ModuleChunk;
@@ -67,9 +68,7 @@ import java.util.stream.Collectors;
import static org.jetbrains.jps.builders.java.JavaBuilderUtil.isDepGraphEnabled;
/**
* @author Eugene Zhuravlev
*/
@ApiStatus.Internal
public final class IncProjectBuilder {
private static final Logger LOG = Logger.getInstance(IncProjectBuilder.class);

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.backwardRefs.JavaBackwardReferenceIndexBuilder;
import org.jetbrains.jps.builders.BuildTargetType;
@@ -18,6 +19,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ApiStatus.Internal
public final class JavaBuilderService extends BuilderService {
@Override
public @NotNull List<? extends BuildTargetType<?>> getTargetTypes() {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental;
import com.intellij.openapi.diagnostic.Logger;
@@ -256,10 +256,12 @@ public final class ModuleBuildTarget extends JVMModuleBuildTarget<JavaSourceRoot
for (File file : enumerator.classes().getRoots()) {
String path = relativizer.toRelative(file.getAbsolutePath());
Integer contentHash = getContentHash(file);
int contentHash = getContentHash(file);
if (logBuilder != null) {
logBuilder.append(path);
if (contentHash != 0) logBuilder.append(": ").append(contentHash);
if (contentHash != 0) {
logBuilder.append(": ").append(contentHash);
}
logBuilder.append("\n");
}
fingerprint = 31 * fingerprint + pathHashCode(path) + contentHash;
@@ -267,10 +269,12 @@ public final class ModuleBuildTarget extends JVMModuleBuildTarget<JavaSourceRoot
return fingerprint;
}
private static Integer getContentHash(File file) {
private static int getContentHash(File file) {
if (ProjectStamps.TRACK_LIBRARY_CONTENT) {
try {
if (!file.isFile() || !file.getName().endsWith(".jar")) return 0;
if (!file.isFile() || !file.getName().endsWith(".jar")) {
return 0;
}
MessageDigest digest = MessageDigest.getInstance("SHA-256");
FileInputStream inputStream = new FileInputStream(file);
@@ -292,9 +296,7 @@ public final class ModuleBuildTarget extends JVMModuleBuildTarget<JavaSourceRoot
throw new RuntimeException(e);
}
}
else {
return 0;
}
return 0;
}
private static int pathHashCode(@NotNull String path) {

View File

@@ -73,6 +73,7 @@ import java.util.zip.ZipFile;
* so this builder does nothing in normal cases. However, it's needed when the build process is started in standalone mode (not from IDE) or
* if build is triggered before IDE downloads all required dependencies.
*/
@ApiStatus.Internal
public final class DependencyResolvingBuilder extends ModuleLevelBuilder {
private static final Logger LOG = Logger.getInstance(DependencyResolvingBuilder.class);
private static final String MAVEN_REPOSITORY_PATH_VAR = "MAVEN_REPOSITORY";

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.fs;
import com.intellij.openapi.diagnostic.Logger;
@@ -8,6 +8,7 @@ import com.intellij.util.containers.FastUtilHashingStrategies;
import com.intellij.util.containers.MultiMap;
import com.intellij.util.io.IOUtil;
import it.unimi.dsi.fastutil.objects.Object2LongOpenCustomHashMap;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.ModuleChunk;
@@ -215,6 +216,7 @@ public final class BuildFSState {
return !myAlwaysScanFS && myInitialScanPerformed.contains(target);
}
@ApiStatus.Internal
public @NotNull FilesDelta getEffectiveFilesDelta(@NotNull CompileContext context, BuildTarget<?> target) {
if (target instanceof ModuleBuildTarget) {
// multiple compilation rounds are applicable to ModuleBuildTarget only

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.fs;
import com.intellij.openapi.diagnostic.Logger;
@@ -6,6 +6,7 @@ import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.util.containers.FileCollectionFactory;
import com.intellij.util.io.IOUtil;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.builders.BuildRootDescriptor;
@@ -20,6 +21,7 @@ import java.io.IOException;
import java.util.*;
import java.util.concurrent.locks.ReentrantLock;
@ApiStatus.Internal
public final class FilesDelta {
private static final Logger LOG = Logger.getInstance(FilesDelta.class);
private final ReentrantLock myDataLock = new ReentrantLock();

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.instrumentation;
import com.intellij.compiler.instrumentation.InstrumentationClassFinder;
@@ -6,6 +6,7 @@ import com.intellij.compiler.notNullVerification.NotNullVerifyingInstrumenter;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.util.ArrayUtilRt;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.ModuleChunk;
@@ -25,6 +26,7 @@ import org.jetbrains.org.objectweb.asm.Opcodes;
import java.io.File;
import java.util.Collection;
@ApiStatus.Internal
public final class NotNullInstrumentingBuilder extends BaseInstrumentingBuilder{
private static final Logger LOG = Logger.getInstance(NotNullInstrumentingBuilder.class);
private boolean myIsEnabled;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.instrumentation;
import com.intellij.compiler.instrumentation.InstrumentationClassFinder;
@@ -15,6 +15,7 @@ import com.intellij.util.ObjectUtils;
import com.intellij.util.SmartList;
import com.intellij.util.SystemProperties;
import com.intellij.util.containers.FileCollectionFactory;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -38,9 +39,7 @@ import java.rmi.Remote;
import java.util.*;
import java.util.concurrent.Future;
/**
* @author Eugene Zhuravlev
*/
@ApiStatus.Internal
public final class RmiStubsGenerator extends ClassProcessingBuilder {
private static final String REMOTE_INTERFACE_NAME = Remote.class.getName().replace('.', '/');
private static final File[] EMPTY_FILE_ARRAY = new File[0];

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.java;
import com.intellij.openapi.diagnostic.Logger;
@@ -7,14 +7,13 @@ import com.intellij.uiDesigner.UIFormXmlConstants;
import com.intellij.uiDesigner.compiler.AlienFormFileException;
import com.intellij.uiDesigner.compiler.Utils;
import net.n3.nanoxml.*;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
import java.io.*;
import java.util.Properties;
/**
* @author Eugene Zhuravlev
*/
@ApiStatus.Internal
public final class FormsParsing {
private static final Logger LOG = Logger.getInstance(FormsParsing.class);
private static final String FORM_TAG = "form";
@@ -130,6 +129,7 @@ public final class FormsParsing {
}
}
@ApiStatus.Internal
public static class IXMLBuilderAdapter implements IXMLBuilder {
@Override
@@ -171,6 +171,7 @@ public final class FormsParsing {
}
}
@ApiStatus.Internal
public static final class ParserStoppedException extends RuntimeException {
@Override
public synchronized Throwable fillInStackTrace() {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.java;
import com.intellij.openapi.diagnostic.Logger;
@@ -19,6 +19,7 @@ import com.intellij.util.execution.ParametersListUtil;
import com.intellij.util.io.BaseOutputReader;
import com.intellij.util.io.CorruptedException;
import com.intellij.util.lang.JavaVersion;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -55,7 +56,9 @@ import org.jetbrains.jps.model.serialization.PathMacroUtil;
import org.jetbrains.jps.service.JpsServiceManager;
import org.jetbrains.jps.service.SharedThreadPool;
import javax.tools.*;
import javax.tools.Diagnostic;
import javax.tools.DiagnosticListener;
import javax.tools.JavaFileObject;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
@@ -70,7 +73,7 @@ import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.stream.Collectors;
@ApiStatus.Internal
public final class JavaBuilder extends ModuleLevelBuilder {
private static final Logger LOG = Logger.getInstance(JavaBuilder.class);
private static final String JAVA_EXTENSION = "java";

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.java;
import org.jetbrains.jps.builders.java.JavaBuilderUtil;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.java;
import com.intellij.compiler.instrumentation.FailSafeClassReader;

View File

@@ -4,6 +4,7 @@ package org.jetbrains.jps.incremental.storage;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.io.PersistentHashMapValueStorage;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.builders.BuildTarget;
@@ -130,6 +131,7 @@ public final class BuildDataManager {
return new SourceToOutputMappingWrapper(map, myTargetsState.getBuildTargetId(target));
}
@ApiStatus.Internal
public SourceToOutputMappingImpl createSourceToOutputMapForStaleTarget(BuildTargetType<?> targetType, String targetId) throws IOException {
return new SourceToOutputMappingImpl(new File(getSourceToOutputMapRoot(targetType, targetId), SRC_TO_OUTPUT_FILE_NAME), myRelativizer);
}
@@ -143,6 +145,7 @@ public final class BuildDataManager {
return mySrcToFormMap;
}
@ApiStatus.Internal
public Mappings getMappings() {
return myMappings;
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.storage;
import com.google.gson.Gson;
@@ -19,7 +19,6 @@ import org.jetbrains.jps.cache.model.BuildTargetState;
import org.jetbrains.jps.cmdline.ProjectDescriptor;
import org.jetbrains.jps.incremental.BuildListener;
import org.jetbrains.jps.incremental.CompileContext;
import org.jetbrains.jps.incremental.CompileContextImpl;
import org.jetbrains.jps.incremental.messages.FileDeletedEvent;
import org.jetbrains.jps.incremental.messages.FileGeneratedEvent;
import org.jetbrains.jps.incremental.relativizer.PathRelativizerService;
@@ -54,7 +53,7 @@ import static org.jetbrains.jps.incremental.storage.Xxh3HashingService.getString
*
* <p>The output of the work is the file "sources_state" in the data storage root folder. To avoid problems with
* handling by other plugins or systems the output is in JSON format. This report produces only if
* {@link ProjectStamps#PORTABLE_CACHES} flag enabled and try to reuse the data calculated by {@link FileStampStorage}</p>
* {@link ProjectStamps#PORTABLE_CACHES} flag enabled and try to reuse the data calculated by {@link HashStampStorage}</p>
*
* <b>This is class can be changed or removed in future</b>
*/
@@ -72,13 +71,13 @@ public final class BuildTargetSourcesState implements BuildListener {
private final BuildTargetIndex myBuildTargetIndex;
private final BuildRootIndex myBuildRootIndex;
private final ProjectStamps myProjectStamps;
private final CompileContextImpl myContext;
private final CompileContext myContext;
private final String myOutputFolderPath;
private final File myTargetStateStorage;
private final Type myTokenType;
private final Gson gson;
public BuildTargetSourcesState(@NotNull CompileContextImpl context) {
public BuildTargetSourcesState(@NotNull CompileContext context) {
gson = new Gson();
myContext = context;
myCalculatedHashes = new ConcurrentHashMap<>();
@@ -297,8 +296,8 @@ public final class BuildTargetSourcesState implements BuildListener {
private @NotNull Optional<Long> getFileHash(@NotNull BuildTarget<?> target, @NotNull File file, @NotNull File rootPath) throws IOException {
StampsStorage<? extends StampsStorage.Stamp> storage = myProjectStamps.getStampStorage();
assert storage instanceof FileStampStorage;
FileStampStorage fileStampStorage = (FileStampStorage)storage;
assert storage instanceof HashStampStorage;
HashStampStorage fileStampStorage = (HashStampStorage)storage;
Long fileHash = fileStampStorage.getStoredFileHash(file, target);
if (fileHash == null) {
return Optional.empty();

View File

@@ -1,13 +1,13 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.storage;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.builders.BuildRootIndex;
import org.jetbrains.jps.builders.BuildTarget;
import org.jetbrains.jps.builders.BuildTargetType;
import org.jetbrains.jps.builders.impl.BuildRootIndexImpl;
import org.jetbrains.jps.builders.storage.BuildDataPaths;
import org.jetbrains.jps.incremental.TargetTypeRegistry;
import org.jetbrains.jps.model.JpsModel;
@@ -25,9 +25,9 @@ public final class BuildTargetsState {
private long myLastSuccessfulRebuildDuration = -1;
private final ConcurrentMap<BuildTargetType<?>, BuildTargetTypeState> myTypeStates = new ConcurrentHashMap<>(16, 0.75f, 1);
private final JpsModel myModel;
private final BuildRootIndexImpl myBuildRootIndex;
private final BuildRootIndex myBuildRootIndex;
public BuildTargetsState(BuildDataPaths dataPaths, JpsModel model, BuildRootIndexImpl buildRootIndex) {
public BuildTargetsState(BuildDataPaths dataPaths, JpsModel model, BuildRootIndex buildRootIndex) {
myDataPaths = dataPaths;
myModel = model;
myBuildRootIndex = buildRootIndex;
@@ -135,7 +135,7 @@ public final class BuildTargetsState {
return myModel;
}
public BuildRootIndexImpl getBuildRootIndex() {
public BuildRootIndex getBuildRootIndex() {
return myBuildRootIndex;
}

View File

@@ -1,9 +1,10 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.storage;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.io.IOUtil;
import com.intellij.util.io.KeyDescriptor;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import java.io.DataInput;
@@ -11,9 +12,7 @@ import java.io.DataOutput;
import java.io.File;
import java.io.IOException;
/**
* @author Eugene Zhuravlev
*/
@ApiStatus.Internal
public final class FileKeyDescriptor implements KeyDescriptor<File> {
@Override
public void save(@NotNull DataOutput out, File value) throws IOException {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.storage;
import com.intellij.util.ArrayUtil;
@@ -13,17 +13,14 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.attribute.BasicFileAttributes;
import static org.jetbrains.jps.incremental.storage.FileTimestampStorage.Timestamp;
import static org.jetbrains.jps.incremental.storage.FileTimestampStorage.FileTimestamp;
import static org.jetbrains.jps.incremental.storage.FileTimestampStorage.TimestampPerTarget;
/**
* @author Eugene Zhuravlev
*/
public final class FileTimestampStorage extends AbstractStateStorage<File, TimestampPerTarget[]> implements StampsStorage<Timestamp> {
final class FileTimestampStorage extends AbstractStateStorage<File, TimestampPerTarget[]> implements StampsStorage<FileTimestamp> {
private final BuildTargetsState myTargetsState;
private final File myTimestampsRoot;
public FileTimestampStorage(File dataStorageRoot, BuildTargetsState targetsState) throws IOException {
FileTimestampStorage(File dataStorageRoot, BuildTargetsState targetsState) throws IOException {
super(new File(calcStorageRoot(dataStorageRoot), "data"), new FileKeyDescriptor(), new StateExternalizer());
myTimestampsRoot = calcStorageRoot(dataStorageRoot);
myTargetsState = targetsState;
@@ -39,40 +36,40 @@ public final class FileTimestampStorage extends AbstractStateStorage<File, Times
}
@Override
public Timestamp getPreviousStamp(File file, BuildTarget<?> target) throws IOException {
public FileTimestamp getPreviousStamp(File file, BuildTarget<?> target) throws IOException {
final TimestampPerTarget[] state = getState(file);
if (state != null) {
int targetId = myTargetsState.getBuildTargetId(target);
for (TimestampPerTarget timestampPerTarget : state) {
if (timestampPerTarget.targetId == targetId) {
return Timestamp.fromLong(timestampPerTarget.timestamp);
return FileTimestamp.fromLong(timestampPerTarget.timestamp);
}
}
}
return Timestamp.MINUS_ONE;
return FileTimestamp.MINUS_ONE;
}
@Override
public Timestamp getCurrentStamp(File file) {
return Timestamp.fromLong(FSOperations.lastModified(file));
public FileTimestamp getCurrentStamp(File file) {
return FileTimestamp.fromLong(FSOperations.lastModified(file));
}
@Override
public boolean isDirtyStamp(@NotNull Stamp stamp, File file) {
if (!(stamp instanceof Timestamp)) return true;
return ((Timestamp) stamp).myTimestamp != FSOperations.lastModified(file);
if (!(stamp instanceof FileTimestamp)) return true;
return ((FileTimestamp) stamp).myTimestamp != FSOperations.lastModified(file);
}
@Override
public boolean isDirtyStamp(Stamp stamp, File file, @NotNull BasicFileAttributes attrs) {
if (!(stamp instanceof Timestamp)) return true;
Timestamp timestamp = (Timestamp) stamp;
if (!(stamp instanceof FileTimestamp)) return true;
FileTimestamp timestamp = (FileTimestamp) stamp;
// for symlinks the attr structure reflects the symlink's timestamp and not symlink's target timestamp
return attrs.isRegularFile() ? attrs.lastModifiedTime().toMillis() != timestamp.myTimestamp : isDirtyStamp(timestamp, file);
}
@Override
public void saveStamp(File file, BuildTarget<?> buildTarget, Timestamp stamp) throws IOException {
public void saveStamp(File file, BuildTarget<?> buildTarget, FileTimestamp stamp) throws IOException {
int targetId = myTargetsState.getBuildTargetId(buildTarget);
update(file, updateTimestamp(getState(file), targetId, stamp.asLong()));
}
@@ -145,11 +142,11 @@ public final class FileTimestampStorage extends AbstractStateStorage<File, Times
}
}
static final class Timestamp implements StampsStorage.Stamp {
static final Timestamp MINUS_ONE = new Timestamp(-1L);
static final class FileTimestamp implements StampsStorage.Stamp {
static final FileTimestamp MINUS_ONE = new FileTimestamp(-1L);
private final long myTimestamp;
Timestamp(long timestamp) {
FileTimestamp(long timestamp) {
myTimestamp = timestamp;
}
@@ -157,8 +154,8 @@ public final class FileTimestampStorage extends AbstractStateStorage<File, Times
return myTimestamp;
}
static Timestamp fromLong(long l) {
return new Timestamp(l);
static FileTimestamp fromLong(long l) {
return new FileTimestamp(l);
}
@Override

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.storage;
import com.intellij.util.ArrayUtil;
@@ -13,18 +13,17 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.attribute.BasicFileAttributes;
import static org.jetbrains.jps.incremental.storage.FileStampStorage.FileStamp;
import static org.jetbrains.jps.incremental.storage.FileStampStorage.HashStampPerTarget;
import static org.jetbrains.jps.incremental.storage.FileTimestampStorage.Timestamp;
import static org.jetbrains.jps.incremental.storage.FileTimestampStorage.FileTimestamp;
import static org.jetbrains.jps.incremental.storage.HashStampStorage.HashStampPerTarget;
import static org.jetbrains.jps.incremental.storage.Xxh3HashingService.getFileHash;
public final class FileStampStorage extends AbstractStateStorage<String, HashStampPerTarget[]> implements StampsStorage<FileStamp> {
final class HashStampStorage extends AbstractStateStorage<String, HashStampPerTarget[]> implements StampsStorage<HashStampStorage.HashStamp> {
private final FileTimestampStorage myTimestampStorage;
private final PathRelativizerService myRelativizer;
private final BuildTargetsState myTargetsState;
private final File myFileStampRoot;
public FileStampStorage(File dataStorageRoot, PathRelativizerService relativizer, BuildTargetsState targetsState) throws IOException {
HashStampStorage(File dataStorageRoot, PathRelativizerService relativizer, BuildTargetsState targetsState) throws IOException {
super(new File(calcStorageRoot(dataStorageRoot), "data"), PathStringDescriptor.INSTANCE, new StateExternalizer());
myTimestampStorage = new FileTimestampStorage(dataStorageRoot, targetsState);
myFileStampRoot = calcStorageRoot(dataStorageRoot);
@@ -46,14 +45,14 @@ public final class FileStampStorage extends AbstractStateStorage<String, HashSta
}
@Override
public void saveStamp(File file, BuildTarget<?> buildTarget, FileStamp stamp) throws IOException {
myTimestampStorage.saveStamp(file, buildTarget, Timestamp.fromLong(stamp.myTimestamp));
public void saveStamp(File file, BuildTarget<?> buildTarget, HashStamp stamp) throws IOException {
myTimestampStorage.saveStamp(file, buildTarget, FileTimestamp.fromLong(stamp.myTimestamp));
int targetId = myTargetsState.getBuildTargetId(buildTarget);
String path = relativePath(file);
update(path, updateFilesStamp(getState(path), targetId, stamp));
}
private static HashStampPerTarget @NotNull [] updateFilesStamp(HashStampPerTarget[] oldState, final int targetId, FileStamp stamp) {
private static HashStampPerTarget @NotNull [] updateFilesStamp(HashStampPerTarget[] oldState, final int targetId, HashStamp stamp) {
final HashStampPerTarget newItem = new HashStampPerTarget(targetId, stamp.myHash);
if (oldState == null) {
return new HashStampPerTarget[]{newItem};
@@ -90,18 +89,18 @@ public final class FileStampStorage extends AbstractStateStorage<String, HashSta
}
@Override
public FileStamp getPreviousStamp(File file, BuildTarget<?> target) throws IOException {
Timestamp previousTimestamp = myTimestampStorage.getPreviousStamp(file, target);
public HashStamp getPreviousStamp(File file, BuildTarget<?> target) throws IOException {
FileTimestamp previousTimestamp = myTimestampStorage.getPreviousStamp(file, target);
HashStampPerTarget[] state = getState(relativePath(file));
if (state != null) {
int targetId = myTargetsState.getBuildTargetId(target);
for (HashStampPerTarget filesStampPerTarget : state) {
if (filesStampPerTarget.targetId == targetId) {
return new FileStamp(filesStampPerTarget.hash, previousTimestamp.asLong());
return new HashStamp(filesStampPerTarget.hash, previousTimestamp.asLong());
}
}
}
return FileStamp.EMPTY;
return HashStamp.EMPTY;
}
public Long getStoredFileHash(File file, BuildTarget<?> target) throws IOException {
@@ -115,16 +114,16 @@ public final class FileStampStorage extends AbstractStateStorage<String, HashSta
}
@Override
public FileStamp getCurrentStamp(File file) throws IOException {
Timestamp currentTimestamp = myTimestampStorage.getCurrentStamp(file);
return new FileStamp(getFileHash(file), currentTimestamp.asLong());
public HashStamp getCurrentStamp(File file) throws IOException {
FileTimestamp currentTimestamp = myTimestampStorage.getCurrentStamp(file);
return new HashStamp(getFileHash(file), currentTimestamp.asLong());
}
@Override
public boolean isDirtyStamp(@NotNull Stamp stamp, File file) throws IOException {
if (!(stamp instanceof FileStamp)) return true;
FileStamp filesStamp = (FileStamp)stamp;
if (!myTimestampStorage.isDirtyStamp(Timestamp.fromLong(filesStamp.myTimestamp), file)) return false;
if (!(stamp instanceof HashStamp)) return true;
HashStamp filesStamp = (HashStamp)stamp;
if (!myTimestampStorage.isDirtyStamp(FileTimestamp.fromLong(filesStamp.myTimestamp), file)) return false;
Long hash = filesStamp.myHash;
if (hash == null) return true;
return hash != getFileHash(file);
@@ -132,9 +131,9 @@ public final class FileStampStorage extends AbstractStateStorage<String, HashSta
@Override
public boolean isDirtyStamp(Stamp stamp, File file, @NotNull BasicFileAttributes attrs) throws IOException {
if (!(stamp instanceof FileStamp)) return true;
FileStamp filesStamp = (FileStamp)stamp;
if (!myTimestampStorage.isDirtyStamp(Timestamp.fromLong(filesStamp.myTimestamp), file, attrs)) return false;
if (!(stamp instanceof HashStamp)) return true;
HashStamp filesStamp = (HashStamp)stamp;
if (!myTimestampStorage.isDirtyStamp(FileTimestamp.fromLong(filesStamp.myTimestamp), file, attrs)) return false;
Long hash = filesStamp.myHash;
if (hash == null) return true;
return hash != getFileHash(file);
@@ -173,20 +172,20 @@ public final class FileStampStorage extends AbstractStateStorage<String, HashSta
}
}
static final class FileStamp implements StampsStorage.Stamp {
static FileStamp EMPTY = new FileStamp(null, -1L);
static final class HashStamp implements StampsStorage.Stamp {
static HashStamp EMPTY = new HashStamp(null, -1L);
private final Long myHash;
private final long myTimestamp;
private FileStamp(Long hash, long timestamp) {
private HashStamp(Long hash, long timestamp) {
myHash = hash;
myTimestamp = timestamp;
}
@Override
public String toString() {
return "FileStamp{" +
return "HashStamp{" +
"myHash=" + myHash +
", myTimestamp=" + myTimestamp +
'}';

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.storage;
import com.intellij.openapi.util.io.FileUtil;
@@ -16,9 +16,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
/**
* @author Eugene Zhuravlev
*/
public final class OutputToTargetRegistry extends AbstractStateStorage<Integer, IntSet> {
private final PathRelativizerService myRelativizer;
@@ -113,6 +110,6 @@ public final class OutputToTargetRegistry extends AbstractStateStorage<Integer,
if (ProjectStamps.PORTABLE_CACHES) {
return StringUtil.isEmpty(relativePath) ? 0 : FileUtil.toCanonicalPath(relativePath).hashCode();
}
return FileUtil.pathHashCode(relativePath);
return FileUtil.pathHashCode(relativePath); // todo: better hash function?
}
}

View File

@@ -1,13 +1,15 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.storage;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.Strings;
import com.intellij.util.io.EnumeratorStringDescriptor;
import org.jetbrains.annotations.ApiStatus;
import static org.jetbrains.jps.incremental.storage.ProjectStamps.PORTABLE_CACHES;
@ApiStatus.Internal
public final class PathStringDescriptor extends EnumeratorStringDescriptor {
public static final PathStringDescriptor INSTANCE = new PathStringDescriptor();

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.storage;
import com.intellij.openapi.diagnostic.Logger;
@@ -27,7 +27,7 @@ public final class ProjectStamps {
BuildTargetsState targetsState,
PathRelativizerService relativizer) throws IOException {
myStampsStorage = PORTABLE_CACHES
? new FileStampStorage(dataStorageRoot, relativizer, targetsState)
? new HashStampStorage(dataStorageRoot, relativizer, targetsState)
: new FileTimestampStorage(dataStorageRoot, targetsState);
}

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.storage;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.builders.storage.SourceToOutputMapping;
@@ -11,9 +12,7 @@ import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
/**
* @author Eugene Zhuravlev
*/
@ApiStatus.Internal
public final class SourceToOutputMappingImpl implements SourceToOutputMapping, StorageOwner {
private final OneToManyPathsMapping myMapping;

View File

@@ -0,0 +1,6 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.indices.impl;
import org.jetbrains.annotations.ApiStatus;

View File

@@ -24,6 +24,7 @@ import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
import io.netty.util.AttributeKey;
import io.netty.util.concurrent.ImmediateEventExecutor;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
@@ -46,6 +47,7 @@ import java.util.concurrent.TimeoutException;
import java.util.function.Function;
import java.util.function.Supplier;
@ApiStatus.Internal
public class ExternalJavacManager extends ProcessAdapter {
private static final Logger LOG = Logger.getInstance(ExternalJavacManager.class);

View File

@@ -1,12 +1,14 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.javac;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@ApiStatus.Internal
public abstract class ExternalJavacRunResult implements Future<Boolean> {
public static final ExternalJavacRunResult FAILURE = new ExternalJavacRunResult() {
@Override

View File

@@ -1,8 +1,10 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.javac;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.jps.service.JpsServiceManager;
@ApiStatus.Internal
public final class InProcessRefCollectorCompilerToolExtension extends AbstractRefCollectorCompilerToolExtension {
@Override
protected boolean isEnabled() {

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.javac;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.builders.java.JavaCompilingTool;
import org.jetbrains.jps.incremental.java.ExternalJavacOptionsProvider;
@@ -10,6 +11,7 @@ import org.jetbrains.jps.service.JpsServiceManager;
import java.util.Collection;
import java.util.Collections;
@ApiStatus.Internal
public final class ReferenceCollectorExternalJavacOptionsProvider implements ExternalJavacOptionsProvider {
@Override
public @NotNull Collection<String> getOptions(@NotNull JavaCompilingTool tool, int compilerSdkVersion) {

View File

@@ -0,0 +1,6 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@ApiStatus.Internal
package org.jetbrains.jps.packaging.jlink;
import org.jetbrains.annotations.ApiStatus;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.jps.incremental.groovy;
import com.intellij.compiler.instrumentation.FailSafeClassReader;