diff options
author | aleksZubakov <aleks.zubakov@gmail.com> | 2018-07-16 16:56:11 +0300 |
---|---|---|
committer | aleksZubakov <aleks.zubakov@gmail.com> | 2018-07-16 17:05:25 +0300 |
commit | 755b701a4720bf1d0690935898f46dd36c205936 (patch) | |
tree | ec2af23fc2a4c28c1b0e4f1d73ee55bd26845cf4 /core/src/main/kotlin/Analysis/AnalysisEnvironment.kt | |
parent | b3e33f620a387d4623ed7f6d7665fcbed98efffb (diff) | |
parent | f30807f4e78939fb59f8e46c39b3e538070aacfd (diff) | |
download | dokka-755b701a4720bf1d0690935898f46dd36c205936.tar.gz dokka-755b701a4720bf1d0690935898f46dd36c205936.tar.bz2 dokka-755b701a4720bf1d0690935898f46dd36c205936.zip |
Merge branch 'devsite-fixes-backport' into dev-multiplatf
# Conflicts:
# core/src/main/kotlin/Analysis/AnalysisEnvironment.kt
# core/src/test/kotlin/TestAPI.kt
Diffstat (limited to 'core/src/main/kotlin/Analysis/AnalysisEnvironment.kt')
-rw-r--r-- | core/src/main/kotlin/Analysis/AnalysisEnvironment.kt | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt index 3d70bd84..fe9ec2fa 100644 --- a/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt +++ b/core/src/main/kotlin/Analysis/AnalysisEnvironment.kt @@ -34,6 +34,7 @@ import org.jetbrains.kotlin.cli.jvm.config.* import org.jetbrains.kotlin.cli.jvm.index.JavaRoot import org.jetbrains.kotlin.config.* import org.jetbrains.kotlin.container.getService +import org.jetbrains.kotlin.container.tryGetService import org.jetbrains.kotlin.context.ProjectContext import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.ModuleDescriptor @@ -110,7 +111,8 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl } - fun createResolutionFacade(environment: KotlinCoreEnvironment): DokkaResolutionFacade { + fun createResolutionFacade(environment: KotlinCoreEnvironment): Pair<DokkaResolutionFacade, DokkaResolutionFacade> { + val projectContext = ProjectContext(environment.project) val sourceFiles = environment.getSourceFiles() @@ -157,15 +159,17 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl Platform.common -> createCommonResolverForProject(projectContext, module, library, modulesContent, environment) } - resolverForProject.resolverForModule(library) // Required before module to initialize library properly + val resolverForLibrary = resolverForProject.resolverForModule(library) // Required before module to initialize library properly val resolverForModule = resolverForProject.resolverForModule(module) + val libraryModuleDescriptor = resolverForProject.descriptorForModule(library) val moduleDescriptor = resolverForProject.descriptorForModule(module) builtIns?.initialize(moduleDescriptor, true) + val libraryResolutionFacade = DokkaResolutionFacade(environment.project, libraryModuleDescriptor, resolverForLibrary) val created = DokkaResolutionFacade(environment.project, moduleDescriptor, resolverForModule) val projectComponentManager = environment.project as MockComponentManager projectComponentManager.registerService(KotlinCacheService::class.java, CoreKotlinCacheService(created)) - return created + return created to libraryResolutionFacade } private fun createCommonResolverForProject( @@ -342,7 +346,7 @@ class DokkaResolutionFacade(override val project: Project, } override fun <T : Any> tryGetFrontendService(element: PsiElement, serviceClass: Class<T>): T? { - return null + return resolverForModule.componentProvider.tryGetService(serviceClass) } override fun resolveToDescriptor(declaration: KtDeclaration, bodyResolveMode: BodyResolveMode): DeclarationDescriptor { |