-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
209 changed files
with
15,540 additions
and
1,677 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.gradle | ||
**/*.iml | ||
apl/.externalNativeBuild/ | ||
local.properties | ||
captures/ | ||
build/ | ||
.git | ||
build | ||
.idea/ | ||
.vscode | ||
.DS_Store | ||
**/.cxx/ | ||
jacoco.exec | ||
# Project-specific cache directory generated by Gradle | ||
/.gradle/ | ||
# Generated by run-gradlew | ||
gradle/wrapper/gradle-wrapper.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
|
||
def version = "2024.2.0"; | ||
|
||
buildscript { | ||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:8.0.2' | ||
classpath 'org.jacoco:org.jacoco.core:0.8.8' | ||
|
||
// NOTE: Do not place your application dependencies here; they belong | ||
// in the individual module build.gradle files | ||
} | ||
} | ||
|
||
subprojects { | ||
apply plugin: 'maven-publish' | ||
|
||
if (System.getenv("VERSION")) { | ||
project.version = System.getenv("VERSION") | ||
} else if (System.getenv("BUILD_ID")) { | ||
project.version = "${version}." + System.getenv("BUILD_ID") | ||
} else { | ||
project.version = "${version}." + System.currentTimeMillis() | ||
} | ||
project.group = "com.amazon.apl.android" | ||
|
||
repositories { | ||
google() | ||
jcenter() | ||
} | ||
} | ||
|
||
task clean(type: Delete) { | ||
delete rootProject.buildDir | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
plugins { | ||
id 'java' | ||
} | ||
|
||
dependencies { | ||
implementation gradleApi() | ||
} |
95 changes: 95 additions & 0 deletions
95
android/buildSrc/src/main/java/com/amazon/apl/android/CMakeTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package com.amazon.apl.android; | ||
|
||
import org.gradle.api.Action; | ||
import org.gradle.api.DefaultTask; | ||
import org.gradle.api.Task; | ||
import org.gradle.api.file.RegularFile; | ||
import org.gradle.api.plugins.JavaPluginExtension; | ||
import org.gradle.api.provider.Property; | ||
import org.gradle.api.provider.Provider; | ||
import org.gradle.api.tasks.TaskAction; | ||
import org.gradle.api.tasks.OutputDirectory; | ||
import org.gradle.api.file.RegularFileProperty; | ||
import org.gradle.api.tasks.compile.JavaCompile; | ||
import org.gradle.jvm.toolchain.JavaCompiler; | ||
import org.gradle.jvm.toolchain.JavaLanguageVersion; | ||
import org.gradle.jvm.toolchain.JavaLauncher; | ||
import org.gradle.jvm.toolchain.JavaToolchainService; | ||
import org.gradle.jvm.toolchain.JavaToolchainSpec; | ||
import org.gradle.jvm.toolchain.JvmImplementation; | ||
import org.gradle.jvm.toolchain.JvmVendorSpec; | ||
import org.gradle.process.ExecOperations; | ||
|
||
import java.io.File; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import javax.inject.Inject; | ||
|
||
class CMakeTask extends DefaultTask { | ||
private final ExecOperations execOperations; | ||
private List<String> cmakeArgs = new ArrayList<>(); | ||
private List<String> makeTargets = new ArrayList<>(); | ||
|
||
private RegularFile buildDirectory; | ||
|
||
@OutputDirectory | ||
public RegularFileProperty getBuildFolder() { | ||
return getProject().getObjects().fileProperty() | ||
.convention(buildDirectory); | ||
} | ||
|
||
@Inject | ||
public CMakeTask(ExecOperations execOperations) { | ||
this.execOperations = execOperations; | ||
cmakeArgs.add("../../../../"); | ||
|
||
buildDirectory = getProject().getLayout().getProjectDirectory().file(".cxx/cmake/debug/host/"); | ||
} | ||
|
||
public void cmakeArgs(String... args) { | ||
cmakeArgs.addAll(List.of(args)); | ||
} | ||
|
||
public void makeTargets(String... targets) { | ||
makeTargets.addAll(List.of(targets)); | ||
} | ||
|
||
@TaskAction | ||
public void run() { | ||
String hostDir = buildDirectory.getAsFile().getAbsolutePath(); | ||
|
||
File folder = new File(hostDir); | ||
if (!folder.exists()) { | ||
folder.mkdirs(); | ||
} | ||
|
||
// Find a java 17 jdk. The embedded one in Android Studio doesn't include JNI. | ||
JavaToolchainService service = getProject().getExtensions().getByType(JavaToolchainService.class); | ||
Provider<JavaCompiler> compiler = service.compilerFor(javaToolchainSpec -> javaToolchainSpec.getLanguageVersion().set(JavaLanguageVersion.of(17))); | ||
|
||
if (!compiler.isPresent()) { | ||
throw new RuntimeException("Unable to find a suitable jdk on the system."); | ||
} | ||
|
||
String jdkPath = compiler.get().getMetadata().getInstallationPath().getAsFile().getAbsolutePath(); | ||
|
||
getProject().getLogger().error(jdkPath); | ||
|
||
execOperations.exec(execSpec -> { | ||
execSpec.workingDir(hostDir); | ||
execSpec.commandLine("cmake"); | ||
execSpec.args(cmakeArgs); | ||
execSpec.environment("JAVA_HOME", jdkPath); | ||
}); | ||
|
||
execOperations.exec(execSpec -> { | ||
execSpec.workingDir(hostDir); | ||
execSpec.commandLine("make"); | ||
execSpec.args(makeTargets); | ||
execSpec.environment("JAVA_HOME", jdkPath); | ||
}); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/build | ||
/.cxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
# For more information about using CMake with Android Studio, read the | ||
# documentation: https://d.android.com/studio/projects/add-native-code.html | ||
|
||
# Sets the minimum version of CMake required to build the native library. | ||
include(FetchContent OPTIONAL RESULT_VARIABLE HAS_FETCH_CONTENT) | ||
|
||
cmake_minimum_required(VERSION 3.18.1) | ||
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
project (apl-android-native VERSION 1.0.0 LANGUAGES C CXX) | ||
|
||
set(APL_PROJECT_DIR ${APL_PROJECT_DIR}) | ||
|
||
if (DEFINED SCENE_GRAPH) | ||
set(ENABLE_SCENEGRAPH ${SCENE_GRAPH}) | ||
endif() | ||
|
||
# Tell core to compile alexa extensions. | ||
set(ENABLE_ALEXAEXTENSIONS ON) | ||
set(BUILD_ALEXAEXTENSIONS ON) | ||
set(USE_PROVIDED_YOGA_INLINE ON) | ||
set(ENABLE_PIC ON) | ||
|
||
FetchContent_Declare( | ||
aplcore | ||
SOURCE_DIR ${APL_PROJECT_DIR} | ||
) | ||
FetchContent_MakeAvailable(aplcore) | ||
|
||
set(RAPIDJSON_INCLUDE "${CMAKE_BINARY_DIR}/_deps/rapidjson-src/include") | ||
set(ENUMGEN_BIN "${CMAKE_BINARY_DIR}/tools/enumgen") | ||
|
||
add_custom_target(generate-android-enums ALL | ||
COMMAND cd ${APL_PROJECT_DIR} && ${ENUMGEN_BIN} | ||
-f "AnimationQuality" | ||
-f "AudioPlayerEventType" | ||
-f "BlendMode" | ||
-f "ComponentType" | ||
-f "ContainerDirection" | ||
-f "DimensionType" | ||
-f "Display" | ||
-f "DisplayState" | ||
-f "EventAudioTrack" | ||
-f "EventControlMediaCommand" | ||
-f "EventDirection" | ||
-f "EventHighlightMode" | ||
-f "EventProperty" | ||
-f "EventReason" | ||
-f "EventScrollAlign" | ||
-f "EventType" | ||
-f "EventMediaType" | ||
-f "FilterType" | ||
-f "FilterProperty" | ||
-f "FlexboxAlign" | ||
-f "FlexboxJustifyContent" | ||
-f "FocusDirection" | ||
-f "FontStyle" | ||
-f "GradientProperty" | ||
-f "GradientSpreadMethod" | ||
-f "GradientType" | ||
-f "GradientUnits" | ||
-f "GraphicTextAnchor" | ||
-f "GraphicElementType" | ||
-f "GraphicLayoutDirection" | ||
-f "GraphicLineCap" | ||
-f "GraphicLineJoin" | ||
-f "GraphicPropertyKey" | ||
-f "GraphicFilterType" | ||
-f "GraphicFilterProperty" | ||
-f "GraphicScale" | ||
-f "GraphicScale" | ||
-f "ImageAlign" | ||
-f "ImageCount" | ||
-f "ImageScale" | ||
-f "KeyHandlerType" | ||
-f "LayoutDirection" | ||
-f "MediaPlayerEventType" | ||
-f "Navigation" | ||
-f "NoiseFilterKind" | ||
-f "Position" | ||
-f "PointerEventType" | ||
-f "PointerType" | ||
-f "PropertyKey" | ||
-f "RootProperty" | ||
-f "ScreenShape" | ||
-f "ScrollDirection" | ||
-f "SpanAttributeName" | ||
-f "SpanType" | ||
-f "Snap" | ||
-f "SpeechMarkType" | ||
-f "TextAlign" | ||
-f "TextAlignVertical" | ||
-f "TextTrackType" | ||
-f "TokenType" | ||
-f "TrackState" | ||
-f "UpdateType" | ||
-f "VectorGraphicAlign" | ||
-f "VectorGraphicScale" | ||
-f "VideoScale" | ||
-f "ViewportMode" | ||
-f "AudioTrack" | ||
-f "KeyboardType" | ||
-f "SubmitKeyType" | ||
-f "ScreenMode" | ||
-f "Role" | ||
-f "ExtensionComponentResourceState" | ||
-l java -p com.amazon.apl.enums -o ${CMAKE_CURRENT_SOURCE_DIR}/src/main/java/com/amazon/apl/enums | ||
${APL_PROJECT_DIR}/aplcore/include/apl/action/*.h | ||
${APL_PROJECT_DIR}/aplcore/include/apl/animation/*.h | ||
${APL_PROJECT_DIR}/aplcore/include/apl/audio/*.h | ||
${APL_PROJECT_DIR}/aplcore/include/apl/command/*.h | ||
${APL_PROJECT_DIR}/aplcore/include/apl/component/*.h | ||
${APL_PROJECT_DIR}/aplcore/include/apl/content/*.h | ||
${APL_PROJECT_DIR}/aplcore/include/apl/datagrammar/*.h | ||
${APL_PROJECT_DIR}/aplcore/include/apl/document/*.h | ||
${APL_PROJECT_DIR}/aplcore/include/apl/engine/*.h | ||
${APL_PROJECT_DIR}/aplcore/include/apl/graphic/*.h | ||
${APL_PROJECT_DIR}/aplcore/include/apl/media/*.h | ||
${APL_PROJECT_DIR}/aplcore/include/apl/primitives/*.h | ||
${APL_PROJECT_DIR}/aplcore/include/apl/time/*.h | ||
${APL_PROJECT_DIR}/aplcore/include/apl/utils/*.h | ||
${APL_PROJECT_DIR}/aplcore/include/apl/touch/*.h | ||
${APL_PROJECT_DIR}/aplcore/include/apl/focus/*.h | ||
DEPENDS enumgen | ||
) | ||
|
||
get_target_property(RAPIDJSON_INCLUDE rapidjson-apl INTERFACE_INCLUDE_DIRECTORIES) | ||
add_custom_target(rapidjson ALL | ||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${RAPIDJSON_INCLUDE} ${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/rapidjson/include | ||
) | ||
|
||
get_target_property(APL_INCLUDE apl INTERFACE_INCLUDE_DIRECTORIES) | ||
get_target_property(ALEXAEXT_INCLUDE alexaext INTERFACE_INCLUDE_DIRECTORIES) | ||
|
||
add_custom_target(copy-headers | ||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${APL_INCLUDE} ${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/apl/include | ||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${ALEXAEXT_INCLUDE} ${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/alexaext/include | ||
DEPENDS apl alexaext | ||
) | ||
|
||
if (ENABLE_SCENEGRAPH) | ||
add_custom_target(copy-config | ||
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 | ||
DEPENDS copy-headers) | ||
else() | ||
add_custom_target(copy-config | ||
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 | ||
DEPENDS copy-headers) | ||
endif() | ||
|
||
if (NOT ANDROID) | ||
# Ensure jni.h is found | ||
find_package(JNI REQUIRED) | ||
include_directories(${JAVA_INCLUDE_PATH}) | ||
include_directories(${JAVA_INCLUDE_PATH2}) | ||
endif() |
Oops, something went wrong.