Skip to content

Commit 1fd4412

Browse files
cohenmiccohenmickey
cohenmic
authored andcommitted
APL-CORE: March 2020 Release of APL 1.3 compilant core engine
For more details on theis release refer to CHANGELOG.md To learn about APL see: https://developer.amazon.com/docs/alexa-presentation-language/understand-apl.html
1 parent 1b26c92 commit 1fd4412

File tree

235 files changed

+20925
-2927
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+20925
-2927
lines changed

CHANGELOG.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Changelog
2+
## [1.3.0]
3+
4+
Welcome to the March 2020 release of apl-core-library. This release supports version
5+
1.3 of the APL specification.
6+
7+
### Added
8+
9+
- Added support for Windows and the Microsoft Visual C++ compiler.
10+
- Added support for Finish Command.
11+
- Added background property to documents.
12+
- Added Time functions for displaying and formatting time values. Included
13+
three top-level bound variables for the current time: elapsedTime, localTime,
14+
and utcTime.
15+
- Added export to documents.
16+
- Added support for the Select command.
17+
- Added document extensions, extension event handlers and extension commands.
18+
The data-binding environment includes a new extensions property that informs
19+
the APL document which extensions have been loaded.
20+
- Added definition for new Backstack Extension to enable back navigation.
21+
- Added handleKeyUp and handleKeydown properties to the top-level APL document and components.
22+
- Added dynamic data containers: LiveArray and LiveMaps.
23+
24+
### Changed
25+
26+
- Updated reported version numbers from 1.2 to 1.3.
27+
- Bug fixes.
28+
29+

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# permissions and limitations under the License.
1313

1414
cmake_minimum_required(VERSION 3.5)
15+
project(APLCoreEngine)
1516
set(CMAKE_CXX_STANDARD 11)
1617
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1718

Docker.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# README: APL Docker
2+
3+
This Dockerfile provides an image for building and testing the `APL Core Engine` library.
4+
This image can be used to build and test the core library and to build the library
5+
documentation.
6+
7+
## Docker
8+
9+
* Install Docker: https://docs.docker.com/get-started/
10+
* Start in the APLCoreEngine directory
11+
```bash
12+
$ cd <workspace>
13+
$ ls
14+
APLCoreEngine APLViewhostAndroid
15+
$ cd APLCoreEngine
16+
```
17+
18+
### 1) Create the Docker image
19+
20+
Build an image from the Dockerfile:
21+
```bash
22+
$ docker build -t apl:apl-core .
23+
$ docker images
24+
```
25+
26+
### 2) Running an interactive shell
27+
28+
Run an interactive bash shell to directly test the container.
29+
```bash
30+
$ docker run -it -v "$PWD":/apl/ apl:apl-core
31+
```
32+
33+
### 3) Build and run the unit tests
34+
35+
Test the core engine by running the unit tests. This command
36+
expects your current directory to be `APLCoreEngine`:
37+
38+
```bash
39+
$ docker run --rm -v "$PWD":/apl/ -w /apl apl:apl-core -c "source apl-dev-env.sh && apl-test-core"
40+
```
41+
42+
If you had previously built and tested the core engine from outside of Docker, you may need to
43+
remove your old build directory. Append a `-f` (force) flag to the `apl-test-core` command.
44+
45+
### 4) Build the documentation
46+
47+
Build the core engine documentation. This command expects
48+
your current directory to be `APLCoreEngine`:
49+
50+
```bash
51+
$ docker run --rm -v "$PWD":/apl/ -w /apl apl:apl-core -c "source apl-dev-env.sh && apl-build-doc"
52+
```

README.md

+31-3
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,16 @@ input focus events.
152152
- Supported Compilers:
153153
- GNU GCC and G++ version 5.3.1 or higher
154154
- LLVM and clang version 6.0.0 or higher
155+
- MSVC version 16 2019 or higher
155156
- CMake, version 3.5 or higher
156-
157-
# Building APL Core + Running Tests
158-
To compile `libaplcore.a` and test in your favorite C++ environment, do the
157+
- For Windows, Ninja build system, 1.9.0 or higher, see:
158+
https://github.com/ninja-build/ninja
159+
- For Windows, the patch executable should be accessible on the system's PATH.
160+
The Windows build has been tested using the patch executable that ships with Git.
161+
The GnuWin32 patch executable is NOT recommended.
162+
163+
# Building APL Core + Tests (Linux and Mac OS)
164+
To build `libaplcore.a` and tests in your favorite C++ environment, do the
159165
following:
160166

