[JS IR] IC: pass through the main args

This commit is contained in:
Anton Bannykh
2021-12-17 15:41:49 +03:00
parent 106d3c4c9c
commit ca60caa7e9
3 changed files with 29 additions and 3 deletions
@@ -223,6 +223,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
libraries,
icCaches,
IrFactoryImplForJsIC(WholeWorldStageController()),
mainCallArguments,
::buildCacheForModuleFiles
)
@@ -161,6 +161,7 @@ private fun buildCacheForModule(
cacheConsumer: PersistentCacheConsumer,
signatureDeserializers: Map<FilePath, Map<IdSignature, Int>>,
fileFingerPrints: Map<String, Hash>,
mainArguments: List<String>?,
cacheExecutor: CacheExecutor
) {
val dirtyIrFiles = irModule.files.filter { it.fileEntry.name in dirtyFiles }
@@ -202,7 +203,7 @@ private fun buildCacheForModule(
// TODO: actual way of building a cache could change in future
cacheExecutor.execute(irModule, dependencies, deserializer, configuration, dirtyFiles, deletedFiles, cacheConsumer, emptySet(), null) // TODO: main arguments?
cacheExecutor.execute(irModule, dependencies, deserializer, configuration, dirtyFiles, deletedFiles, cacheConsumer, emptySet(), mainArguments)
cacheConsumer.commitLibraryPath(libraryInfo.libPath.toCanonicalPath(), libraryInfo.flatHash, libraryInfo.transHash)
}
@@ -391,6 +392,7 @@ fun actualizeCacheForModule(
dependencies: Collection<ModulePath>,
icCachePaths: Collection<String>,
irFactory: IrFactory,
mainArguments: List<String>?,
executor: CacheExecutor
): CacheUpdateStatus {
val modulePath = moduleName.toCanonicalPath()
@@ -418,7 +420,17 @@ fun actualizeCacheForModule(
val currentModule = libraries[moduleName.toCanonicalPath()] ?: error("No loaded library found for path $moduleName")
val persistentCacheConsumer = createCacheConsumer(cachePath)
return actualizeCacheForModule(currentModule, cacheInfo, compilerConfiguration, dependencyGraph, persistentCacheProviders, persistentCacheConsumer, irFactory, executor)
return actualizeCacheForModule(
currentModule,
cacheInfo,
compilerConfiguration,
dependencyGraph,
persistentCacheProviders,
persistentCacheConsumer,
irFactory,
mainArguments,
executor
)
}
@@ -430,6 +442,7 @@ private fun actualizeCacheForModule(
persistentCacheProviders: Map<KotlinLibrary, PersistentCacheProvider>,
persistentCacheConsumer: PersistentCacheConsumer,
irFactory: IrFactory,
mainArguments: List<String>?,
cacheExecutor: CacheExecutor
): CacheUpdateStatus {
// 1. Invalidate
@@ -529,6 +542,7 @@ private fun actualizeCacheForModule(
persistentCacheConsumer,
deserializers,
fileFingerPrints,
mainArguments,
cacheExecutor
)
return CacheUpdateStatus.DIRTY // invalidated and re-built
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.KotlinTestWithEnvironment
import org.jetbrains.kotlin.test.services.configuration.JsEnvironmentConfigurator
import org.jetbrains.kotlin.test.util.JUnit4Assertions
import java.io.File
import kotlin.io.path.createTempDirectory
@@ -66,7 +67,16 @@ abstract class AbstractInvalidationTest : KotlinTestWithEnvironment() {
val configuration = createConfiguration("stdlib")
actualizeCacheForModule(stdlibKlibPath, cacheDir.canonicalPath, configuration, listOf(stdlibKlibPath), emptyList(), IrFactoryImpl, ::emptyChecker)
actualizeCacheForModule(
stdlibKlibPath,
cacheDir.canonicalPath,
configuration,
listOf(stdlibKlibPath),
emptyList(),
IrFactoryImpl,
null, // TODO: mainArguments
::emptyChecker
)
stdlibCacheDir = cacheDir
}
@@ -209,6 +219,7 @@ abstract class AbstractInvalidationTest : KotlinTestWithEnvironment() {
dependenciesPaths,
icCaches.map { it.canonicalPath },// + moduleCacheDir.canonicalPath,
IrFactoryImpl,
null, // TODO: mainArguments
::dirtyFilesChecker
)