Files
kotlin-fork/libraries/stdlib/common/build.gradle
T
Alexander Udalov 7fe9b99087 Support different target platforms for modules in AnalyzerFacade
Instead of reusing the same AnalyzerFacade that is used for resolution
of a module to resolve its dependencies, analyze each dependency
module/library with a facade depending on its target platform. Introduce
and use CommonLibraryDetectionUtil in addition to
KotlinJavaScriptLibraryDetectionUtil, to detect common libraries (with
.kotlin_metadata files).

Note that before multi-platform projects, this was not needed because
there were only two platforms (JVM and JS), and JVM module had only JVM
modules/libraries as dependencies, JS module had only JS
modules/libraries as dependencies. Now, for example, a JVM module can
have a common module/library as a dependency, and it would be incorrect
to analyze that dependency with JvmAnalyzerFacade because that facade
does not know anything about .kotlin_metadata files.

The changes in Dsl.kt and KotlinCacheServiceImpl.kt are needed because
PsiElement.getJavaDescriptorResolver, called from some IDE code, started
to fail on a common module, because the container for a common module
does not have the JavaDescriptorResolver
2017-04-14 00:44:00 +03:00

56 lines
1.1 KiB
Groovy

description = 'Kotlin Common Standard Library'
apply plugin: 'kotlin-platform-common'
configurePublishing(project)
ext.commonSrcDir = "${buildDir}/common-sources"
sourceSets {
main {
kotlin {
srcDir 'src'
srcDir commonSrcDir
}
}
}
createPreprocessorTask(project, "Main", "${projectDir}/../src/kotlin", commonSrcDir)
compileKotlinCommon.dependsOn preprocessSourcesMain
/*
// TODO: currently unsupported
compileKotlinCommon {
kotlinOptions {
freeCompilerArgs = [
"-module-name", "${project.name}".toString()
]
}
}
*/
jar {
manifestAttributes(manifest, project, 'Main')
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.kotlin
}
artifacts {
archives sourcesJar
archives javadocJar
}
// TODO: call the "dist" task instead, once we need to publish kotlin-stdlib-common.jar with the compiler distribution
task distCommon(type: Copy) {
from(jar)
into "$distDir/common"
rename "-${java.util.regex.Pattern.quote(version)}", ''
}
dist.dependsOn distCommon