161167
```
@@ -164,6 +170,21 @@ following:
164170
$ apl-test-core
165171
```
166172

173+
# Building APL Core + Tests (Windows)
174+
To build `apl.lib` and tests in in a Windows or UWP environment, do the
175+
following:
176+
177+
```
178+
Start a VS Command Prompt (tested with "x64 Native Tools Command Prompt for VS 2019")
179+
C:\APLCoreEngine> mkdir build
180+
C:\APLCoreEngine> cd build
181+
C:\APLCoreEngine\build> cmake -G"Ninja" -DBUILD_TESTS=ON -DCOVERAGE=OFF -DCMAKE_BUILD_TYPE=Release ..
182+
C:\APLCoreEngine\build> ninja -j1
183+
```
184+
(If using the GnuWin32 patch.exe instead Git's patch.exe, the command prompt may need to run in
185+
Administrator Mode)
186+
187+
# Running Tests
167188
After the build succeeds, there are a number of test programs included in the `build/test`
168189
directory. For example, to validate the color parser, try:
169190

@@ -212,4 +233,11 @@ In order to build the tools use:
212233
```
213234
$ cmake -DTOOLS=ON
214235
```
236+
237+
## Paranoid build
238+
In order to build library with -Werror use:
239+
```
240+
$ cmake -DWERROR=ON
241+
```
242+
215243
≠≠≠

apl-dev-env.sh

+45-26
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ export APL_DIR=$(pwd)
1919
# Amazon Linux uses cmake3
2020
export CMAKE=$(command -v cmake3 || command -v cmake)
2121

22+
if [ -e /proc/cpuinfo ]; then # Linux
23+
APL_BUILD_PROCS=$(grep -c ^processor /proc/cpuinfo)
24+
elif [ $(sysctl -n hw.ncpu) ]; then # Mac
25+
APL_BUILD_PROCS=$(sysctl -n hw.ncpu)
26+
else # Other/fail
27+
APL_BUILD_PROCS=4
28+
fi
29+
export APL_BUILD_PROCS
30+
2231

2332
function apl-parse-args {
2433
FORCE=false
@@ -96,15 +105,23 @@ function apl-build-core { # Run make for the core build
96105
(
97106
apl-switch-to-build-directory build $@ && \
98107
$CMAKE -DBUILD_TESTS=ON -DCOVERAGE=OFF .. && \
99-
make -j4
108+
make -j$APL_BUILD_PROCS
109+
)
110+
}
111+
112+
function apl-check-core { # Run make for the core build with -Werror
113+
(
114+
apl-switch-to-build-directory build $@ && \
115+
$CMAKE -DBUILD_TESTS=ON -DWERROR=ON -DCOVERAGE=OFF .. && \
116+
make -j$APL_BUILD_PROCS
100117
)
101118
}
102119

103120
function apl-test-core { # Run unit tests in the core build
104121
(
105122
apl-switch-to-build-directory build $@ && \
106123
$CMAKE -DBUILD_TESTS=ON -DCOVERAGE=OFF .. && \
107-
make -j4 && \
124+
make -j$APL_BUILD_PROCS && \
108125
unit/unittest
109126
)
110127
}
@@ -134,15 +151,15 @@ function apl-build-doc { # Run make for the documentation
134151
(
135152
apl-switch-to-build-directory doc-build $@ && \
136153
$CMAKE .. && \
137-
make -j4 doc
154+
make -j$APL_BUILD_PROCS doc
138155
)
139156
}
140157

141158
function apl-open-doc { # Open the documentation (works on MacOS)
142159
(
143160
apl-switch-to-build-directory doc-build $@ && \
144161
$CMAKE .. && \
145-
make -j4 doc && \
162+
make -j$APL_BUILD_PROCS doc && \
146163
open html/index.html
147164
)
148165
}
@@ -215,15 +232,13 @@ function apl-config-android { # Run cmake for Android
215232
rm -rf android-build
216233
fi
217234

218-
if [[ ! -e android-build ]] ; then
219-
mkdir android-build
220-
cd android-build
221-
echo "Running $CMAKE"
222-
$CMAKE -DANDROID_ABI="x86" \
223-
-DANDROID_PLATFORM=android-24 \
224-
-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_FILE \
225-
-DAPL_JNI=ON ..
226-
fi
235+
mkdir -p android-build
236+
cd android-build
237+
echo "Running $CMAKE"
238+
$CMAKE -DANDROID_ABI="x86" \
239+
-DANDROID_PLATFORM=android-24 \
240+
-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_FILE \
241+
-DAPL_JNI=ON ..
227242
)
228243
}
229244

