Skip to content

Commit 00584b9

Browse files
author
Matthew Tole
committed
Update demo app to latest best practices
1 parent d2893d0 commit 00584b9

File tree

5 files changed

+73
-26
lines changed

5 files changed

+73
-26
lines changed

demo/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11

22
# Ignore build generated files
33
build
4+
5+
node_modules/

demo/appinfo.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

demo/package.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "@smallstoneaps/linked-list-demo",
3+
"version": "1.0.0",
4+
"author": "Matthew Tole",
5+
"description": "Demo app to show the basic usage of the linked-list package",
6+
"main": "src/demo.c",
7+
"scripts": {
8+
"test": "echo \"Error: no test specified\" && exit 1"
9+
},
10+
"license": "MIT",
11+
"private": true,
12+
"dependencies": {
13+
"@smallstoneapps/linked-list": "../"
14+
},
15+
"keywords": [
16+
"pebble-app"
17+
],
18+
"pebble": {
19+
"sdkVersion": "3",
20+
"resources": {
21+
"media": []
22+
},
23+
"projectType": "native",
24+
"uuid": "2f56fb14-9d70-43ec-b6a1-d94e9ea0f3c3",
25+
"messageKeys": {},
26+
"enableMultiJS": false,
27+
"displayName": "Linked List Demo",
28+
"watchapp": {
29+
"onlyShownOnCommunication": false,
30+
"hiddenApp": false,
31+
"watchface": false
32+
},
33+
"targetPlatforms": [
34+
"aplite",
35+
"basalt",
36+
"chalk",
37+
"diorite"
38+
],
39+
"capabilities": []
40+
}
41+
}

demo/src/demo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include <pebble.h>
2-
#include <linked-list.h>
2+
#include <@smallstoneapps/linked-list/linked-list.h>
33

44
static void init(void);
55
static void deinit(void);

demo/wscript

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
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+
#
6+
import os.path
7+
18
top = '.'
29
out = 'build'
310

@@ -7,21 +14,36 @@ def options(ctx):
714

815

916
def configure(ctx):
17+
"""
18+
This method is used to configure your build.
19+
ctx.load(`pebble_sdk`) automatically configures a build for each valid platform in `targetPlatforms`.
20+
Platform-specific configuration: add your change after calling ctx.load('pebble_sdk') and make sure to set the
21+
correct environment first.
22+
Universal configuration: add your change prior to calling ctx.load('pebble_sdk').
23+
"""
1024
ctx.load('pebble_sdk')
1125

1226

1327
def build(ctx):
1428
ctx.load('pebble_sdk')
1529

30+
build_worker = os.path.exists('worker_src')
1631
binaries = []
17-
for p in ctx.env.TARGET_PLATFORMS:
18-
ctx.set_env(ctx.all_envs[p])
32+
33+
cached_env = ctx.env
34+
for platform in ctx.env.TARGET_PLATFORMS:
35+
ctx.env = ctx.all_envs[platform]
1936
ctx.set_group(ctx.env.PLATFORM_NAME)
2037
app_elf = '{}/pebble-app.elf'.format(ctx.env.BUILD_DIR)
21-
ctx.pbl_program(source=ctx.path.ant_glob('src/**/*.c') + ctx.path.find_node('..').ant_glob('src/**/*.c'),
22-
includes=[ctx.path.find_node('../include')],
23-
target=app_elf)
24-
binaries.append({'platform': p, 'app_elf': app_elf})
38+
ctx.pbl_program(source=ctx.path.ant_glob('src/**/*.c'), target=app_elf)
39+
40+
if build_worker:
41+
worker_elf = '{}/pebble-worker.elf'.format(ctx.env.BUILD_DIR)
42+
binaries.append({'platform': p, 'app_elf': app_elf, 'worker_elf': worker_elf})
43+
ctx.pbl_worker(source=ctx.path.ant_glob('worker_src/**/*.c'), target=worker_elf)
44+
else:
45+
binaries.append({'platform': platform, 'app_elf': app_elf})
46+
ctx.env = cached_env
2547

2648
ctx.set_group('bundle')
27-
ctx.pbl_bundle(binaries=binaries, js=ctx.path.ant_glob('src/js/**/*.js'))
49+
ctx.pbl_bundle(binaries=binaries, js=ctx.path.ant_glob(['src/js/**/*.js', 'src/js/**/*.json', 'package.json']), js_entry_file='src/js/app.js')

0 commit comments

Comments
 (0)