Skip to content

Commit 6f7473d

Browse files
committed
APL-CORE: June 2024 Release of APL 2024.2 compilant core engine (2024.2.0)
For more details on this release refer to CHANGELOG.md To learn about APL see: https://developer.amazon.com/docs/alexa-presentation-language/understand-apl.html
1 parent b2bf611 commit 6f7473d

File tree

209 files changed

+15540
-1677
lines changed

Some content is hidden

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

209 files changed

+15540
-1677
lines changed

CHANGELOG.md

+19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Changelog
22

3+
## [2024.2]
4+
5+
This release adds support for version 2024.2 of the APL specification.
6+
7+
### Added
8+
9+
- Add "onLayout" handler for components.
10+
- Add 'allowForward' and 'allowBackwards' properties to the event context of ScrollView, Sequence and GridSequence.
11+
- Add 'screenLock' property to the video component
12+
- Add text metrics to text component’s "onTextLayout" handler.
13+
- Add -experimentalIsReactive and Reactive Conditional Inflation.
14+
- Add 'pointerEvents' to control pointer events consumption rules.
15+
- Add PackageManager API to handle imports.
16+
17+
### Changed
18+
19+
- Bug fixes
20+
- Performance improvements
21+
322
## [2024.1]
423

524
This release adds support for version 2024.1 of the APL specification.

android/.gitignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.gradle
2+
**/*.iml
3+
apl/.externalNativeBuild/
4+
local.properties
5+
captures/
6+
build/
7+
.git
8+
build
9+
.idea/
10+
.vscode
11+
.DS_Store
12+
**/.cxx/
13+
jacoco.exec
14+
# Project-specific cache directory generated by Gradle
15+
/.gradle/
16+
# Generated by run-gradlew
17+
gradle/wrapper/gradle-wrapper.properties

android/build.gradle

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
7+
8+
def version = "2024.2.0";
9+
10+
buildscript {
11+
repositories {
12+
google()
13+
jcenter()
14+
}
15+
dependencies {
16+
classpath 'com.android.tools.build:gradle:8.0.2'
17+
classpath 'org.jacoco:org.jacoco.core:0.8.8'
18+
19+
// NOTE: Do not place your application dependencies here; they belong
20+
// in the individual module build.gradle files
21+
}
22+
}
23+
24+
subprojects {
25+
apply plugin: 'maven-publish'
26+
27+
if (System.getenv("VERSION")) {
28+
project.version = System.getenv("VERSION")
29+
} else if (System.getenv("BUILD_ID")) {
30+
project.version = "${version}." + System.getenv("BUILD_ID")
31+
} else {
32+
project.version = "${version}." + System.currentTimeMillis()
33+
}
34+
project.group = "com.amazon.apl.android"
35+
36+
repositories {
37+
google()
38+
jcenter()
39+
}
40+
}
41+
42+
task clean(type: Delete) {
43+
delete rootProject.buildDir
44+
}