@@ -245,8 +260,8 @@ function apl-clean-android {
245260
function apl-build-android { # Run make for the Android build
246261
(
247262
cd $APL_DIR
248-
[[ -e android-build ]] || apl-config-android
249-
cd android-build && make -j4
263+
apl-config-android
264+
cd android-build && make -j$APL_BUILD_PROCS
250265
)
251266
}
252267

@@ -264,18 +279,16 @@ function apl-verify-android { # verify android - assemble, test, build without l
264279
function apl-config-wasm { # Run cmake in the wasm build
265280
(
266281
cd $APL_DIR
267-
if [[ ! -e wasm-build ]] ; then
268-
mkdir wasm-build
269-
cd wasm-build
270-
emcmake cmake -DEMSCRIPTEN=ON -DBUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Debug -DEMSCRIPTEN_SOURCEMAPS=ON -DBUILD_TESTS=OFF ..
271-
fi
282+
mkdir -p wasm-build
283+
cd wasm-build
284+
emcmake cmake -DEMSCRIPTEN=ON -DBUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Debug -DEMSCRIPTEN_SOURCEMAPS=ON -DBUILD_TESTS=OFF ..
272285
)
273286
}
274287

275288
function apl-clean-wasm {
276289
(
277290
cd $APL_DIR
278-
[[ -e wasm-build ]] || apl-config-wasm
291+
apl-config-wasm
279292

280293
cd wasm-build && make clean
281294
)
@@ -284,16 +297,16 @@ function apl-clean-wasm {
284297
function apl-build-wasm { # Build the wasm source
285298
(
286299
cd $APL_DIR
287-
[[ -e wasm-build ]] || apl-config-wasm
300+
apl-config-wasm
288301

289-
cd wasm-build && make -j4 && make wasm-build
302+
cd wasm-build && make -j$APL_BUILD_PROCS && make wasm-build
290303
)
291304
}
292305

293306
function apl-install-wasm { # Install the wasm source for the sandbox
294307
(
295308
cd $APL_DIR
296-
[[ -e wasm-build ]] || apl-build-wasm
309+
apl-build-wasm
297310

298311
cd wasm-build && make install
299312
)
@@ -302,7 +315,7 @@ function apl-install-wasm { # Install the wasm source for the sandbox
302315
function apl-run-wasm-sandbox { # Run the wasm sandbox. Does not return
303316
(
304317
cd $APL_DIR
305-
[[ -e wasm-build ]] || apl-install-wasm
318+
apl-install-wasm
306319

307320
cd wasm/js/apl-wasm-sandbox && node server.js public
308321
)
@@ -311,7 +324,7 @@ function apl-run-wasm-sandbox { # Run the wasm sandbox. Does not return
311324
function apl-test-wasm { # Run wasm tests. Does not return
312325
(
313326
cd $APL_DIR
314-
[[ -e wasm-build ]] || apl-config-wasm
327+
apl-config-wasm
315328

316329
cd wasm-build && make install && make wasm-test
317330
)
@@ -339,3 +352,9 @@ function apl-test-all { # Test all sources
339352
apl-test-core
340353
apl-test-wasm
341354
}
355+
356+
function apl-distclean { # Distclean removes all artifacts from building and configuring
357+
apl-clean-all
358+
rm -rf build # remove core artifacts
359+
rm -rf ./*-build* # remove viewhost artifacts
360+
}

0 commit comments

Comments
 (0)