Move kotlin-dokka-stdlib scripts to libraries/tools/

This commit is contained in:
Abduqodiri Qurbonzoda
2021-05-24 03:41:10 +03:00
committed by Space
parent b406689035
commit d5d5891476
11 changed files with 1069 additions and 0 deletions
@@ -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.
@@ -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
@@ -0,0 +1,396 @@
<project name="Kotlin standard library" default="v2" basedir=".">
<property name="base" location="${basedir}"/>
<property name="build" location="${base}/build"/>
<!-- Generates the standard library documentation using Dokka. -->
<property name="github.revision" value="master"/>
<property name="docs.output" location="${build}/doc"/>
<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_native_root" location="IT_IS_SET_FROM_GRADLE6"/>
<property name="kotlin_native_linux" location="IT_IS_SET_FROM_GRADLE7"/>
<property name="kotlin_native_windows" location="IT_IS_SET_FROM_GRADLE8"/>
<property name="kotlin_native_mac" location="IT_IS_SET_FROM_GRADLE9"/>
<property name="language.version" value="1.5"/>
<typedef resource="dokka-antlib.xml">
<classpath>
<fileset dir="${base}/build/dokka-home" erroronmissingdir="true">
<include name="*.jar"/>
</fileset>
</classpath>
</typedef>
<path id="stdlib-common.classpath">
<fileset dir="${kotlin_libs}/kotlin-stdlib-common" includes="*.jar"/>
</path>
<path id="stdlib-jvm.classpath">
<fileset dir="${kotlin_libs}/kotlin-stdlib-jdk8" includes="*.jar"/>
</path>
<path id="stdlib-js.classpath">
<fileset dir="${kotlin_libs}/kotlin-stdlib-js" includes="*.jar"/>
</path>
<path id="stdlib-native.classpath">
<pathelement location="${kotlin_native_linux}/klib/common/stdlib"/>
</path>
<path id="kotlin-test-jvm.classpath">
<fileset dir="${kotlin_libs}/kotlin-test" includes="*.jar"/>
<!--<pathelement location="${basedir}/lib/junit-4.11.jar"/>-->
</path>
<path id="kotlin-test-js.classpath">
<fileset dir="${kotlin_libs}/kotlin-test-js" includes="*.jar"/>
<!--<pathelement location="${basedir}/lib/junit-4.11.jar"/>-->
</path>
<path id="kotlin-test-common.classpath">
<fileset dir="${kotlin_libs}/kotlin-test-common" includes="*.jar"/>
<!--<pathelement location="${basedir}/lib/junit-4.11.jar"/>-->
</path>
<path id="kotlin-test-junit.classpath">
<fileset dir="${kotlin_libs}/kotlin-test-junit" includes="*.jar"/>
<!--<pathelement location="${basedir}/lib/junit-4.11.jar"/>-->
</path>
<path id="kotlin-test-junit5.classpath">
<fileset dir="${kotlin_libs}/kotlin-test-junit5" includes="*.jar"/>
<!--<pathelement location="${basedir}/lib/junit-4.11.jar"/>-->
</path>
<path id="kotlin-test-testng.classpath">
<fileset dir="${kotlin_libs}/kotlin-test-testng" includes="*.jar"/>
<!--<pathelement location="${basedir}/lib/junit-4.11.jar"/>-->
</path>
<property name="stdlib-samples" location="${kotlin_root}/libraries/stdlib/samples/test"/>
<!-- TODO: one file for all modules? -->
<property name="stdlib-include-md" location="${kotlin_root}/libraries/stdlib/src/Module.md"/>
<property name="kotlin-test-include-md" location="${kotlin_root}/libraries/kotlin.test/Module.md"/>
<target name="v2">
<delete dir="${docs.output}/kotlin-stdlib" failonerror="false"/>
<dokka outputDir="${docs.output}"
format="${dokka.format}"
generateindexpages="true">
<passconfig
samples="${stdlib-samples}"
moduleName="kotlin-stdlib"
skipDeprecated="false"
jdkversion="8"
analysisplatform="common"
include="${stdlib-include-md}"
noStdlibLink="true"
nojdklink="true"
classpathref="stdlib-common.classpath"
languageVersion="${language.version}"
includeRootPackage="false"
sincekotlin="1.0">
<sourceroot path="${kotlin_root}/core/builtins/native"/>
<sourceroot path="${kotlin_root}/core/builtins/src"/>
<sourceroot path="${kotlin_sources}/kotlin-stdlib-common"/>
<target value="Common"/>
<target value="JVM"/>
<target value="JRE6"/>
<target value="JS"/>
<target value="Native"/>
</passconfig>
<passconfig samples="${stdlib-samples}"
moduleName="kotlin-stdlib"
skipDeprecated="false"
jdkversion="8"
analysisPlatform="jvm"
include="${stdlib-include-md}"
noStdlibLink="true"
classpathref="stdlib-jvm.classpath"
languageVersion="${language.version}"
includeRootPackage="false">
<sourceroot path="${kotlin_sources}/kotlin-stdlib"/>
<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"/>
<packageoptions prefix="kotlin.jvm.internal" suppress="true"/>
<packageoptions prefix="kotlin.coroutines.jvm.internal" suppress="true"/>
<packageoptions prefix="kotlin.coroutines.experimental.migration" suppress="true"/>
<target value="JVM"/>
<target value="JRE6"/>
</passconfig>
<passconfig samples="${stdlib-samples}"
moduleName="kotlin-stdlib"
skipDeprecated="false"
jdkversion="8"
analysisPlatform="jvm"
include="${stdlib-include-md}"
noStdlibLink="true"
classpathref="stdlib-jvm.classpath"
languageVersion="${language.version}"
includeRootPackage="false">
<sourceroot path="${kotlin_sources}/kotlin-stdlib-jdk7"/>
<packageoptions prefix="kotlin.reflect.jvm.internal" suppress="true"/>
<packageoptions prefix="kotlin.jvm.internal" suppress="true"/>
<packageoptions prefix="kotlin.coroutines.jvm.internal" suppress="true"/>
<packageoptions prefix="kotlin.coroutines.experimental.migration" suppress="true"/>
<target value="JVM"/>
<target value="JRE7"/>
</passconfig>
<passconfig samples="${stdlib-samples}"
moduleName="kotlin-stdlib"
skipDeprecated="false"
jdkversion="8"
analysisPlatform="jvm"
include="${stdlib-include-md}"
noStdlibLink="true"
classpathref="stdlib-jvm.classpath"
languageVersion="${language.version}"
includeRootPackage="false">
<sourceroot path="${kotlin_sources}/kotlin-stdlib-jdk8"/>
<packageoptions prefix="kotlin.reflect.jvm.internal" suppress="true"/>
<packageoptions prefix="kotlin.jvm.internal" suppress="true"/>
<packageoptions prefix="kotlin.coroutines.jvm.internal" suppress="true"/>
<packageoptions prefix="kotlin.coroutines.experimental.migration" suppress="true"/>
<target value="JVM"/>
<target value="JRE8"/>
</passconfig>
<!--include="${stdlib-include-md}"-->
<passconfig samples="${stdlib-samples}"
moduleName="kotlin-stdlib"
skipDeprecated="false"
jdkversion="8"
analysisPlatform="js"
include="${stdlib-include-md}"
noStdlibLink="true"
nojdklink="true"
classpathref="stdlib-js.classpath"
languageVersion="${language.version}"
includeRootPackage="false"
sincekotlin="1.1">
<sourceroot path="${kotlin_sources}/kotlin-stdlib-js"/>
<!--<sourcelink path=".." url="http://github.com/JetBrains/kotlin/blob/${github.revision}" linesuffix="#L"/>-->
<!-- TODO Docs? -->
<packageoptions prefix="org.w3c" reportUndocumented="false"/>
<packageoptions prefix="org.khronos" reportUndocumented="false"/>
<packageoptions prefix="jquery" suppress="true"/>
<packageoptions prefix="kotlin.reflect.jvm.internal" suppress="true"/>
<packageoptions prefix="kotlin.js.internal" suppress="true"/>
<target value="JS"/>
</passconfig>
<passconfig
samples="${stdlib-samples}"
moduleName="kotlin-stdlib"
skipDeprecated="false"
jdkversion="8"
analysisplatform="native"
noStdlibLink="true"
nojdklink="true"
classpathref="stdlib-native.classpath"
languageVersion="${language.version}"
includeRootPackage="false"
sincekotlin="1.3">
<!--
From https://github.com/JetBrains/kotlin-native/blob/6bc47171ca960b38d91332c5d84f6c4eeeeca06a/backend.native/build.gradle#L193
project(':Interop:Runtime').file('src/main/kotlin'),
project(':Interop:Runtime').file('src/native/kotlin'),
project(':Interop:JsRuntime').file('src/main/kotlin'),
project(':runtime').file('src/main/kotlin')
-->
<sourceroot path="${kotlin_native_root}/Interop/Runtime/src/main/kotlin"/>
<sourceroot path="${kotlin_native_root}/Interop/Runtime/src/native/kotlin"/>
<sourceroot path="${kotlin_native_root}/Interop/JsRuntime/src/main/kotlin"/>
<sourceroot path="${kotlin_native_root}/runtime/src/main/kotlin"/>
<packageoptions prefix="kotlin.native.internal" suppress="true"/>
<packageoptions prefix="kotlin.test" suppress="true"/>
<target value="Native" />
</passconfig>
<impliedplatform value="Common"/>
<impliedplatform value="Native"/>
<impliedplatform value="JVM"/>
<impliedplatform value="JS"/>
</dokka>
<echo message=" ##teamcity[publishArtifacts '${docs.output}/kotlin-stdlib => kotlin-stdlib.zip'] " />
<makeurl file="${docs.output}/kotlin-stdlib/package-list" property="stdlib.package.list"/>
<delete dir="${docs.output}/kotlin.test" failonerror="false"/>
<dokka outputDir="${docs.output}"
format="${dokka.format}"
generateindexpages="true">
<passconfig
include="${kotlin-test-include-md}"
moduleName="kotlin.test"
skipDeprecated="false"
jdkversion="8"
analysisplatform="common"
classpathref="kotlin-test-common.classpath"
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"/>
<target value="Common" />
<target value="JVM"/>
<target value="JS"/>
<target value="Native"/>
</passconfig>
<passconfig
include="${kotlin-test-include-md}"
moduleName="kotlin.test"
skipDeprecated="false"
jdkversion="8"
analysisplatform="jvm"
classpathref="kotlin-test-jvm.classpath"
languageVersion="${language.version}"
includeRootPackage="false">
<sourceroot path="${kotlin_root}/libraries/kotlin.test/jvm/src/main/kotlin"/>
<target value="JVM" />
<packageoptions prefix="org.junit" skipdeprecated="true"/>
</passconfig>
<passconfig
include="${kotlin-test-include-md}"
moduleName="kotlin.test"
skipDeprecated="false"
jdkversion="8"
analysisplatform="jvm"
classpathref="kotlin-test-junit.classpath"
languageVersion="${language.version}"
includeRootPackage="false">
<sourceroot path="${kotlin_root}/libraries/kotlin.test/junit/src/main/kotlin"/>
<!--<target value="JVM" />-->
<target value="JUnit"/>
<ExternalDocumentationLink url="https://kotlinlang.org/api/latest/jvm/stdlib/" packageListUrl="${stdlib.package.list}" />
<ExternalDocumentationLink url="http://junit.org/junit4/javadoc/latest/" />
</passconfig>
<passconfig
include="${kotlin-test-include-md}"
moduleName="kotlin.test"
skipDeprecated="false"
jdkversion="8"
analysisplatform="jvm"
classpathref="kotlin-test-junit5.classpath"
languageVersion="${language.version}"
includeRootPackage="false">
<sourceroot path="${kotlin_root}/libraries/kotlin.test/junit5/src/main/kotlin"/>
<!--<target value="JVM" />-->
<target value="JUnit5"/>
<ExternalDocumentationLink url="https://kotlinlang.org/api/latest/jvm/stdlib/" packageListUrl="${stdlib.package.list}" />
<ExternalDocumentationLink url="https://junit.org/junit5/docs/current/api/org.junit.jupiter.api/" packageListUrl="https://junit.org/junit5/docs/current/api/element-list" />
</passconfig>
<passconfig
include="${kotlin-test-include-md}"
moduleName="kotlin.test"
skipDeprecated="false"
jdkversion="8"
analysisplatform="jvm"
classpathref="kotlin-test-testng.classpath"
languageVersion="${language.version}"
includeRootPackage="false">
<sourceroot path="${kotlin_root}/libraries/kotlin.test/testng/src/main/kotlin"/>
<!--<target value="JVM" />-->
<target value="TestNG"/>
<ExternalDocumentationLink url="https://kotlinlang.org/api/latest/jvm/stdlib/" packageListUrl="${stdlib.package.list}" />
<ExternalDocumentationLink url="https://jitpack.io/com/github/cbeust/testng/master/javadoc/"/>
</passconfig>
<passconfig
include="${kotlin-test-include-md}"
moduleName="kotlin.test"
skipDeprecated="false"
jdkversion="8"
analysisplatform="js"
classpathref="kotlin-test-js.classpath"
languageVersion="${language.version}"
includeRootPackage="false"
sincekotlin="1.1">
<sourceroot path="${kotlin_root}/libraries/kotlin.test/js/src/main/kotlin"/>
<packageoptions prefix="org.junit" skipdeprecated="true"/>
<target value="JS" />
<ExternalDocumentationLink url="https://kotlinlang.org/api/latest/jvm/stdlib/" packageListUrl="${stdlib.package.list}" />
</passconfig>
<passconfig
include="${kotlin-test-include-md}"
moduleName="kotlin.test"
skipDeprecated="false"
jdkversion="8"
analysisplatform="js"
classpathref="kotlin-test-js.classpath"
languageVersion="${language.version}"
includeRootPackage="false"
sincekotlin="1.3">
<sourceroot path="${kotlin_native_root}/runtime/src/main/kotlin/kotlin/test"/>
<target value="Native" />
<ExternalDocumentationLink url="https://kotlinlang.org/api/latest/jvm/stdlib/" packageListUrl="${stdlib.package.list}" />
</passconfig>
</dokka>
<echo message=" ##teamcity[publishArtifacts '${docs.output}/kotlin.test => kotlin.test.zip'] " />
</target>
</project>
@@ -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}",
]
}
@@ -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
+188
View File
@@ -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" "$@"
+100
View File
@@ -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
@@ -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<String> 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
@@ -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<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, 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}")
@@ -0,0 +1,5 @@
rootProject.name = 'kotlin-dokka-stdlib'
include 'kotlin_native'
include 'kotlin_big'
include 'ant'