|
1 | | -import re |
2 | | - |
3 | 1 | # To learn about Buck see [Docs](https://buckbuild.com/). |
4 | 2 | # To run your application with Buck: |
5 | 3 | # - install Buck |
6 | 4 | # - `npm start` - to start the packager |
7 | 5 | # - `cd android` |
8 | | -# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US` |
| 6 | +# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` |
9 | 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck |
10 | 8 | # - `buck install -r android/app` - compile, install and run application |
11 | 9 | # |
12 | 10 |
|
13 | 11 | lib_deps = [] |
| 12 | + |
14 | 13 | for jarfile in glob(['libs/*.jar']): |
15 | | - name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile) |
| 14 | + name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')] |
16 | 15 | lib_deps.append(':' + name) |
17 | 16 | prebuilt_jar( |
18 | 17 | name = name, |
19 | 18 | binary_jar = jarfile, |
20 | 19 | ) |
21 | 20 |
|
22 | 21 | for aarfile in glob(['libs/*.aar']): |
23 | | - name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile) |
| 22 | + name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] |
24 | 23 | lib_deps.append(':' + name) |
25 | 24 | android_prebuilt_aar( |
26 | 25 | name = name, |
27 | 26 | aar = aarfile, |
28 | 27 | ) |
29 | 28 |
|
30 | 29 | android_library( |
31 | | - name = 'all-libs', |
32 | | - exported_deps = lib_deps |
| 30 | + name = "all-libs", |
| 31 | + exported_deps = lib_deps, |
33 | 32 | ) |
34 | 33 |
|
35 | 34 | android_library( |
36 | | - name = 'app-code', |
37 | | - srcs = glob([ |
38 | | - 'src/main/java/**/*.java', |
39 | | - ]), |
40 | | - deps = [ |
41 | | - ':all-libs', |
42 | | - ':build_config', |
43 | | - ':res', |
44 | | - ], |
| 35 | + name = "app-code", |
| 36 | + srcs = glob([ |
| 37 | + "src/main/java/**/*.java", |
| 38 | + ]), |
| 39 | + deps = [ |
| 40 | + ":all-libs", |
| 41 | + ":build_config", |
| 42 | + ":res", |
| 43 | + ], |
45 | 44 | ) |
46 | 45 |
|
47 | 46 | android_build_config( |
48 | | - name = 'build_config', |
49 | | - package = 'com.basic', |
| 47 | + name = "build_config", |
| 48 | + package = "com.basic", |
50 | 49 | ) |
51 | 50 |
|
52 | 51 | android_resource( |
53 | | - name = 'res', |
54 | | - res = 'src/main/res', |
55 | | - package = 'com.basic', |
| 52 | + name = "res", |
| 53 | + package = "com.basic", |
| 54 | + res = "src/main/res", |
56 | 55 | ) |
57 | 56 |
|
58 | 57 | android_binary( |
59 | | - name = 'app', |
60 | | - package_type = 'debug', |
61 | | - manifest = 'src/main/AndroidManifest.xml', |
62 | | - keystore = '//android/keystores:debug', |
63 | | - deps = [ |
64 | | - ':app-code', |
65 | | - ], |
| 58 | + name = "app", |
| 59 | + keystore = "//android/keystores:debug", |
| 60 | + manifest = "src/main/AndroidManifest.xml", |
| 61 | + package_type = "debug", |
| 62 | + deps = [ |
| 63 | + ":app-code", |
| 64 | + ], |
66 | 65 | ) |
0 commit comments