this repo has no description
1#
2# This file is the default set of rules to compile a Pebble application.
3#
4# Feel free to customize this to your needs.
5#
6import os.path
7
8top = '.'
9out = 'build'
10
11
12def options(ctx):
13 ctx.load('pebble_sdk')
14
15
16def configure(ctx):
17 """
18 This method is used to configure your build. ctx.load(`pebble_sdk`) automatically configures
19 a build for each valid platform in `targetPlatforms`. Platform-specific configuration: add your
20 change after calling ctx.load('pebble_sdk') and make sure to set the correct environment first.
21 Universal configuration: add your change prior to calling ctx.load('pebble_sdk').
22 """
23 ctx.load('pebble_sdk')
24
25
26def build(ctx):
27 ctx.load('pebble_sdk')
28
29 build_worker = os.path.exists('worker_src')
30 binaries = []
31
32 cached_env = ctx.env
33 for platform in ctx.env.TARGET_PLATFORMS:
34 ctx.env = ctx.all_envs[platform]
35 ctx.set_group(ctx.env.PLATFORM_NAME)
36 app_elf = '{}/pebble-app.elf'.format(ctx.env.BUILD_DIR)
37 ctx.pbl_build(source=ctx.path.ant_glob('src/c/**/*.c'), target=app_elf, bin_type='app')
38
39 if build_worker:
40 worker_elf = '{}/pebble-worker.elf'.format(ctx.env.BUILD_DIR)
41 binaries.append({'platform': platform, 'app_elf': app_elf, 'worker_elf': worker_elf})
42 ctx.pbl_build(source=ctx.path.ant_glob('worker_src/c/**/*.c'),
43 target=worker_elf,
44 bin_type='worker')
45 else:
46 binaries.append({'platform': platform, 'app_elf': app_elf})
47 ctx.env = cached_env
48
49 ctx.set_group('bundle')
50 ctx.pbl_bundle(binaries=binaries,
51 js=ctx.path.ant_glob(['src/pkjs/**/*.js',
52 'src/pkjs/**/*.json',
53 'src/common/**/*.js']),
54 js_entry_file='src/pkjs/index.js')