[go: nahoru, domu]

blob: 4a58d2707ddac19bf79e54e7cec624726500ac3f [file] [log] [blame]
/*
* Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import androidx.build.AndroidXComposePlugin
import androidx.build.LibraryType
import androidx.build.RunApiTasks
import androidx.compose.material.icons.generator.tasks.IconGenerationTask
import androidx.compose.material.icons.generator.tasks.ExtendedIconGenerationTask
plugins {
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXComposePlugin")
}
AndroidXComposePlugin.applyAndConfigureKotlinPlugin(project)
IconGenerationTask.registerExtendedIconMainProject(
project,
android
)
apply from: "shared-dependencies.gradle"
dependencies {
if (!AndroidXComposePlugin.isMultiplatformEnabled(project)) {
/*
* When updating dependencies, make sure to make an analogous update in the
* corresponding block below
*/
androidTestImplementation(libs.testRules)
androidTestImplementation(libs.testRunner)
androidTestImplementation(libs.junit)
androidTestImplementation(libs.kotlinReflect)
androidTestImplementation(libs.truth)
androidTestImplementation(project(":compose:foundation:foundation"))
androidTestImplementation(project(":compose:foundation:foundation-layout"))
androidTestImplementation(project(":compose:ui:ui"))
androidTestImplementation(project(":test:screenshot:screenshot"))
androidTestImplementation(project(":compose:ui:ui-test-junit4"))
androidTestImplementation(project(":compose:test-utils"))
androidTestImplementation("androidx.activity:activity-compose:1.3.1")
androidTestImplementation("androidx.appcompat:appcompat:1.3.0")
}
}
if (AndroidXComposePlugin.isMultiplatformEnabled(project)) {
kotlin {
/*
* When updating dependencies, make sure to make an analogous update in the
* corresponding block above
*/
sourceSets {
androidAndroidTest.dependencies {
implementation(project(":compose:foundation:foundation"))
implementation(project(":compose:foundation:foundation-layout"))
implementation(project(":compose:ui:ui"))
implementation(project(":test:screenshot:screenshot"))
implementation(project(":compose:ui:ui-test-junit4"))
implementation(project(":compose:test-utils"))
implementation("androidx.activity:activity-compose:1.3.1")
implementation("androidx.appcompat:appcompat:1.3.0")
implementation(libs.testRules)
implementation(libs.testRunner)
implementation(libs.junit)
implementation(libs.kotlinReflect)
implementation(libs.truth)
}
}
}
}
def allThemes = ["filled", "outlined", "rounded", "sharp", "twotone"]
configurations {
embedThemesDebug {
attributes {
attribute(iconExportAttr, "true")
attribute(iconBuildTypeAttr, "debug")
}
}
embedThemesRelease {
attributes {
attribute(iconExportAttr, "true")
attribute(iconBuildTypeAttr, "release")
}
}
}
if (!AndroidXComposePlugin.isMultiplatformEnabled(project)) {
for (themeName in allThemes) {
def otherProject = project(":compose:material:material-icons-extended-" + themeName)
project.dependencies.add("embedThemesDebug", otherProject)
project.dependencies.add("embedThemesRelease", otherProject)
}
// Compiling all of the icons in this project takes a while,
// so when possible, we compile each theme in its own project and merge them here.
// Hopefully we can revert this when parallel compilation is supported:
// https://youtrack.jetbrains.com/issue/KT-46085
android {
libraryVariants.all { v ->
if (v.name.toLowerCase().contains("debug")) {
v.registerPostJavacGeneratedBytecode(configurations.embedThemesDebug)
} else {
v.registerPostJavacGeneratedBytecode(configurations.embedThemesRelease)
}
// Manually set up source jar generation
ExtendedIconGenerationTask.registerSourceJarOnly(project, v)
}
}
} else {
// We're not sure how to compile these icons in parallel when multiplatform is enabled
IconGenerationTask.registerExtendedIconThemeProject(
project,
android,
AndroidXComposePlugin.isMultiplatformEnabled(project)
)
}
androidx {
name = "Compose Material Icons Extended"
type = LibraryType.PUBLISHED_LIBRARY
// This module has a large number (5000+) of generated source files and so doc generation /
// API tracking will simply take too long
runApiTasks = new RunApiTasks.No("Five thousand generated source files")
inceptionYear = "2020"
description = "Compose Material Design extended icons. This module contains all Material icons. It is a very large dependency and should not be included directly."
}
android {
namespace "androidx.compose.material.icons.extended"
}