blob: 819a5a8ec1fa2b5523d0b24aadab42271df08faa [file] [log] [blame]
/**
* This file was created using the `create_project.py` script located in the
* `<AndroidX root>/development/project-creator` directory.
*
* Please use that script when creating a new project, rather than copying an existing project and
* modifying its settings.
*/
import androidx.build.LibraryType
import androidx.build.PlatformIdentifier
import androidx.build.KotlinTarget
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile
plugins {
id("AndroidXPlugin")
}
androidXMultiplatform {
androidNative()
jvm()
mac()
linux()
ios()
defaultPlatform(PlatformIdentifier.JVM)
sourceSets {
commonMain {
dependencies {
api(libs.kotlinStdlib)
}
}
nonJvmMain {
dependsOn commonMain
}
targets.all { target ->
if (target.platformType !in [KotlinPlatformType.jvm, KotlinPlatformType.common]) {
target.compilations["main"].defaultSourceSet {
dependsOn(nonJvmMain)
}
}
}
// Workaround for https://youtrack.jetbrains.com/issue/KT-51763
// Make sure commonization runs before any compilation task.
tasks.withType(KotlinNativeCompile).configureEach {
it.dependsOn(tasks.named("commonize"))
}
}
}
jvmJar {
// Strip out typedef classes. For Android libraries, this is done
// automatically by the Gradle plugin, but the Annotation library is a
// plain jar, built by the regular Gradle java plugin. The typedefs
// themselves have been manually extracted into the
// external-annotations directory, and those are packaged separately
// below by the annotationsZip task.
exclude("androidx/annotation/ProductionVisibility.class")
exclude("androidx/annotation/DimensionUnit.class")
}
task annotationsZip(type: Zip) {
archiveClassifier.set("annotations")
from("external-annotations")
}
// add annotations jar task as artifacts
artifacts {
archives jvmJar
archives annotationsZip
}
androidx {
name = "Annotation"
type = LibraryType.PUBLISHED_LIBRARY
mavenVersion = LibraryVersions.ANNOTATION
kotlinTarget = KotlinTarget.KOTLIN_1_7
inceptionYear = "2013"
description = "Provides source annotations for tooling and readability."
}