Jps support

This commit is contained in:
Michael Bogdanov
2015-08-28 19:00:11 +03:00
parent 9e53a0d057
commit 939f28f293
5 changed files with 13 additions and 8 deletions
@@ -21,7 +21,6 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import kotlin.KotlinPackage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
@@ -87,8 +86,7 @@ public class ClassFileFactory implements OutputFileCollection {
}
private void writeModuleMappings(Collection<PackageCodegen> values) {
String moduleName = KotlinPackage.removeSurrounding(state.getModule().getName().asString(), "<", ">");
String outputFilePath = getMappingFileName(moduleName);
String outputFilePath = getMappingFileName(state.getModuleName());
final StringWriter moduleMapping = new StringWriter(1024);
for (PackageCodegen codegen : values) {
codegen.getFacades().serialize(moduleMapping);
@@ -480,7 +480,7 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
@NotNull ClassBuilder classBuilder
) {
classBuilder.newField(NO_ORIGIN, ACC_PUBLIC | ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC, "$moduleName",
AsmTypes.JAVA_STRING_TYPE.getDescriptor(), null, JvmCodegenUtil.getModuleName(state.getModule()));
AsmTypes.JAVA_STRING_TYPE.getDescriptor(), null, state.getModuleName());
}
protected void generatePropertyMetadataArrayFieldIfNeeded(@NotNull Type thisAsmType) {
@@ -51,10 +51,14 @@ public class GenerationState jvmOverloads constructor(
public val packagesWithObsoleteParts: Collection<FqName> = emptySet(),
// for PackageCodegen in incremental compilation mode
public val moduleId: String? = null,
moduleName: String? = null,
// TODO: temporary hack, see JetTypeMapperWithOutDirectory state for details
public val outDirectory: File? = null,
public val progress: Progress = Progress.DEAF
) {
public val moduleName: String = moduleName ?: JvmCodegenUtil.getModuleName(module)
public interface GenerateClassFilter {
public fun shouldAnnotateClass(classOrObject: JetClassOrObject): Boolean
public fun shouldGenerateClass(classOrObject: JetClassOrObject): Boolean
@@ -148,7 +148,8 @@ public class KotlinToJVMBytecodeCompiler {
}
);
GenerationState generationState =
generate(environment, result, jetFiles, module.getModuleName(), new File(module.getOutputDirectory()));
generate(environment, result, jetFiles, module.getModuleName(), new File(module.getOutputDirectory()),
module.getModuleName());
outputFiles.put(module, generationState.getFactory());
}
@@ -302,7 +303,7 @@ public class KotlinToJVMBytecodeCompiler {
result.throwIfError();
return generate(environment, result, environment.getSourceFiles(), null, null);
return generate(environment, result, environment.getSourceFiles(), null, null, null);
}
@Nullable
@@ -357,7 +358,8 @@ public class KotlinToJVMBytecodeCompiler {
@NotNull AnalysisResult result,
@NotNull List<JetFile> sourceFiles,
@Nullable String moduleId,
File outputDirectory
File outputDirectory,
String moduleName
) {
CompilerConfiguration configuration = environment.getConfiguration();
IncrementalCompilationComponents incrementalCompilationComponents = configuration.get(JVMConfigurationKeys.INCREMENTAL_COMPILATION_COMPONENTS);
@@ -388,6 +390,7 @@ public class KotlinToJVMBytecodeCompiler {
diagnosticHolder,
packagesWithObsoleteParts,
moduleId,
moduleName,
outputDirectory
);
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled();
@@ -39,7 +39,7 @@ public class StubProducerExtension(val stubsOutputDir: File) : AnalysisCompleted
files: Collection<JetFile>
): AnalysisResult? {
val forExtraDiagnostics = BindingTraceContext()
val generationState = GenerationState(
project,
StubClassBuilderFactory(),