1/*
2 * Copyright (C) 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/**
18 * This file was created using the `create_project.py` script located in the
19 * `<AndroidX root>/development/project-creator` directory.
20 *
21 * Please use that script when creating a new project, rather than copying an existing project and
22 * modifying its settings.
23 */
24
25import androidx.build.SoftwareType
26import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
27
28plugins {
29    id("AndroidXPlugin")
30    id("com.android.library")
31    id("org.jetbrains.kotlin.android")
32}
33
34dependencies {
35    api(libs.kotlinStdlib)
36    implementation(libs.kotlinCoroutinesAndroid)
37    implementation("androidx.annotation:annotation-experimental:1.4.1")
38    implementation("androidx.core:core:1.8.0")
39    androidTestImplementation(libs.testExtJunit)
40    androidTestImplementation(libs.testCore)
41    androidTestImplementation(libs.testRunner)
42    androidTestImplementation(libs.testRules)
43    androidTestImplementation("androidx.lifecycle:lifecycle-common:2.8.3")
44    androidTestImplementation("androidx.test:core:1.4.0@aar")
45}
46
47android {
48    compileSdk = 35
49    namespace = "androidx.graphics.core"
50
51    defaultConfig {
52        externalNativeBuild {
53            def versionScript = file("src/main/cpp/jni.lds").getAbsolutePath()
54
55            cmake {
56                cppFlags "-O3", "-flto", "-fPIC", "-fno-exceptions", "-fno-rtti",
57                        "-fomit-frame-pointer", "-fdata-sections", "-ffunction-sections", "-fvisibility=hidden"
58                arguments "-DCMAKE_VERBOSE_MAKEFILE=ON",
59                        "-DCMAKE_SHARED_LINKER_FLAGS=-Wl,--gc-sections " +
60                                "-Wl,--version-script=${versionScript} " +
61                                "-Wl,--undefined-version"
62            }
63        }
64        consumerProguardFiles("proguard-rules.pro")
65    }
66    externalNativeBuild {
67        cmake {
68            path file('src/main/cpp/CMakeLists.txt')
69            version = libs.versions.cmake.get()
70        }
71    }
72}
73
74androidx {
75    name = "Graphics Core"
76    type = SoftwareType.PUBLISHED_LIBRARY
77    mavenVersion = LibraryVersions.GRAPHICS_CORE
78    inceptionYear = "2021"
79    description = "Leverage graphics facilities across multiple Android platform releases"
80    legacyDisableKotlinStrictApiMode = true
81    samples(project(":graphics:graphics-core:graphics-core-samples"))
82}
83
84//TODO(b/407725443): Remove this block when CanvasBufferedRendererTests and CanvasFrontBufferedRendererTest pass on API Level 21
85tasks.withType(KotlinCompile).configureEach {
86    kotlinOptions {
87        freeCompilerArgs += [
88                "-Xlambdas=class"
89        ]
90    }
91}
92