[K/N] Allow running compiler with exported libs and without sources

This commit is contained in:
Ilya Matveev
2021-09-07 15:07:27 +07:00
committed by Space
parent 4ad828f80f
commit 8b52411292
3 changed files with 4 additions and 2 deletions
@@ -99,7 +99,7 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
val K2NativeCompilerArguments.isUsefulWithoutFreeArgs: Boolean
get() = listTargets || listPhases || checkDependencies || !includes.isNullOrEmpty() ||
!librariesToCache.isNullOrEmpty() || libraryToAddToCache != null
!librariesToCache.isNullOrEmpty() || libraryToAddToCache != null || !exportedLibraries.isNullOrEmpty()
fun Array<String>?.toNonNullList(): List<String> {
return this?.asList<String>() ?: listOf<String>()
@@ -259,6 +259,7 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
CHECK_DEPENDENCIES,
configuration.kotlinSourceRoots.isNotEmpty()
|| !arguments.includes.isNullOrEmpty()
|| !arguments.exportedLibraries.isNullOrEmpty()
|| outputKind.isCache
|| arguments.checkDependencies
)
@@ -179,6 +179,7 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
val infoArgsOnly = configuration.kotlinSourceRoots.isEmpty()
&& configuration[KonanConfigKeys.INCLUDED_LIBRARIES].isNullOrEmpty()
&& librariesToCache.isEmpty()
&& configuration[KonanConfigKeys.EXPORTED_LIBRARIES].isNullOrEmpty()
fun librariesWithDependencies(moduleDescriptor: ModuleDescriptor?): List<KonanLibrary> {
if (moduleDescriptor == null) error("purgeUnneeded() only works correctly after resolve is over, and we have successfully marked package files as needed or not needed.")
@@ -292,7 +292,7 @@ internal class ObjCExport(val context: Context, symbolTable: SymbolTable) {
}
private fun guessMainPackage(): FqName {
val allPackages = (context.getIncludedLibraryDescriptors() + context.moduleDescriptor).flatMap {
val allPackages = (context.getIncludedLibraryDescriptors() + context.getExportedDependencies() + context.moduleDescriptor).flatMap {
it.getPackageFragments() // Includes also all parent packages, e.g. the root one.
}