Add support for languages field in iOS/Android/AIR templates

This commit is contained in:
Joshua Granick
2018-07-07 06:48:51 -07:00
parent cd7d2b3fcf
commit 673d1cf014
3 changed files with 76 additions and 70 deletions

View File

@@ -36,6 +36,7 @@
::if (icons != null)::<icon>::foreach icons:: ::if (icons != null)::<icon>::foreach icons::
<image::size::x::size::>::path::</image::size::x::size::>::end:: <image::size::x::size::>::path::</image::size::x::size::>::end::
</icon>::end:: </icon>::end::
::if (languages != null)::<supportedLanguages>::foreach languages::::__current__:: ::end::</supportedLanguages>::end::
<customUpdateUI>false</customUpdateUI> <customUpdateUI>false</customUpdateUI>
<allowBrowserInvocation>false</allowBrowserInvocation> <allowBrowserInvocation>false</allowBrowserInvocation>
<!-- <fileTypes> <!-- <fileTypes>

View File

@@ -15,19 +15,20 @@ android {
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION) targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
versionCode Integer.parseInt(project.VERSION_CODE) versionCode Integer.parseInt(project.VERSION_CODE)
versionName project.VERSION_NAME versionName project.VERSION_NAME
::if (languages != null)::resConfigs ::foreach languages::"::__current__::", ::end::""::end::
} }
::if KEY_STORE:: ::if KEY_STORE::
signingConfigs { signingConfigs {
if (project.KEY_STORE_PASSWORD == 'null') { if (project.KEY_STORE_PASSWORD == 'null') {
def keyStoreFile = project.KEY_STORE.split('/') def keyStoreFile = project.KEY_STORE.split('/')
keyStoreFile = keyStoreFile[keyStoreFile.length - 1] keyStoreFile = keyStoreFile[keyStoreFile.length - 1]
project.KEY_STORE_PASSWORD = getPassword('\nPlease enter key password for ' + keyStoreFile + ':'); project.KEY_STORE_PASSWORD = getPassword('\nPlease enter key password for ' + keyStoreFile + ':');
} }
if (project.KEY_STORE_ALIAS_PASSWORD == 'null') { if (project.KEY_STORE_ALIAS_PASSWORD == 'null') {
project.KEY_STORE_ALIAS_PASSWORD = getPassword("\nPlease enter key alias password for alias " + project.KEY_STORE_ALIAS + ":") project.KEY_STORE_ALIAS_PASSWORD = getPassword("\nPlease enter key alias password for alias " + project.KEY_STORE_ALIAS + ":")
} }
release { release {
storeFile file(project.KEY_STORE) storeFile file(project.KEY_STORE)
@@ -65,14 +66,14 @@ android {
} }
android.applicationVariants.all { variant -> android.applicationVariants.all { variant ->
variant.outputs.each { output -> variant.outputs.each { output ->
def outputFile = output.outputFile def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) { if (outputFile != null && outputFile.name.endsWith('.apk')) {
output.outputFile = new File(outputFile.parent, "::APP_FILE::-" + variant.buildType.name + ".apk") output.outputFile = new File(outputFile.parent, "::APP_FILE::-" + variant.buildType.name + ".apk")
} }
} }
} }
} }
dependencies { dependencies {
@@ -82,57 +83,57 @@ dependencies {
} }
def getPassword(message) { def getPassword(message) {
def password = ''; def password = '';
if (System.console() == null) { if (System.console() == null) {
new SwingBuilder().edt { new SwingBuilder().edt {
dialog( dialog(
title: 'Enter password', title: 'Enter password',
alwaysOnTop: true, alwaysOnTop: true,
size: [350, 150], size: [350, 150],
resizable: false, resizable: false,
locationRelativeTo: null, locationRelativeTo: null,
pack: true, pack: true,
modal: true, modal: true,
show: true show: true
) { ) {
lookAndFeel('system') lookAndFeel('system')
panel(border: new EmptyBorder(10, 10, 10, 10)) { panel(border: new EmptyBorder(10, 10, 10, 10)) {
gridBagLayout() gridBagLayout()
def gbc = new GridBagConstraints(); def gbc = new GridBagConstraints();
gbc.gridx = 0 gbc.gridx = 0
gbc.gridy = 0 gbc.gridy = 0
gbc.fill = GridBagConstraints.HORIZONTAL gbc.fill = GridBagConstraints.HORIZONTAL
gbc.insets = [0, 0, 10, 0] gbc.insets = [0, 0, 10, 0]
label( label(
text: '<html>' + text: '<html>' +
'<body style="width: 350px">' + '<body style="width: 350px">' +
message + message +
'</body>' + '</body>' +
'</html>', '</html>',
constraints: gbc) constraints: gbc)
gbc.gridy = 1 gbc.gridy = 1
input = passwordField(constraints: gbc) input = passwordField(constraints: gbc)
gbc.gridy = 2 gbc.gridy = 2
gbc.fill = GridBagConstraints.NONE gbc.fill = GridBagConstraints.NONE
gbc.insets = [0, 0, 0, 0] gbc.insets = [0, 0, 0, 0]
gbc.ipadx = 50 gbc.ipadx = 50
button = button( button = button(
defaultButton: true, defaultButton: true,
text: 'OK', text: 'OK',
actionPerformed: { actionPerformed: {
password = input.password password = input.password
dispose() dispose()
}, },
constraints: gbc) constraints: gbc)
} }
} }
} }
} else { } else {
password = System.console().readPassword(message) password = System.console().readPassword(message)
} }
return new String(password) return new String(password)
} }

View File

@@ -4,6 +4,10 @@
<dict> <dict>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>en</string> <string>en</string>
::if (languages != null)::<key>CFBundleLocalizations</key>
<array>::foreach languages::
<string>::__current__::</string>::end::
</array>::end::
<key>CFBundleDisplayName</key> <key>CFBundleDisplayName</key>
<string>::APP_TITLE::</string> <string>::APP_TITLE::</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>