android/buildSrc/build.gradle

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins {
2+
id 'java'
3+
}
4+
5+
dependencies {
6+
implementation gradleApi()
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
package com.amazon.apl.android;
2+
3+
import org.gradle.api.Action;
4+
import org.gradle.api.DefaultTask;
5+
import org.gradle.api.Task;
6+
import org.gradle.api.file.RegularFile;
7+
import org.gradle.api.plugins.JavaPluginExtension;
8+
import org.gradle.api.provider.Property;
9+
import org.gradle.api.provider.Provider;
10+
import org.gradle.api.tasks.TaskAction;
11+
import org.gradle.api.tasks.OutputDirectory;
12+
import org.gradle.api.file.RegularFileProperty;
13+
import org.gradle.api.tasks.compile.JavaCompile;
14+
import org.gradle.jvm.toolchain.JavaCompiler;
15+
import org.gradle.jvm.toolchain.JavaLanguageVersion;
16+
import org.gradle.jvm.toolchain.JavaLauncher;
17+
import org.gradle.jvm.toolchain.JavaToolchainService;
18+
import org.gradle.jvm.toolchain.JavaToolchainSpec;
19+
import org.gradle.jvm.toolchain.JvmImplementation;
20+
import org.gradle.jvm.toolchain.JvmVendorSpec;
21+
import org.gradle.process.ExecOperations;
22+
23+
import java.io.File;
24+
import java.util.ArrayList;
25+
import java.util.List;
26+
import java.util.Set;
27+
28+
import javax.inject.Inject;
29+
30+
class CMakeTask extends DefaultTask {
31+
private final ExecOperations execOperations;
32+
private List<String> cmakeArgs = new ArrayList<>();
33+
private List<String> makeTargets = new ArrayList<>();
34+
35+
private RegularFile buildDirectory;
36+
37+
@OutputDirectory
38+
public RegularFileProperty getBuildFolder() {
39+
return getProject().getObjects().fileProperty()
40+
.convention(buildDirectory);
41+
}
42+
43+
@Inject
44+
public CMakeTask(ExecOperations execOperations) {
45+
this.execOperations = execOperations;
46+
cmakeArgs.add("../../../../");
47+
48+
buildDirectory = getProject().getLayout().getProjectDirectory().file(".cxx/cmake/debug/host/");
49+
}
50+
51+
public void cmakeArgs(String... args) {
52+
cmakeArgs.addAll(List.of(args));
53+
}
54+
55+
public void makeTargets(String... targets) {
56+
makeTargets.addAll(List.of(targets));
57+
}
58+
59+
@TaskAction
60+
public void run() {
61+
String hostDir = buildDirectory.getAsFile().getAbsolutePath();
62+
63+
File folder = new File(hostDir);
64+
if (!folder.exists()) {
65+
folder.mkdirs();
66+
}
67+
68+
// Find a java 17 jdk. The embedded one in Android Studio doesn't include JNI.
69+
JavaToolchainService service = getProject().getExtensions().getByType(JavaToolchainService.class);
70+
Provider<JavaCompiler> compiler = service.compilerFor(javaToolchainSpec -> javaToolchainSpec.getLanguageVersion().set(JavaLanguageVersion.of(17)));
71+
72+
if (!compiler.isPresent()) {
73+
throw new RuntimeException("Unable to find a suitable jdk on the system.");
74+
}
75+
76+
String jdkPath = compiler.get().getMetadata().getInstallationPath().getAsFile().getAbsolutePath();
77+
78+
getProject().getLogger().error(jdkPath);
79+
80+
execOperations.exec(execSpec -> {
81+
execSpec.workingDir(hostDir);
82+
execSpec.commandLine("cmake");
83+
execSpec.args(cmakeArgs);
84+
execSpec.environment("JAVA_HOME", jdkPath);
85+
});
86+
87+
execOperations.exec(execSpec -> {
88+
execSpec.workingDir(hostDir);
89+
execSpec.commandLine("make");
90+
execSpec.args(makeTargets);
91+
execSpec.environment("JAVA_HOME", jdkPath);
92+
});
93+
}
94+
}
95+

android/coreengine/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build
2+
/.cxx

android/coreengine/CMakeLists.txt

+158
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# For more information about using CMake with Android Studio, read the
2+
# documentation: https://d.android.com/studio/projects/add-native-code.html
3+
4+
# Sets the minimum version of CMake required to build the native library.
5+
include(FetchContent OPTIONAL RESULT_VARIABLE HAS_FETCH_CONTENT)
6+
7+
cmake_minimum_required(VERSION 3.18.1)
8+
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
9+
set(CMAKE_CXX_STANDARD 11)
10+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
11+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
12+
project (apl-android-native VERSION 1.0.0 LANGUAGES C CXX)
13+
14+
set(APL_PROJECT_DIR ${APL_PROJECT_DIR})
15+
16+
if (DEFINED SCENE_GRAPH)
17+
set(ENABLE_SCENEGRAPH ${SCENE_GRAPH})
18+
endif()
19+
20+
# Tell core to compile alexa extensions.
21+
set(ENABLE_ALEXAEXTENSIONS ON)
22+
set(BUILD_ALEXAEXTENSIONS ON)
23+
set(USE_PROVIDED_YOGA_INLINE ON)
24+
set(ENABLE_PIC ON)
25+
26+
FetchContent_Declare(
27+
aplcore
28+
SOURCE_DIR ${APL_PROJECT_DIR}
29+
)
30+
FetchContent_MakeAvailable(aplcore)
31+
32+
set(RAPIDJSON_INCLUDE "${CMAKE_BINARY_DIR}/_deps/rapidjson-src/include")
33+
set(ENUMGEN_BIN "${CMAKE_BINARY_DIR}/tools/enumgen")
34+
35+
add_custom_target(generate-android-enums ALL
36+
COMMAND cd ${APL_PROJECT_DIR} && ${ENUMGEN_BIN}
37+
-f "AnimationQuality"
38+
-f "AudioPlayerEventType"
39+
-f "BlendMode"
40+
-f "ComponentType"
41+
-f "ContainerDirection"
42+
-f "DimensionType"
43+
-f "Display"
44+
-f "DisplayState"
45+
-f "EventAudioTrack"
46+
-f "EventControlMediaCommand"
47+
-f "EventDirection"
48+
-f "EventHighlightMode"
49+
-f "EventProperty"
50+
-f "EventReason"
51+
-f "EventScrollAlign"
52+
-f "EventType"
53+
-f "EventMediaType"
54+
-f "FilterType"
55+
-f "FilterProperty"
56+
-f "FlexboxAlign"
57+
-f "FlexboxJustifyContent"
58+
-f "FocusDirection"
59+
-f "FontStyle"
60+
-f "GradientProperty"
61+
-f "GradientSpreadMethod"
62+
-f "GradientType"
63+
-f "GradientUnits"
64+
-f "GraphicTextAnchor"
65+
-f "GraphicElementType"
66+
-f "GraphicLayoutDirection"
67+
-f "GraphicLineCap"
68+
-f "GraphicLineJoin"
69+
-f "GraphicPropertyKey"
70+
-f "GraphicFilterType"
71+
-f "GraphicFilterProperty"
72+
-f "GraphicScale"
73+
-f "GraphicScale"
74+
-f "ImageAlign"
75+
-f "ImageCount"
76+
-f "ImageScale"
77+
-f "KeyHandlerType"
78+
-f "LayoutDirection"
79+
-f "MediaPlayerEventType"
80+
-f "Navigation"
81+
-f "NoiseFilterKind"
82+
-f "Position"
83+
-f "PointerEventType"
84+
-f "PointerType"
85+
-f "PropertyKey"
86+
-f "RootProperty"
87+
-f "ScreenShape"
88+
-f "ScrollDirection"
89+
-f "SpanAttributeName"
90+
-f "SpanType"
91+
-f "Snap"
92+
-f "SpeechMarkType"
93+
-f "TextAlign"
94+
-f "TextAlignVertical"
95+
-f "TextTrackType"
96+
-f "TokenType"
97+
-f "TrackState"
98+
-f "UpdateType"
99+
-f "VectorGraphicAlign"
100+
-f "VectorGraphicScale"
101+
-f "VideoScale"
102+
-f "ViewportMode"
103+
-f "AudioTrack"
104+
-f "KeyboardType"
105+
-f "SubmitKeyType"
106+
-f "ScreenMode"
107+
-f "Role"
108+
-f "ExtensionComponentResourceState"
109+
-l java -p com.amazon.apl.enums -o ${CMAKE_CURRENT_SOURCE_DIR}/src/main/java/com/amazon/apl/enums
110+
${APL_PROJECT_DIR}/aplcore/include/apl/action/*.h
111+
${APL_PROJECT_DIR}/aplcore/include/apl/animation/*.h
112+
${APL_PROJECT_DIR}/aplcore/include/apl/audio/*.h
113+
${APL_PROJECT_DIR}/aplcore/include/apl/command/*.h
114+
${APL_PROJECT_DIR}/aplcore/include/apl/component/*.h
115+
${APL_PROJECT_DIR}/aplcore/include/apl/content/*.h
116+
${APL_PROJECT_DIR}/aplcore/include/apl/datagrammar/*.h
117+
${APL_PROJECT_DIR}/aplcore/include/apl/document/*.h
118+
${APL_PROJECT_DIR}/aplcore/include/apl/engine/*.h
119+
${APL_PROJECT_DIR}/aplcore/include/apl/graphic/*.h
120+
${APL_PROJECT_DIR}/aplcore/include/apl/media/*.h
121+
${APL_PROJECT_DIR}/aplcore/include/apl/primitives/*.h
122+
${APL_PROJECT_DIR}/aplcore/include/apl/time/*.h
123+
${APL_PROJECT_DIR}/aplcore/include/apl/utils/*.h
124+
${APL_PROJECT_DIR}/aplcore/include/apl/touch/*.h
125+
${APL_PROJECT_DIR}/aplcore/include/apl/focus/*.h
126+
DEPENDS enumgen
127+
)
128+
129+
get_target_property(RAPIDJSON_INCLUDE rapidjson-apl INTERFACE_INCLUDE_DIRECTORIES)
130+
add_custom_target(rapidjson ALL
131+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${RAPIDJSON_INCLUDE} ${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/rapidjson/include
132+
)
133+
134+
get_target_property(APL_INCLUDE apl INTERFACE_INCLUDE_DIRECTORIES)
135+
get_target_property(ALEXAEXT_INCLUDE alexaext INTERFACE_INCLUDE_DIRECTORIES)
136+
137+
add_custom_target(copy-headers
138+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${APL_INCLUDE} ${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/apl/include
139+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${ALEXAEXT_INCLUDE} ${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/alexaext/include
140+
DEPENDS apl alexaext
141+
)
142+
143+
if (ENABLE_SCENEGRAPH)
144+
add_custom_target(copy-config
145+
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/apl/include/apl/apl_config.h ${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/aplsgconfig/include/apl/apl_config.h
146+
DEPENDS copy-headers)
147+
else()
148+
add_custom_target(copy-config
149+
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/apl/include/apl/apl_config.h ${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/aplconfig/include/apl/apl_config.h
150+
DEPENDS copy-headers)
151+
endif()
152+
153+
if (NOT ANDROID)
154+
# Ensure jni.h is found
155+
find_package(JNI REQUIRED)
156+
include_directories(${JAVA_INCLUDE_PATH})
157+
include_directories(${JAVA_INCLUDE_PATH2})
158+
endif()

0 commit comments

Comments
 (0)