All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jetbrains.kotlin.buildtools.internal.ClasspathEntrySnapshotImpl.kt Maven / Gradle / Ivy

There is a newer version: 2.1.20-Beta1
Show newest version
/*
 * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
 * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
 */

package org.jetbrains.kotlin.buildtools.internal

import org.jetbrains.kotlin.buildtools.api.jvm.ClassSnapshot
import org.jetbrains.kotlin.buildtools.api.jvm.ClasspathEntrySnapshot
import org.jetbrains.kotlin.incremental.classpathDiff.AccessibleClassSnapshot
import org.jetbrains.kotlin.incremental.classpathDiff.ClasspathEntrySnapshotExternalizer
import org.jetbrains.kotlin.incremental.classpathDiff.InaccessibleClassSnapshot
import org.jetbrains.kotlin.incremental.storage.saveToFile
import java.io.File

class ClasspathEntrySnapshotImpl(
    private val origin: org.jetbrains.kotlin.incremental.classpathDiff.ClasspathEntrySnapshot,
) :
    ClasspathEntrySnapshot {
    override val classSnapshots: Map
        get() = origin.classSnapshots.mapValues {
            when (val snapshot = it.value) {
                is AccessibleClassSnapshot -> AccessibleClassSnapshotImpl(snapshot.classAbiHash)
                is InaccessibleClassSnapshot -> InaccessibleClassSnapshotImpl
            }
        }

    override fun saveSnapshot(path: File) {
        ClasspathEntrySnapshotExternalizer.saveToFile(path, origin)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy