8000 Added appropriate ant build files to sdl2_gradle bootstrap · brvier/python-for-android@c1db1a6 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit c1db1a6

Browse files
committed
Added appropriate ant build files to sdl2_gradle bootstrap
`ant debug` now works when run from the dist dir, if ant is available.
1 parent 902f2ba commit c1db1a6

File tree

5 files changed

+160
-17
lines changed

5 files changed

+160
-17
lines changed

pythonforandroid/bootstraps/sdl2_gradle/__init__.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
# coding=utf-8
2-
"""
3-
Bootstrap for SDL2, using gradlew for building
4-
==============================================
5-
6-
.. warning:: Experimental
7-
8-
Good point:
9-
- automatic dependencies management
10-
- no need to unpack aar
11-
12-
"""
13-
141
from pythonforandroid.toolchain import (
152
Bootstrap, shprint, current_directory, info, info_main)
163
from pythonforandroid.util import ensure_dir

pythonforandroid/bootstraps/sdl2_gradle/build/build.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,19 +342,38 @@ def make_package(args):
342342
service_names=service_names,
343343
url_scheme=url_scheme)
344344

345+
render(
346+
'strings.tmpl.xml',
347+
'src/main/res/values/strings.xml',
348+
args=args,
349+
url_scheme=url_scheme,
350+
private_version=str(time.time()))
351+
352+
## gradle build templates
345353
render(
346354
'build.tmpl.gradle',
347355
'build.gradle',
348356
args=args,
349357
aars=aars)
350358

359+
## ant build templates
351360
render(
352-
'strings.tmpl.xml',
353-
'src/main/res/values/strings.xml',
361+
'build.tmpl.xml',
362+
'build.xml',
354363
args=args,
355-
url_scheme=url_scheme,
356-
private_version=str(time.time()))
364+
versioned_name=versioned_name)
357365

366+
render(
367+
'custom_rules.tmpl.xml',
368+
'custom_rules.xml',
369+
args=args)
370+
371+
372+
if args.sign:
373+
render('build.properties', 'build.properties')
374+
else:
375+
if exists('build.properties'):
376+
os.remove('build.properties')
358377

359378
def parse_args(args=None):
360379
global BLACKLIST_PATTERNS, WHITELIST_PATTERNS, PYTHON
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# This file is used to override default values used by the Ant build system.
2+
#
3+
# This file must be checked in Version Control Systems, as it is
4+
# integral to the build system of your project.
5+
6+
# This file is only used by the Ant script.
7+
8+
# You can use this to override default values such as
9+
# 'source.dir' for the location of your java source folder and
10+
# 'out.dir' for the location of your output folder.
11+
12+
# You can also use it define how the release builds are signed by declaring
13+
# the following properties:
14+
# 'key.store' for the location of your keystore and
15+
# 'key.alias' for the name of the key to use.
16+
# The password will be asked during the build when you use the 'release' target.
17+
18+
key.store=${env.P4A_RELEASE_KEYSTORE}
19+
key.alias=${env.P4A_RELEASE_KEYALIAS}
20+
key.store.password=${env.P4A_RELEASE_KEYSTORE_PASSWD}
21+
key.alias.password=${env.P4A_RELEASE_KEYALIAS_PASSWD}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- This should be changed to the name of your project -->
3+
<project name="{{ versioned_name }}" default="help">
4+
5+
<!-- The local.properties file is created and updated by the 'android' tool.
6+
It contains the path to the SDK. It should *NOT* be checked into
7+
Version Control Systems. -->
8+
<property file="local.properties" />
9+
10+
<!-- The ant.properties file can be created by you. It is only edited by the
11+
'android' tool to add properties to it.
12+
This is the place to change some Ant specific build properties.
13+
Here are some properties you may want to change/update:
14+
15+
source.dir
16+
The name of the source directory. Default is 'src'.
17+
out.dir
18+
The name of the output directory. Default is 'bin'.
19+
20+
For other overridable properties, look at the beginning of the rules
21+
files in the SDK, at tools/ant/build.xml
22+
23+
Properties related to the SDK location or the project target should
24+
be updated using the 'android' tool with the 'update' action.
25+
26+
This file is an integral part of the build system for your
27+
application and should be checked into Version Control Systems.
28+
29+
-->
30+
<property file="ant.properties" />
31+
32+
<!-- if sdk.dir was not set from one of the property file, then
33+
get it from the ANDROID_HOME env var.
34+
This must be done before we load project.properties since
35+
the proguard config can use sdk.dir -->
36+
<property environment="env" />
37+
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
38+
<isset property="env.ANDROID_HOME" />
39+
</condition>
40+
41+
<property file="build.properties" />
42+
43+
<!-- The project.properties file is created and updated by the 'android'
44+
tool, as well as ADT.
45+
46+
This contains project specific properties such as project target, and library
47+
dependencies. Lower level build properties are stored in ant.properties
48+
(or in .classpath for Eclipse projects).
49+
50+
This file is an integral part of the build system for your
51+
application and should be checked into Version Control Systems. -->
52+
<loadproperties srcFile="project.properties" />
53+
54+
<!-- quick check on sdk.dir -->
55+
<fail
56+
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
57+
unless="sdk.dir"
58+
/>
59+
60+
<!--
61+
Import per project custom build rules if present at the root of the project.
62+
This is the place to put custom intermediary targets such as:
63+
-pre-build
64+
-pre-compile
65+
-post-compile (This is typically used for code obfuscation.
66+
Compiled code location: ${out.classes.absolute.dir}
67+
If this is not done in place, override ${out.dex.input.absolute.dir})
68+
-post-package
69+
-post-build
70+
-pre-clean
71+
-->
72+
<import file="custom_rules.xml" optional="true" />
73+
74+
<!-- Import the actual build file.
75+
76+
To customize existing targets, there are two options:
77+
- Customize only one target:
78+
- copy/paste the target into this file, *before* the
79+
<import> task.
80+
- customize it to your needs.
81+
- Customize the whole content of build.xml
82+
- copy/paste the content of the rules files (minus the top node)
83+
into this file, replacing the <import> task.
84+
- customize to your needs.
85+
86+
***********************
87+
****** IMPORTANT ******
88+
***********************
89+
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
90+
in order to avoid having your file be overridden by tools such as "android update project"
91+
-->
92+
<!-- version-tag: 1 -->
93+
<import file="${sdk.dir}/tools/ant/build.xml" />
94+
95+
</project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project name="CustomRules">
3+
<target name="-pre-build">
4+
<copy todir="tmp-src">
5+
{% if args.launcher %}
6+
<fileset dir="src/main/java" includes="**" />
7+
{% else %}
8+
<fileset dir="src/main/java">
9+
<exclude name="org/kivy/android/ProjectAdapter.java" />
10+
<exclude name="org/kivy/android/ProjectChooser.java" />
11+
</fileset>
12+
{% endif %}
13+
{% for dir, includes in args.extra_source_dirs %}
14+
<fileset dir="{{ dir }}" includes="{{ includes }}" />
15+
{% endfor %}
16+
</copy>
17+
</target>
18+
<target name="-post-build">
19+
<delete dir="tmp-src" />
20+
</target>
21+
</project>

0 commit comments

Comments
 (0)
0