Skip to content

Commit df4f65f

Browse files
committed
Added symlink_java_src dev option
1 parent 1327638 commit df4f65f

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

pythonforandroid/bootstrap.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,11 @@ def prepare_build_dir(self):
8989
self.build_dir = self.get_build_dir()
9090
shprint(sh.cp, '-r',
9191
join(self.bootstrap_dir, 'build'),
92-
# join(self.ctx.root_dir,
93-
# 'bootstrap_templates',
94-
# self.name),
9592
self.build_dir)
93+
if self.ctx.symlink_java_src:
94+
info('Symlinking java src instead of copying')
95+
shprint(sh.rm, '-r', join(self.build_dir, 'src'))
96+
shprint(sh.ln, '-s', join(self.bootstrap_dir, 'build', 'src'), self.build_dir)
9697
with current_directory(self.build_dir):
9798
with open('project.properties', 'w') as fileh:
9899
fileh.write('target=android-{}'.format(self.ctx.android_api))

pythonforandroid/build.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class Context(object):
3333
libs_dir = None # where Android libs are cached after build but
3434
# before being placed in dists
3535
aars_dir = None
36-
javaclass_dir = None
3736

3837
ccache = None # whether to use ccache
3938
cython = None # the cython interpreter name
@@ -46,6 +45,8 @@ class Context(object):
4645

4746
recipe_build_order = None # Will hold the list of all built recipes
4847

48+
symlink_java_src = False # If True, will symlink instead of copying during build
49+
4950
@property
5051
def packages_path(self):
5152
'''Where packages are downloaded before being unpacked'''

pythonforandroid/toolchain.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,14 @@ def __init__(self):
256256
'--ndk-version', '--ndk_version', dest='ndk_version', default='',
257257
help=('The version of the Android NDK. This is optional, '
258258
'we try to work it out automatically from the ndk_dir.'))
259+
generic_parser.add_argument(
260+
'--symlink-java-src', '--symlink_java_src',
261+
action='store_true',
262+
dest='symlink_java_src',
263+
default=False,
264+
help=('If True, symlinks the java src folder during build and dist '
265+
'creation. This is useful for development only, it could also '
266+
'cause weird problems.'))
259267

260268
default_storage_dir = user_data_dir('python-for-android')
261269
if ' ' in default_storage_dir:
@@ -454,6 +462,7 @@ def add_parser(subparsers, *args, **kwargs):
454462
self.ndk_dir = args.ndk_dir
455463
self.android_api = args.android_api
456464
self.ndk_version = args.ndk_version
465+
self.ctx.symlink_java_src = args.symlink_java_src
457466

458467
self._archs = split_argument_list(args.arch)
459468

0 commit comments

Comments
 (0)