diff --git a/libraries/tools/kotlin-dokka-stdlib/README.md b/libraries/tools/kotlin-dokka-stdlib/README.md new file mode 100644 index 00000000000..a23f07482d6 --- /dev/null +++ b/libraries/tools/kotlin-dokka-stdlib/README.md @@ -0,0 +1,7 @@ +kotlin-dokka-stdlib +=================== + +Common scripts to build API documentation for kotlin stdlib, kotlin test (and others?) libraries for +kotlinlang.org web-site. + + diff --git a/libraries/tools/kotlin-dokka-stdlib/ant/build.gradle b/libraries/tools/kotlin-dokka-stdlib/ant/build.gradle new file mode 100644 index 00000000000..7ccadaa634b --- /dev/null +++ b/libraries/tools/kotlin-dokka-stdlib/ant/build.gradle @@ -0,0 +1,30 @@ +apply plugin: 'de.undercouch.download' +apply plugin: 'base' + +final String ext +if (System.getProperty('os.name', '').toLowerCase().contains('windows')) { + ext = ".bat" +} else { + ext = "" +} + + +final String antVersion = "1.10.9" +final String antURL = "https://cache-redirector.jetbrains.com/downloads.apache.org/ant/binaries/apache-ant-$antVersion-bin.zip" +final File antHome = new File(buildDir, "ant-home") +final File antZip = new File(buildDir, "apache-ant-$antVersion-bin.zip") +final File antExe = new File(antHome, "apache-ant-$antVersion/bin/ant$ext") + +task downloadAnt(type: Download) { + src antURL + dest antZip + overwrite false +} + +task extractAnt(type: Sync, dependsOn: downloadAnt) { + from zipTree(antZip) + into antHome +} + +project.extensions.ant_exe = antExe + diff --git a/libraries/tools/kotlin-dokka-stdlib/build-docs.xml b/libraries/tools/kotlin-dokka-stdlib/build-docs.xml new file mode 100644 index 00000000000..ef7cbb8bf24 --- /dev/null +++ b/libraries/tools/kotlin-dokka-stdlib/build-docs.xml @@ -0,0 +1,396 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/tools/kotlin-dokka-stdlib/build.gradle b/libraries/tools/kotlin-dokka-stdlib/build.gradle new file mode 100644 index 00000000000..2d0ccb9406e --- /dev/null +++ b/libraries/tools/kotlin-dokka-stdlib/build.gradle @@ -0,0 +1,80 @@ +plugins { + id "de.undercouch.download" version "4.1.1" + id 'com.github.jk1.tcdeps' version '1.2' + id "base" +} + +evaluationDependsOnChildren() + + +configurations { + dokka + kotlin_sources +} + +final String dokka_build = "611" +final String dokka_version = "0.10.2-SNAPSHOT" + +repositories { + mavenLocal() + maven { url = "https://teamcity.jetbrains.com/guestAuth/repository/download/Kotlin_Dokka_DokkaAntMavenGradle/$dokka_build/maven" } +} + +dependencies { + dokka "org.jetbrains.dokka:dokka-fatjar:$dokka_version" +} + +final File dokkaHome = new File(buildDir, "dokka-home") +task setupDokka(type: Sync) { + from configurations.dokka + into dokkaHome +} + +def pAnt() { return project('ant').extensions } +def pKotlinBig() { return project('kotlin_big').extensions } +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('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]) { + workingDir = projectDir + // -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 + environment("ANT_OPTS", "-Xmx3G") + environment("JAVA_HOME", System.getProperty("java.home")) + doFirst { + def logFile = file("$buildDir/dokka.log") + standardOutput = new org.apache.tools.ant.util.TeeOutputStream(System.out, new FileOutputStream(logFile)) + } +} + +setupCallDokka.doLast { + + callDokka.commandLine = [ + pAnt().ant_exe.path, + "-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_windows=${pKotlinNative().kotlin_native_bin_windows}", + "-Dkotlin_native_mac=${pKotlinNative().kotlin_native_bin_mac}", + ] +} diff --git a/libraries/tools/kotlin-dokka-stdlib/gradle/wrapper/gradle-wrapper.jar b/libraries/tools/kotlin-dokka-stdlib/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000000..5c2d1cf016b Binary files /dev/null and b/libraries/tools/kotlin-dokka-stdlib/gradle/wrapper/gradle-wrapper.jar differ diff --git a/libraries/tools/kotlin-dokka-stdlib/gradle/wrapper/gradle-wrapper.properties b/libraries/tools/kotlin-dokka-stdlib/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000000..442d9132ea3 --- /dev/null +++ b/libraries/tools/kotlin-dokka-stdlib/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/libraries/tools/kotlin-dokka-stdlib/gradlew b/libraries/tools/kotlin-dokka-stdlib/gradlew new file mode 100755 index 00000000000..b0d6d0ab5de --- /dev/null +++ b/libraries/tools/kotlin-dokka-stdlib/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# 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. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/libraries/tools/kotlin-dokka-stdlib/gradlew.bat b/libraries/tools/kotlin-dokka-stdlib/gradlew.bat new file mode 100644 index 00000000000..9991c503266 --- /dev/null +++ b/libraries/tools/kotlin-dokka-stdlib/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/libraries/tools/kotlin-dokka-stdlib/kotlin_big/build.gradle b/libraries/tools/kotlin-dokka-stdlib/kotlin_big/build.gradle new file mode 100644 index 00000000000..2125d8b1272 --- /dev/null +++ b/libraries/tools/kotlin-dokka-stdlib/kotlin_big/build.gradle @@ -0,0 +1,118 @@ +apply plugin: 'de.undercouch.download' +apply plugin: 'base' + +configurations { + kotlin_src + kotlin_jvm +} + +//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" + +repositories { + if (findProperty("kotlinLocalVersionOverride") != null) mavenLocal() +// maven { url = "https://teamcity.jetbrains.com/guestAuth/repository/download/$kotlin_big_build_configuration/$kotlin_big_build/maven" } + mavenCentral() +} + +final List modules = [ + "kotlin-stdlib", + "kotlin-stdlib-common", + "kotlin-stdlib-jdk7", + "kotlin-stdlib-jdk8", + "kotlin-stdlib-js", + "kotlin-test", + "kotlin-test-js", + "kotlin-test-junit5", + "kotlin-test-junit", + "kotlin-test-testng", + "kotlin-test-common", +] + + +task extractSources() { } +task extractLibs() { } + + +final File kotlin_lib_sources = new File(buildDir, 'sources') +final File kotlin_lib_binaries = 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" + } + + final Task libsTask = tasks.create("extract_lib_$module", Sync) { + dependsOn lib_src + + from { lib_src } + into "$kotlin_lib_binaries/$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 diff --git a/libraries/tools/kotlin-dokka-stdlib/kotlin_native/build.gradle b/libraries/tools/kotlin-dokka-stdlib/kotlin_native/build.gradle new file mode 100644 index 00000000000..b0ba2969858 --- /dev/null +++ b/libraries/tools/kotlin-dokka-stdlib/kotlin_native/build.gradle @@ -0,0 +1,140 @@ +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 + kotlin_native_mac + kotlin_native_windows +} + +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") + kotlin_native_mac kotlinNativeDep("macos", "tar.gz") + kotlin_native_windows kotlinNativeDep("windows", "zip") +} + +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') +} + +task extractKotlinNativeBinariesMac(type: Sync) { + from { tarTree(resources.gzip(configurations.kotlin_native_mac.singleFile)) } + into new File(kotlin_native_dir, 'mac') +} + +task extractKotlinNativeBinariesWindows(type: Sync) { + from { zipTree(configurations.kotlin_native_windows.singleFile) } + into new File(kotlin_native_dir, 'windows') +} + + +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}" + +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 + println revisions + + if (revisions.size() != 1) { + throw new Error("Select the right VCS root from the list. Too many 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, extractKotlinNativeBinariesMac, extractKotlinNativeBinariesWindows]) {} + +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_bin_mac = new File(kotlin_native_dir, "mac/kotlin-native-mac-${kotlin_native_version}") +project.extensions.kotlin_native_bin_windows = new File(kotlin_native_dir, "windows/kotlin-native-windows-${kotlin_native_version}") diff --git a/libraries/tools/kotlin-dokka-stdlib/settings.gradle b/libraries/tools/kotlin-dokka-stdlib/settings.gradle new file mode 100644 index 00000000000..52092454c53 --- /dev/null +++ b/libraries/tools/kotlin-dokka-stdlib/settings.gradle @@ -0,0 +1,5 @@ +rootProject.name = 'kotlin-dokka-stdlib' + +include 'kotlin_native' +include 'kotlin_big' +include 'ant'