Use local sources dirs

This commit is contained in:
Abduqodiri Qurbonzoda
2021-06-22 08:19:23 +03:00
committed by Space
parent 72b1459353
commit e5b4fa83cb
4 changed files with 70 additions and 224 deletions
@@ -10,11 +10,14 @@
<property name="dokka.format" value="kotlin-website-html"/>
<property name="kotlin_root" location="IT_IS_SET_FROM_GRADLE1"/>
<property name="kotlin_sources" location="IT_IS_SET_FROM_GRADLE2"/>
<property name="kotlin_libs" location="IS_IS_SET_FROM_GRADLE3"/>
<property name="kotlin_libs" location="IS_IS_SET_FROM_GRADLE2"/>
<property name="kotlin_native_root" location="IT_IS_SET_FROM_GRADLE6"/>
<property name="kotlin_native_linux" location="IT_IS_SET_FROM_GRADLE7"/>
<property name="kotlin_builtins_dir" location="${kotlin_root}/core/builtins"/>
<property name="kotlin_stdlib_dir" location="${kotlin_root}/libraries/stdlib"/>
<property name="kotlin_test_dir" location="${kotlin_root}/libraries/kotlin.test"/>
<property name="kotlin_native_root" location="IT_IS_SET_FROM_GRADLE3"/>
<property name="kotlin_native_libs" location="IT_IS_SET_FROM_GRADLE4"/>
<property name="language.version" value="1.5"/>
@@ -39,7 +42,7 @@
</path>
<path id="stdlib-native.classpath">
<pathelement location="${kotlin_native_linux}/klib/common/stdlib"/>
<pathelement location="${kotlin_native_libs}/klib/common/stdlib"/>
</path>
<path id="kotlin-test-jvm.classpath">
@@ -72,12 +75,12 @@
<!--<pathelement location="${basedir}/lib/junit-4.11.jar"/>-->
</path>
<property name="stdlib-samples" location="${kotlin_root}/libraries/stdlib/samples/test"/>
<property name="stdlib-samples" location="${kotlin_stdlib_dir}/samples/test"/>
<!-- TODO: one file for all modules? -->
<property name="stdlib-include-md" location="${kotlin_root}/libraries/stdlib/src/Module.md"/>
<property name="stdlib-include-md" location="${kotlin_stdlib_dir}/src/Module.md"/>
<property name="kotlin-test-include-md" location="${kotlin_root}/libraries/kotlin.test/Module.md"/>
<property name="kotlin-test-include-md" location="${kotlin_test_dir}/Module.md"/>
<target name="v2">
<delete dir="${docs.output}/kotlin-stdlib" failonerror="false"/>
@@ -101,10 +104,12 @@
includeRootPackage="false"
sincekotlin="1.0">
<sourceroot path="${kotlin_root}/core/builtins/native"/>
<sourceroot path="${kotlin_root}/core/builtins/src"/>
<sourceroot path="${kotlin_builtins_dir}/native"/>
<sourceroot path="${kotlin_builtins_dir}/src"/>
<sourceroot path="${kotlin_sources}/kotlin-stdlib-common"/>
<sourceroot path="${kotlin_stdlib_dir}/common/src"/>
<sourceroot path="${kotlin_stdlib_dir}/src"/>
<sourceroot path="${kotlin_stdlib_dir}/unsigned/src"/>
<target value="Common"/>
<target value="JVM"/>
@@ -125,14 +130,12 @@
languageVersion="${language.version}"
includeRootPackage="false">
<sourceroot path="${kotlin_sources}/kotlin-stdlib"/>
<sourceroot path="${kotlin_builtins_dir}/native"/>
<sourceroot path="${kotlin_builtins_dir}/src"/>
<sourceroot path="${kotlin_stdlib_dir}/jvm/runtime"/>
<sourceroot path="${kotlin_stdlib_dir}/jvm/src"/>
<sourceroot path="${kotlin_root}/core/reflection.jvm/src"/>
<sourceroot path="${kotlin_root}/libraries/stdlib/jvm/runtime/kotlin/jvm/annotations"/>
<sourceroot path="${kotlin_root}/libraries/stdlib/jvm/runtime/kotlin/jvm/JvmClassMapping.kt"/>
<sourceroot path="${kotlin_root}/libraries/stdlib/jvm/runtime/kotlin/jvm/PurelyImplements.kt"/>
<sourceroot path="${kotlin_root}/libraries/stdlib/jvm/runtime/kotlin/TypeAliases.kt"/>
<sourceroot path="${kotlin_root}/libraries/stdlib/jvm/runtime/kotlin/text/TypeAliases.kt"/>
<packageoptions prefix="kotlin.reflect.jvm.internal" suppress="true"/>
<packageoptions prefix="kotlin.jvm.functions" suppress="true"/>
@@ -155,7 +158,7 @@
languageVersion="${language.version}"
includeRootPackage="false">
<sourceroot path="${kotlin_sources}/kotlin-stdlib-jdk7"/>
<sourceroot path="${kotlin_stdlib_dir}/jdk7/src"/>
<packageoptions prefix="kotlin.reflect.jvm.internal" suppress="true"/>
<packageoptions prefix="kotlin.jvm.internal" suppress="true"/>
@@ -179,7 +182,7 @@
languageVersion="${language.version}"
includeRootPackage="false">
<sourceroot path="${kotlin_sources}/kotlin-stdlib-jdk8"/>
<sourceroot path="${kotlin_stdlib_dir}/jdk8/src"/>
<packageoptions prefix="kotlin.reflect.jvm.internal" suppress="true"/>
<packageoptions prefix="kotlin.jvm.internal" suppress="true"/>
@@ -204,7 +207,27 @@
includeRootPackage="false"
sincekotlin="1.1">
<sourceroot path="${kotlin_sources}/kotlin-stdlib-js"/>
<sourceroot path="${kotlin_stdlib_dir}/js/src"/>
<sourceroot path="${kotlin_stdlib_dir}/js-v1/src"/>
<sourceroot path="${kotlin_builtins_dir}/native/kotlin/Comparable.kt"/>
<sourceroot path="${kotlin_builtins_dir}/native/kotlin/Enum.kt"/>
<sourceroot path="${kotlin_builtins_dir}/native/kotlin/Iterator.kt"/>
<sourceroot path="${kotlin_builtins_dir}/native/kotlin/Collections.kt"/>
<sourceroot path="${kotlin_builtins_dir}/native/kotlin/CharSequence.kt"/>
<sourceroot path="${kotlin_builtins_dir}/native/kotlin/Annotation.kt"/>
<sourceroot path="${kotlin_builtins_dir}/src/kotlin/annotation/Annotations.kt"/>
<sourceroot path="${kotlin_builtins_dir}/src/kotlin/Function.kt"/>
<sourceroot path="${kotlin_builtins_dir}/src/kotlin/Iterators.kt"/>
<sourceroot path="${kotlin_builtins_dir}/src/kotlin/Range.kt"/>
<sourceroot path="${kotlin_builtins_dir}/src/kotlin/Progressions.kt"/>
<sourceroot path="${kotlin_builtins_dir}/src/kotlin/ProgressionIterators.kt"/>
<sourceroot path="${kotlin_builtins_dir}/src/kotlin/Ranges.kt"/>
<sourceroot path="${kotlin_builtins_dir}/src/kotlin/internal/InternalAnnotations.kt"/>
<sourceroot path="${kotlin_builtins_dir}/src/kotlin/internal/progressionUtil.kt"/>
<sourceroot path="${kotlin_builtins_dir}/src/kotlin/Unit.kt"/>
<!--<sourcelink path=".." url="http://github.com/JetBrains/kotlin/blob/${github.revision}" linesuffix="#L"/>-->
@@ -276,8 +299,8 @@
languageVersion="${language.version}"
includeRootPackage="false"
sincekotlin="1.0">
<sourceroot path="${kotlin_root}/libraries/kotlin.test/common/src/main/kotlin"/>
<sourceroot path="${kotlin_root}/libraries/kotlin.test/annotations-common/src/main/kotlin"/>
<sourceroot path="${kotlin_test_dir}/common/src/main/kotlin"/>
<sourceroot path="${kotlin_test_dir}/annotations-common/src/main/kotlin"/>
<target value="Common" />
<target value="JVM"/>
@@ -294,7 +317,7 @@
classpathref="kotlin-test-jvm.classpath"
languageVersion="${language.version}"
includeRootPackage="false">
<sourceroot path="${kotlin_root}/libraries/kotlin.test/jvm/src/main/kotlin"/>
<sourceroot path="${kotlin_test_dir}/jvm/src/main/kotlin"/>
<target value="JVM" />
<packageoptions prefix="org.junit" skipdeprecated="true"/>
@@ -310,7 +333,7 @@
classpathref="kotlin-test-junit.classpath"
languageVersion="${language.version}"
includeRootPackage="false">
<sourceroot path="${kotlin_root}/libraries/kotlin.test/junit/src/main/kotlin"/>
<sourceroot path="${kotlin_test_dir}/junit/src/main/kotlin"/>
<!--<target value="JVM" />-->
<target value="JUnit"/>
@@ -327,7 +350,7 @@
classpathref="kotlin-test-junit5.classpath"
languageVersion="${language.version}"
includeRootPackage="false">
<sourceroot path="${kotlin_root}/libraries/kotlin.test/junit5/src/main/kotlin"/>
<sourceroot path="${kotlin_test_dir}/junit5/src/main/kotlin"/>
<!--<target value="JVM" />-->
<target value="JUnit5"/>
@@ -345,7 +368,7 @@
classpathref="kotlin-test-testng.classpath"
languageVersion="${language.version}"
includeRootPackage="false">
<sourceroot path="${kotlin_root}/libraries/kotlin.test/testng/src/main/kotlin"/>
<sourceroot path="${kotlin_test_dir}/testng/src/main/kotlin"/>
<!--<target value="JVM" />-->
<target value="TestNG"/>
@@ -363,7 +386,7 @@
languageVersion="${language.version}"
includeRootPackage="false"
sincekotlin="1.1">
<sourceroot path="${kotlin_root}/libraries/kotlin.test/js/src/main/kotlin"/>
<sourceroot path="${kotlin_test_dir}/js/src/main/kotlin"/>
<packageoptions prefix="org.junit" skipdeprecated="true"/>
<target value="JS" />
@@ -1,6 +1,5 @@
plugins {
id "de.undercouch.download" version "4.1.1"
id 'com.github.jk1.tcdeps' version '1.2'
id "base"
}
@@ -34,22 +33,11 @@ def pKotlinNative() { return project('kotlin_native').extensions }
task extractAll(dependsOn: [setupDokka])
extractAll.dependsOn project('kotlin_big').tasks.getByName('extractLibs')
extractAll.dependsOn project('kotlin_big').tasks.getByName('extractSources')
extractAll.dependsOn project('kotlin_big').tasks.getByName('extractKotlinSources')
extractAll.dependsOn project('kotlin_native').tasks.getByName('extractKotlinNative')
extractAll.dependsOn project('kotlin_native').tasks.getByName('extractLibs')
extractAll.dependsOn project('ant').tasks.getByName('extractAnt')
task cleanupSources(type: Delete) {
dependsOn extractAll
doFirst {
def base = file("${pKotlinNative().kotlin_native_root}/runtime/src/main/kotlin")
delete(files("$base/kotlin/Functions.kt", "$base/kotlin/coroutines/SuspendFunctions.kt",
"$base/kotlin/reflect/KFunctions.kt"))
}
}
task setupCallDokka() { }
task callDokka(type: Exec, dependsOn: [extractAll, setupCallDokka, cleanupSources]) {
task callDokka(type: Exec, dependsOn: [extractAll, setupCallDokka]) {
workingDir = projectDir
// -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005
environment("ANT_OPTS", "-Xmx3G")
@@ -67,9 +55,8 @@ setupCallDokka.doLast {
"-f", file("build-docs.xml").path,
"v2",
"-Dkotlin_root=${pKotlinBig().kotlin_root}",
"-Dkotlin_sources=${pKotlinBig().kotlin_sources}",
"-Dkotlin_libs=${pKotlinBig().kotlin_libs}",
"-Dkotlin_native_root=${pKotlinNative().kotlin_native_root}",
"-Dkotlin_native_linux=${pKotlinNative().kotlin_native_bin_linux}",
"-Dkotlin_native_libs=${pKotlinNative().kotlin_native_libs}",
]
}
@@ -1,13 +1,11 @@
apply plugin: 'de.undercouch.download'
apply plugin: 'base'
//final String kotlin_big_build_configuration = 'Kotlin_1360_Compiler'
final String kotlin_big_version = findProperty("kotlinLocalVersionOverride") ?: '1.5.0'
final String kotlin_big_build = "1.5.0-release-749"
// kotlin/libraries/tools/kotlin-dokka-stdlib -> kotlin
final File kotlinRootDir = rootProject.file( "../../../")
final String kotlinVersion = "1.5.255-SNAPSHOT"
repositories {
if (findProperty("kotlinLocalVersionOverride") != null) mavenLocal()
// maven { url = "https://teamcity.jetbrains.com/guestAuth/repository/download/$kotlin_big_build_configuration/$kotlin_big_build/maven" }
mavenLocal()
mavenCentral()
}
@@ -26,88 +24,33 @@ final List<String> modules = [
]
task extractSources() { }
task extractLibs() { }
final File kotlin_lib_sources = new File(buildDir, 'sources')
final File kotlin_lib_binaries = new File(buildDir, 'libs')
final File kotlinLibsDir = new File(buildDir, 'libs')
modules.forEach { module ->
final String src = "kotlin_src_$module"
final String lib = "kotlin_lib_$module"
final Configuration conf_src = configurations.create(src)
final Configuration lib_src = configurations.create(lib)
if (module == "kotlin-test-js") {
conf_src.attributes {attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, "kotlin-runtime")) }
lib_src.attributes {attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, "kotlin-runtime")) }
}
dependencies {
"$src"(group: 'org.jetbrains.kotlin', name: module, version: kotlin_big_version, classifier: 'sources') { transitive = false }
"$lib"(group: 'org.jetbrains.kotlin', name: module, version: kotlin_big_version)
}
final Task sourcesTask = tasks.create("extract_source_$module", Sync) {
dependsOn conf_src
from { conf_src.collect { zipTree(it) } }
into "$kotlin_lib_sources/$module"
"$lib"(group: 'org.jetbrains.kotlin', name: module, version: kotlinVersion)
}
final Task libsTask = tasks.create("extract_lib_$module", Sync) {
dependsOn lib_src
from { lib_src }
into "$kotlin_lib_binaries/$module"
into "$kotlinLibsDir/$module"
}
extractSources.dependsOn sourcesTask
extractLibs.dependsOn libsTask
}
final File kotlinSourcesZip = new File(buildDir, "kotlin-${kotlin_big_build}.zip")
final File kotlinTargetDir = new File(buildDir, "sources/kotlin")
final String kotlinUrl = "https://github.com/JetBrains/kotlin/archive/build-${kotlin_big_build}.zip"
task downloadKotlinSources(type: Download) {
src kotlinUrl
dest kotlinSourcesZip
overwrite false
}
task extractKotlinSources(type: Sync, dependsOn: downloadKotlinSources) {
String pathPrefix = ""
if (project.findProperty("kotlinLocalRoot") != null) {
from project.property("kotlinLocalRoot")
exclude "**/build"
exclude "**/node_modules"
} else {
from zipTree(kotlinSourcesZip)
pathPrefix = "*/"
eachFile { FileCopyDetails file ->
//assume all files in the folder
file.path = file.path.split("/", 2)[1]
}
}
include "${pathPrefix}libraries/stdlib/**"
include "${pathPrefix}libraries/kotlin.test/**"
include "${pathPrefix}core/builtins/**"
include "${pathPrefix}core/reflection.jvm/**"
exclude "${pathPrefix}core/builtins/src/kotlin/reflect/"
includeEmptyDirs = false
into kotlinTargetDir
}
project.extensions.kotlin_root = kotlinTargetDir
project.extensions.kotlin_sources = kotlin_lib_sources
project.extensions.kotlin_libs = kotlin_lib_binaries
project.extensions.kotlin_root = kotlinRootDir
project.extensions.kotlin_libs = kotlinLibsDir
@@ -1,124 +1,17 @@
apply plugin: 'de.undercouch.download'
apply plugin: 'base'
//TODO: there is no direct sync between tag and K/N version :(
ext.kotlin_native_build_configuration = 'Kotlin_KotlinNative_Master_KotlinNativeDist'
ext.kotlin_native_version = "1.5" // "${kotlin_native_sources_version}"
ext.kotlin_native_build = "1.5-release-61" // "${kotin_native_version}-release-4565"
ext.useBuildServer = false
final String buildServer = 'https://buildserver.labs.intellij.net'
if (useBuildServer) {
apply plugin: 'com.github.jk1.tcdeps'
repositories {
teamcityServer { url = buildServer }
}
} else {
ext.kotlin_native_sources_revision = "v1.5-release-61" // "v${ext.kotlin_native_version}"
repositories {
ivy {
url "https://download.jetbrains.com/kotlin/native/builds/releases/"
patternLayout {
// e.g. https://download.jetbrains.com/kotlin/native/builds/releases/1.2.1-eap-9664/macos/kotlin-native-macos-1.2.1-eap-9664.tar.gz
artifact "[revision]/[classifier]/[module]-[classifier]-[revision].[ext]"
metadataSources {
artifact()
}
}
}
}
}
configurations {
kotlin_native_linux
}
def kotlinNativeDep(String target, String ext) {
return useBuildServer
? tc(buildTypeId: kotlin_native_build_configuration, version: kotlin_native_build, artifactPath: "kotlin-native-$target-${kotlin_native_version}.$ext")
: [group: "org.jetbrains.kotlin", name: "kotlin-native", version: kotlin_native_version, classifier: target, ext: ext]
}
dependencies {
kotlin_native_linux kotlinNativeDep("linux", "tar.gz")
}
final File kotlin_native_dir = new File(buildDir, "kotlin_native")
task extractKotlinNativeBinariesLinux(type: Sync) {
from { tarTree(resources.gzip(configurations.kotlin_native_linux.singleFile)) }
into new File(kotlin_native_dir, 'linux')
}
// kotlin/libraries/tools/kotlin-dokka-stdlib -> kotlin/kotlin-native
final String kotlinNativeRootDir = rootProject.file( "../../../kotlin-native")
final File kotlinNativeLibsDir = new File(buildDir, "libs")
final File teamCityBuildInfo = new File(buildDir, "kotlin-native-build-${kotlin_native_build}.xml")
final String teamCityBuildsURL = "$buildServer/guestAuth/app/rest/builds/buildType:${kotlin_native_build_configuration},branch:default:any,number:${kotlin_native_build}"
task extractLibs(type: Sync) {
from file(new File(kotlinNativeRootDir, "dist/klib"))
into file(new File(kotlinNativeLibsDir, "klib"))
final File kotlinSourcesZip = new File(buildDir, "kotlin-${kotlin_native_build}.zip")
final File kotlinTargetDir = new File(buildDir, "kotlin-native-sources")
task getTeamCityBuildInfo(type: Download) {
final String url = teamCityBuildsURL
doFirst {
println url
}
src url
dest teamCityBuildInfo
overwrite false
}
task inferTeamCityRevisionInfo() {
dependsOn getTeamCityBuildInfo
doFirst {
def xml = new XmlParser(false, false).parse(teamCityBuildInfo)
def revisions = xml.revisions as List<Node>
println revisions
if (revisions.size() != 1) {
throw new Error("Select the right VCS root from the list. Too many <revisions> elements in : $xml")
}
def revisionsNode = revisions[0]
if (revisionsNode.attribute("count") != "1") {
throw new Error("Select the right VCS root from the list: $revisionsNode")
}
final String kotlin_native_sources_tag = revisionsNode.children()[0].attribute("version")
println "Detected sources version: $kotlin_native_sources_tag"
tasks.downloadKotlinNativeSources.src("https://github.com/JetBrains/kotlin-native/archive/${kotlin_native_sources_tag}.zip")
}
}
task downloadKotlinNativeSources(type: Download) {
if (useBuildServer) {
dependsOn inferTeamCityRevisionInfo
} else {
assert kotlin_native_sources_revision != null
src("https://github.com/JetBrains/kotlin-native/archive/${kotlin_native_sources_revision}.zip")
}
dest kotlinSourcesZip
overwrite false
}
task extractKotlinNativeSources(type: Sync, dependsOn: downloadKotlinNativeSources) {
enabled = findProperty("kotlinLocalRoot") == null
from zipTree(kotlinSourcesZip)
into kotlinTargetDir
includeEmptyDirs = false
eachFile { FileCopyDetails file ->
//assume all files in the folder
file.path = file.path.split("/", 2)[1]
}
}
task extractKotlinNative(dependsOn: [extractKotlinNativeSources, extractKotlinNativeBinariesLinux]) {}
project.extensions.kotlin_native_root = findProperty("kotlinLocalRoot") == null ? kotlinTargetDir : findProperty("kotlinLocalRoot") + "/kotlin-native"
project.extensions.kotlin_native_bin_linux = new File(kotlin_native_dir, "linux/kotlin-native-linux-${kotlin_native_version}")
project.extensions.kotlin_native_root = kotlinNativeRootDir
project.extensions.kotlin_native_libs = kotlinNativeLibsDir