Alexey Tsvetkov
4 years ago
committed by
Alexey Tsvetkov
5 changed files with 153 additions and 43 deletions
@ -0,0 +1,59 @@
|
||||
/* |
||||
* Copyright 2020-2021 JetBrains s.r.o. and respective authors and developers. |
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. |
||||
*/ |
||||
|
||||
package org.jetbrains.compose.desktop.application.internal |
||||
|
||||
import java.io.File |
||||
import kotlin.reflect.KProperty |
||||
|
||||
internal class InfoPlistBuilder { |
||||
private val values = LinkedHashMap<InfoPlistKey, String>() |
||||
|
||||
operator fun get(key: InfoPlistKey): String? = values[key] |
||||
operator fun set(key: InfoPlistKey, value: String) { |
||||
values[key] = value |
||||
} |
||||
|
||||
fun writeToFile(file: File) { |
||||
file.writer().buffered().use { writer -> |
||||
writer.run { |
||||
appendLine("<?xml version=\"1.0\" ?>") |
||||
appendLine("<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"https://www.apple.com/DTDs/PropertyList-1.0.dtd\">") |
||||
appendLine("<plist version=\"1.0\">") |
||||
appendLine(" <dict>") |
||||
for ((k, v) in values) { |
||||
appendLine(" <key>${k.name}</key>") |
||||
appendLine(" <string>$v</string>") |
||||
} |
||||
appendLine(" </dict>") |
||||
appendLine("</plist>") |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
internal data class InfoPlistKey(val name: String) |
||||
|
||||
internal object PlistKeys { |
||||
private operator fun getValue(thisRef: PlistKeys, property: KProperty<*>): InfoPlistKey = |
||||
InfoPlistKey(property.name) |
||||
|
||||
val LSMinimumSystemVersion by this |
||||
val CFBundleDevelopmentRegion by this |
||||
val CFBundleAllowMixedLocalizations by this |
||||
val CFBundleExecutable by this |
||||
val CFBundleIconFile by this |
||||
val CFBundleIdentifier by this |
||||
val CFBundleInfoDictionaryVersion by this |
||||
val CFBundleName by this |
||||
val CFBundlePackageType by this |
||||
val CFBundleShortVersionString by this |
||||
val CFBundleSignature by this |
||||
val LSApplicationCategoryType by this |
||||
val CFBundleVersion by this |
||||
val NSHumanReadableCopyright by this |
||||
val NSSupportsAutomaticGraphicsSwitching by this |
||||
val NSHighResolutionCapable by this |
||||
} |
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" ?> |
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
||||
<plist version="1.0"> |
||||
<dict> |
||||
<key>LSMinimumSystemVersion</key> |
||||
<string>10.13</string> |
||||
<key>CFBundleDevelopmentRegion</key> |
||||
<string>English</string> |
||||
<key>CFBundleAllowMixedLocalizations</key> |
||||
<string>true</string> |
||||
<key>CFBundleExecutable</key> |
||||
<string>TestPackage</string> |
||||
<key>CFBundleIconFile</key> |
||||
<string>TestPackage.icns</string> |
||||
<key>CFBundleIdentifier</key> |
||||
<string>MainKt</string> |
||||
<key>CFBundleInfoDictionaryVersion</key> |
||||
<string>6.0</string> |
||||
<key>CFBundleName</key> |
||||
<string>TestPackage</string> |
||||
<key>CFBundlePackageType</key> |
||||
<string>APPL</string> |
||||
<key>CFBundleShortVersionString</key> |
||||
<string>1.0.0</string> |
||||
<key>LSApplicationCategoryType</key> |
||||
<string>Unknown</string> |
||||
<key>CFBundleVersion</key> |
||||
<string>1.0.0</string> |
||||
<key>NSHumanReadableCopyright</key> |
||||
<string>Copyright (C) CURRENT_YEAR</string> |
||||
<key>NSSupportsAutomaticGraphicsSwitching</key> |
||||
<string>true</string> |
||||
<key>NSHighResolutionCapable</key> |
||||
<string>true</string> |
||||
</dict> |
||||
</plist> |
Loading…
Reference in new issue