Skip to content
This repository has been archived by the owner on Jan 10, 2021. It is now read-only.

Commit

Permalink
Add substitutions to files.
Browse files Browse the repository at this point in the history
  • Loading branch information
renpytom committed Jul 25, 2018
1 parent 86d3ed3 commit e4f9cd5
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ project/renpyandroid/src/main/AndroidManifest.xml
project/renpyandroid/src/main/java/org/renpy/android/Constants.java
project/renpyandroid/src/main/res/values/strings.xml
renpy/
project/app/build.gradle
42 changes: 20 additions & 22 deletions buildlib/rapt/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def copy_presplash(directory, name, default):
fn = default
ext = os.path.splitext(fn)[1]

shutil.copy(fn, plat.path("assets/" + name + ext))
shutil.copy(fn, plat.path("project/app/src/main/assets/" + name + ext))


def split_renpy(directory):
Expand Down Expand Up @@ -448,19 +448,6 @@ def build(iface, directory, commands, launch=False, finished=None):
# Figure out versions of the private and public data.
private_version = str(time.time())

for template, i in [
("templates/app-AndroidManifest.xml", "project/app/src/main/AndroidManifest.xml"),
("templates/app-strings.xml", "project/app/src/main/res/values/strings.xml"),
("templates/renpyandroid-AndroidManifest.xml", "project/renpyandroid/src/main/AndroidManifest.xml"),
("templates/renpyandroid-strings.xml", "project/renpyandroid/src/main/res/values/strings.xml"),
]:

render(
template,
i,
private_version=private_version,
config=config)

iface.info("Updating source code.")

# edit_file("src/org/renpy/android/DownloaderActivity.java", r'import .*\.R;', 'import {}.R;'.format(config.package))
Expand Down Expand Up @@ -527,11 +514,22 @@ def make_expansion():
if not config.google_play_salt:
config.google_play_salt = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20"

render(
"templates/Constants.java",
"project/renpyandroid/src/main/java/org/renpy/android/Constants.java",
config=config,
file_size=file_size)
for template, i in [
("templates/app-build.gradle", "project/app/build.gradle"),
("templates/app-AndroidManifest.xml", "project/app/src/main/AndroidManifest.xml"),
("templates/app-strings.xml", "project/app/src/main/res/values/strings.xml"),
("templates/renpyandroid-AndroidManifest.xml", "project/renpyandroid/src/main/AndroidManifest.xml"),
("templates/renpyandroid-strings.xml", "project/renpyandroid/src/main/res/values/strings.xml"),
("templates/Constants.java", "project/renpyandroid/src/main/java/org/renpy/android/Constants.java"),
]:

render(
template,
i,
private_version=private_version,
file_size=file_size,
config=config
)

iface.info("Packaging internal data.")

Expand All @@ -547,9 +545,9 @@ def pack():

# # Copy over the icon files.
# copy_icon(directory, "icon.png", default_icon)
#
# # Copy the presplash files.
# copy_presplash(directory, "android-presplash", default_presplash)

# Copy the presplash files.
copy_presplash(directory, "android-presplash", default_presplash)

# Build.
# iface.info("I'm using Ant to build the package.")
Expand Down
9 changes: 5 additions & 4 deletions templates/app-AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.renpy.aaaexperiment">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="{{ config.package }}">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:label="@string/appName"
android:roundIcon="@mipmap/ic_launcher_round"
android:hardwareAccelerated="true"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
>

<activity
android:name="org.renpy.android.PythonSDLActivity"
android:label="@string/iconName"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize"
android:launchMode="singleTop"
android:screenOrientation="landscape">
android:screenOrientation="{{ config.orientation }}">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -24,4 +25,4 @@
</activity>
</application>

</manifest>
</manifest>
7 changes: 4 additions & 3 deletions project/app/build.gradle → templates/app-build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "org.renpy.aaaexperiment"
applicationId "{{ config.package }}"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
versionCode {{ config.numeric_version }}
versionName "{{ config.version }}"
}

buildTypes {
release {
minifyEnabled false
Expand Down
8 changes: 7 additions & 1 deletion templates/app-strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<resources>
<string name="app_name">AAA Experiment</string>
<string name="appName">{{ config.name }}</string>
<string name="app_name">{{ config.name }}</string>
<string name="iconName">{{ config.icon_name }}</string>
{% if private_version %}
<string name="private_version">{{ private_version }}</string>
{% endif %}

</resources>
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes

0 comments on commit e4f9cd5

Please sign in to comment.