Skip to content

Commit

Permalink
set heap values
Browse files Browse the repository at this point in the history
  • Loading branch information
Bronya-Rand committed Mar 22, 2021
1 parent b5688f3 commit b02cb2b
Showing 1 changed file with 18 additions and 28 deletions.
46 changes: 18 additions & 28 deletions launcher/game/android.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ init python:
return ANDROID_NO_CONFIG
return ANDROID_OK


def AndroidStateText(state):
"""
Returns text corresponding to the state.
Expand Down Expand Up @@ -141,7 +140,6 @@ init python:
else:
return None


class AndroidBuild(Action):
"""
Activates an Android build process.
Expand Down Expand Up @@ -191,7 +189,6 @@ init python:
with open(filename, "wb") as f:
json.dump(android_json, f)


def android_build(command, p=None, gui=True, launch=False, destination=None, opendir=False):
"""
This actually builds the package.
Expand Down Expand Up @@ -277,8 +274,6 @@ init python:
def android_build_argument(cmd):
return cmd + project.current.data["android_build"]



# The android support can stick unicode into os.environ. Fix that.
init 100 python:
for k, v in list(os.environ.items()):
Expand All @@ -301,7 +296,6 @@ screen android_process(interface):
timer .1 action interface.check_process repeat True
timer .2 action ft.update repeat True


screen android:

default tt = Tooltip(None)
Expand Down Expand Up @@ -357,7 +351,6 @@ screen android:
action LaunchEmulator("tv", "small tv android mobile")
hovered tt.Action(OUYA_TEXT)


add SPACER
add SEPARATOR2

Expand Down Expand Up @@ -444,32 +437,31 @@ screen android:
style "l_indent"
has vbox

text _("RAPT Settings")

add SPACER

if tt.value:
text tt.value
else:
text AndroidStateText(state)

text _("Current Java Heap Size: [persistent.heapsize]G")
add SPACER
textbutton _("Change Java Heap Size"):
action AndroidIfState(state, ANDROID_NO_CONFIG, Jump("android_heapsize"))
hovered tt.Action(HEAP_TEXT)

add SEPARATOR2

frame:
style "l_indent"
has vbox

text _("RAPT Settings")

add SPACER

text _("Current Java Heap Size: [persistent.heapsize]G")
add SPACER
textbutton _("Change Java Heap Size"):
action Jump("android_heapsize")
hovered tt.Action(HEAP_TEXT)
if tt.value:
text tt.value
else:
text AndroidStateText(state)

textbutton _("Return") action Jump("front_page") style "l_left_button"


label android:

if RAPT_PATH is None:
Expand All @@ -478,7 +470,6 @@ label android:

call screen android


label android_installsdk:

python:
Expand All @@ -487,7 +478,6 @@ label android_installsdk:

jump android


label android_configure:

python:
Expand Down Expand Up @@ -520,30 +510,31 @@ label android_heapsize:
num_heap_size = int(heap_size)

if num_heap_size <= 2:
interface.error(_("Java Heap Size cannot be less than 3.\n Please try again."), label=None)
interface.error(_("The Java Heap Size cannot be less than 3GB. Please try again."), label=None)
continue

if num_heap_size > 8:
interface.error(_("For safety, the Java Heap Size cannot be greater than 8GB. Please try again."), label=None)
continue

with open(config.basedir + "/gradle.properties", "w+") as javaheap:
javaheap.writelines(["# The setting is particularly useful for tweaking memory settings.\n", "org.gradle.jvmargs=-Xmx" + heap_size + "g\n", "# Disable the gradle daemon, so it doesn't waste ram.\n", "org.gradle.daemon = false"])
os.remove(config.basedir + "/rapt/project/gradle.properties")
shutil.move(config.basedir + "/gradle.properties", config.basedir + "/rapt/project/gradle.properties")

interface.info(_("Set the Java Heap Size To " + heap_size + " GB."),)
interface.info(_("Set the Java Heap Size To " + heap_size + "GB."),)

persistent.heapsize = heap_size
break

jump android



label android_build:

$ android_build([ android_build_argument("assemble") ], opendir=True)

jump android


label android_build_and_install:

$ android_build([ android_build_argument("install") ])
Expand Down Expand Up @@ -585,4 +576,3 @@ init python:
return False

renpy.arguments.register_command("android_build", android_build_command)

0 comments on commit b02cb2b

Please sign in to comment.