Added incremental compilation flag. For publishing intermediate implementation.

This commit is contained in:
Evgeny Gerashchenko
2014-03-11 23:56:50 +04:00
parent 3553f0701c
commit a502374a62
8 changed files with 68 additions and 16 deletions
@@ -30,6 +30,7 @@ import org.jetbrains.jet.codegen.context.CodegenContext;
import org.jetbrains.jet.codegen.context.MethodContext;
import org.jetbrains.jet.codegen.context.PackageContext;
import org.jetbrains.jet.codegen.state.JetTypeMapper;
import org.jetbrains.jet.config.IncrementalCompilation;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.descriptors.annotations.Annotated;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
@@ -168,6 +169,10 @@ public class CodegenUtil {
PackageFragmentDescriptor fragment1 = (PackageFragmentDescriptor) owner1;
PackageFragmentDescriptor fragment2 = (PackageFragmentDescriptor) owner2;
if (!IncrementalCompilation.ENABLED) {
return fragment1 == fragment2;
}
// backing field should be used directly within same module of same package
// TODO calls from other modules/libraries should use facade: KT-4590
return fragment1.getFqName().equals(fragment2.getFqName()) && DescriptorUtils.areInSameModule(fragment1, fragment2);
@@ -37,6 +37,7 @@ import org.jetbrains.jet.codegen.context.MethodContext;
import org.jetbrains.jet.codegen.signature.JvmMethodSignature;
import org.jetbrains.jet.codegen.context.PackageContext;
import org.jetbrains.jet.codegen.state.GenerationState;
import org.jetbrains.jet.config.IncrementalCompilation;
import org.jetbrains.jet.descriptors.serialization.*;
import org.jetbrains.jet.descriptors.serialization.descriptors.DeserializedCallableMemberDescriptor;
import org.jetbrains.jet.descriptors.serialization.descriptors.DeserializedPropertyDescriptor;
@@ -113,6 +114,10 @@ public class PackageCodegen extends GenerationStateAware {
@Nullable
private PackageFragmentDescriptor getCompiledPackageFragment() {
if (!IncrementalCompilation.ENABLED) {
return null;
}
// TODO rewrite it to something more robust when module system is implemented
for (PackageFragmentDescriptor anotherFragment : packageFragment.getContainingDeclaration().getPackageFragmentProvider()
.getPackageFragments(packageFragment.getFqName())) {
@@ -29,6 +29,7 @@ import org.jetbrains.jet.codegen.signature.BothSignatureWriter;
import org.jetbrains.jet.codegen.signature.JvmMethodParameterKind;
import org.jetbrains.jet.codegen.signature.JvmMethodParameterSignature;
import org.jetbrains.jet.codegen.signature.JvmMethodSignature;
import org.jetbrains.jet.config.IncrementalCompilation;
import org.jetbrains.jet.descriptors.serialization.descriptors.DeserializedCallableMemberDescriptor;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.descriptors.impl.AnonymousFunctionDescriptor;
@@ -132,7 +133,7 @@ public class JetTypeMapper extends BindingTraceAware {
if (file != null) {
return PackageCodegen.getPackagePartInternalName(file);
}
if (descriptor instanceof DeserializedCallableMemberDescriptor) {
if (descriptor instanceof DeserializedCallableMemberDescriptor && IncrementalCompilation.ENABLED) {
//
// TODO calls from other modules/libraries should use facade: KT-4590
return PackageCodegen.getPackagePartInternalName((DeserializedCallableMemberDescriptor) descriptor);
@@ -0,0 +1,21 @@
/*
* Copyright 2010-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.
*/
package org.jetbrains.jet.config;
public class IncrementalCompilation {
public static final boolean ENABLED = "true".equals(System.getProperty("kotlin.incremental.compilation"));
}