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

Commit

Permalink
Copy files to bin/.
Browse files Browse the repository at this point in the history
  • Loading branch information
renpytom committed Aug 4, 2018
1 parent ec1347a commit a2c8504
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 9 deletions.
5 changes: 0 additions & 5 deletions android.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ def main():

args = ap.parse_args()

if not pygame_sdl2.display.get_init():
pygame_sdl2.display.init()
pygame_sdl2.display.set_mode((640, 480))
pygame_sdl2.event.pump()

iface = interface.Interface()

def check_args(n):
Expand Down
39 changes: 35 additions & 4 deletions buildlib/rapt/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,12 @@ def make_assets():

iface.background(make_assets)

if not os.path.exists(plat.path("bin")):
os.mkdir(plat.path("bin"), 0o777)

if config.expansion:
iface.info("Creating expansion file.")
expansion_file = "main.{}.{}.obb".format(config.numeric_version, config.package)
expansion_file = "bin/main.{}.{}.obb".format(config.numeric_version, config.package)

def make_expansion():

Expand Down Expand Up @@ -513,13 +516,41 @@ def pack():
dest = "/storage/emulated/0/Android/data/{}/{}".format(config.package, expansion_file)
iface.call([ plat.adb, "push", plat.path(expansion_file), dest ], cancel=True)

# if expansion_file is not None:
# plat.rename(plat.path(expansion_file), plat.path("bin/" + expansion_file))
# files.append(plat.path("bin/" + expansion_file))
if expansion_file is not None:
files.append(plat.path(expansion_file))

except subprocess.CalledProcessError:
iface.fail("The build seems to have failed.")

# Copy everything to bin.
apkdirs = [ ]

if any(i.endswith("Debug") for i in commands):
apkdirs.append(plat.path("project/app/build/outputs/apk/debug"))

if any(i.endswith("Release") for i in commands):
apkdirs.append(plat.path("project/app/build/outputs/apk/release"))

for i in apkdirs:
for j in os.listdir(i):

if not j.endswith(".apk"):
continue

sfn = os.path.join(i, j)

dfn = "bin/{}-{}-{}".format(
config.package,
config.numeric_version,
j[4:])

dfn = plat.path(dfn)

shutil.copy(sfn, dfn)
files.append(dfn)

# Launch.

if launch:
iface.info("Launching app.")

Expand Down
5 changes: 5 additions & 0 deletions buildlib/rapt/iconmaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ class IconMaker(object):

def __init__(self, directory):

if not pygame_sdl2.display.get_surface():
pygame_sdl2.display.init()
pygame_sdl2.display.set_mode((640, 480))
pygame_sdl2.event.pump()

self.directory = directory

sizes = [
Expand Down

0 comments on commit a2c8504

Please sign in to comment.