Rename built-in metadata files starting with dot
Files starting with dot are considered as hidden on Unix systems, and sometimes are ignored by the tools. For example, Android build tools do not package such files to the resulting application, which causes Kotlin reflection to fail there #KT-7088 Fixed
This commit is contained in:
+11
-6
@@ -128,20 +128,25 @@ public class BuiltInsSerializer(private val dependOnOldBuiltIns: Boolean) {
|
||||
val fragments = module.getPackageFragmentProvider().getPackageFragments(fqName)
|
||||
val packageProto = serializer.packageProto(fragments).build() ?: error("Package fragments not serialized: $fragments")
|
||||
packageProto.writeTo(packageStream)
|
||||
write(destDir, BuiltInsSerializationUtil.getPackageFilePath(fqName), packageStream)
|
||||
write(destDir, BuiltInsSerializationUtil.getPackageFilePath(fqName), packageStream,
|
||||
BuiltInsSerializationUtil.FallbackPaths.getPackageFilePath(fqName))
|
||||
|
||||
val nameStream = ByteArrayOutputStream()
|
||||
val strings = serializer.getStringTable()
|
||||
SerializationUtil.serializeStringTable(nameStream, strings.serializeSimpleNames(), strings.serializeQualifiedNames())
|
||||
write(destDir, BuiltInsSerializationUtil.getStringTableFilePath(fqName), nameStream)
|
||||
write(destDir, BuiltInsSerializationUtil.getStringTableFilePath(fqName), nameStream,
|
||||
BuiltInsSerializationUtil.FallbackPaths.getStringTableFilePath(fqName))
|
||||
}
|
||||
|
||||
private fun write(destDir: File, fileName: String, stream: ByteArrayOutputStream) {
|
||||
internal /* KT-5786 */ fun write(destDir: File, fileName: String, stream: ByteArrayOutputStream, legacyFileName: String? = null) {
|
||||
totalSize += stream.size()
|
||||
totalFiles++
|
||||
val file = File(destDir, fileName)
|
||||
file.getParentFile()?.mkdirs()
|
||||
file.writeBytes(stream.toByteArray())
|
||||
File(destDir, fileName).getParentFile().mkdirs()
|
||||
File(destDir, fileName).writeBytes(stream.toByteArray())
|
||||
|
||||
legacyFileName?.let { fileName ->
|
||||
File(destDir, fileName).writeBytes(stream.toByteArray())
|
||||
}
|
||||
}
|
||||
|
||||
private fun serializeClass(
|
||||
|
||||
@@ -29,7 +29,7 @@ Usage: ... <destination dir> (<source dir>)+
|
||||
|
||||
Analyzes Kotlin sources found in the given source directories and serializes
|
||||
found top-level declarations to <destination dir> (files such as
|
||||
.kotlin_string_table, .kotlin_package, *.kotlin_class)"""
|
||||
*.kotlin_string_table, *.kotlin_package, *.kotlin_class)"""
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user