Открыть боковую панель
Aurora OS
Kotlin Multiplatform
Libraries
ktor
Коммиты
4b4b73a6
Не подтверждена
Коммит
4b4b73a6
создал
Окт 05, 2021
по автору
Leonid Stashevsky
Зафиксировано автором
GitHub
Окт 05, 2021
Просмотр файлов
Disable HMPP (#2611)
* Disable HMPP
владелец
0081f943
Изменения
154
Скрыть пробелы
Построчно
Рядом
build.gradle.kts
Просмотр файла @
4b4b73a6
...
...
@@ -38,7 +38,6 @@ buildscript {
}
}
// These three flags are enabled in train builds for JVM IR compiler testing
extra
[
"jvm_ir_enabled"
]
=
rootProject
.
properties
[
"enable_jvm_ir"
]
!=
null
extra
[
"jvm_ir_api_check_enabled"
]
=
rootProject
.
properties
[
"enable_jvm_ir_api_check"
]
!=
null
// This flag is also used in settings.gradle to exclude native-only projects
extra
[
"native_targets_enabled"
]
=
rootProject
.
properties
[
"disable_native_targets"
]
==
null
...
...
@@ -54,7 +53,6 @@ buildscript {
val
atomicfu_version
:
String
by
extra
val
validator_version
:
String
by
extra
val
android_gradle_version
:
String
by
extra
val
ktlint_version
:
String
by
extra
dependencies
{
classpath
(
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
)
...
...
@@ -62,7 +60,6 @@ buildscript {
classpath
(
"org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
)
classpath
(
"org.jetbrains.kotlinx:binary-compatibility-validator:$validator_version"
)
classpath
(
"com.android.tools.build:gradle:$android_gradle_version"
)
classpath
(
"org.jmailen.gradle:kotlinter-gradle:$ktlint_version"
)
}
CacheRedirector
.
configureBuildScript
(
rootProject
,
this
)
...
...
@@ -79,36 +76,9 @@ val configuredVersion: String by extra
apply
(
from
=
"gradle/verifier.gradle"
)
/**
* `darwin` is subset of `posix`.
* Don't create `posix` and `darwin` sourceSets in single project.
*/
val
platforms
=
mutableListOf
(
"common"
,
"jvm"
,
"js"
)
if
(
native_targets_enabled
)
{
platforms
+=
listOf
(
"posix"
,
"darwin"
)
}
extra
[
"skipPublish"
]
=
mutableListOf
<
String
>()
extra
[
"nonDefaultProjectStructure"
]
=
mutableListOf
(
"ktor-bom"
)
fun
projectNeedsPlatform
(
project
:
Project
,
platform
:
String
):
Boolean
{
val
skipPublish
:
List
<
String
>
by
rootProject
.
extra
if
(
skipPublish
.
contains
(
project
.
name
))
return
platform
==
"jvm"
val
files
=
project
.
projectDir
.
listFiles
()
?:
emptyArray
()
val
hasPosix
=
files
.
any
{
it
.
name
==
"posix"
}
val
hasDarwin
=
files
.
any
{
it
.
name
==
"darwin"
}
if
(
hasPosix
&&
hasDarwin
)
return
false
if
(
hasPosix
&&
platform
==
"darwin"
)
return
false
if
(
hasDarwin
&&
platform
==
"posix"
)
return
false
if
(!
hasPosix
&&
!
hasDarwin
&&
platform
==
"darwin"
)
return
false
return
files
.
any
{
it
.
name
==
"common"
||
it
.
name
==
platform
}
}
val
disabledExplicitApiModeProjects
=
listOf
(
"ktor-client-tests"
,
"ktor-client-json-tests"
,
...
...
@@ -145,26 +115,12 @@ allprojects {
apply
(
plugin
=
"kotlin-multiplatform"
)
apply
(
plugin
=
"kotlinx-atomicfu"
)
apply
(
from
=
rootProject
.
file
(
"gradle/utility.gradle"
))
extra
[
"nativeTargets"
]
=
mutableListOf
<
String
>()
extra
[
"nativeCompilations"
]
=
mutableListOf
<
String
>()
platforms
.
forEach
{
platform
->
if
(
projectNeedsPlatform
(
this
,
platform
))
{
if
(
platform
==
"js"
)
{
configureJsModules
()
}
else
{
apply
(
from
=
rootProject
.
file
(
"gradle/$platform.gradle"
))
}
}
}
configureTargets
()
configurations
{
maybeCreate
(
"testOutput"
)
}
kotlin
{
targets
.
all
{
...
...
@@ -172,7 +128,6 @@ allprojects {
irTarget
?.
compilations
?.
all
{
configureCompilation
()
}
}
compilations
.
all
{
configureCompilation
()
...
...
@@ -201,12 +156,14 @@ allprojects {
val
skipPublish
:
List
<
String
>
by
rootProject
.
extra
if
(!
skipPublish
.
contains
(
project
.
name
))
{
apply
(
from
=
rootProject
.
file
(
"gradle/publish.gradle"
)
)
configurePublication
(
)
}
}
if
(
project
.
hasProperty
(
"enableCodeStyle"
))
{
apply
(
from
=
"gradle/codestyle.gradle"
)
subprojects
{
configureCodestyle
()
}
}
println
(
"Using Kotlin compiler version: ${org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION}"
)
...
...
@@ -231,6 +188,10 @@ subprojects {
val
docs
:
String
?
by
extra
if
(
docs
!=
null
)
{
tasks
.
withType
<
DokkaMultiModuleTask
>
{
pluginsMapConfiguration
.
set
(
mapOf
(
"org.jetbrains.dokka.versioning.VersioningPlugin"
to
"""{ "version": "$configuredVersion", "olderVersionsDir":"$docs" }"""
))
val
mapOf
=
mapOf
(
"org.jetbrains.dokka.versioning.VersioningPlugin"
to
"""{ "version": "$configuredVersion", "olderVersionsDir":"$docs" }"""
)
pluginsMapConfiguration
.
set
(
mapOf
)
}
}
buildSrc/build.gradle.kts
Просмотр файла @
4b4b73a6
...
...
@@ -44,4 +44,5 @@ dependencies {
println
(
"Used kotlin version in buildSrc: "
+
version
(
"kotlin"
))
implementation
(
kotlin
(
"gradle-plugin"
,
version
(
"kotlin"
)))
implementation
(
"com.moowork.gradle:gradle-node-plugin:1.3.1"
)
implementation
(
"org.jmailen.gradle:kotlinter-gradle:${version("
ktlint
")}"
)
}
buildSrc/src/main/kotlin/CacheRedirector.kt
Просмотр файла @
4b4b73a6
/*
* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
import
org.gradle.api.*
import
org.gradle.api.artifacts.dsl.*
...
...
@@ -8,7 +8,6 @@ import org.gradle.api.artifacts.repositories.*
import
org.gradle.api.initialization.dsl.*
import
java.net.*
private
val
cacheRedirectorAvaialble
:
Boolean
=
isCacheRedirectorAvailable
()
/**
...
...
buildSrc/src/main/kotlin/Codestyle.kt
0 → 100644
Просмотр файла @
4b4b73a6
/*
* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
import
org.gradle.api.*
import
org.gradle.kotlin.dsl.*
fun
Project
.
configureCodestyle
()
{
apply
(
plugin
=
"org.jmailen.kotlinter"
)
kotlinter
.
apply
{
ignoreFailures
=
true
reporters
=
arrayOf
(
"checkstyle"
,
"plain"
)
experimentalRules
=
true
disabledRules
=
arrayOf
(
"no-wildcard-imports"
,
"experimental:spacing-between-declarations-with-annotations"
,
"experimental:enum-entry-name-case"
)
}
}
buildSrc/src/main/kotlin/Compilations.kt
Просмотр файла @
4b4b73a6
...
...
@@ -7,9 +7,10 @@ import org.jetbrains.kotlin.gradle.plugin.*
fun
KotlinCompilation
<
KotlinCommonOptions
>.
configureCompilation
()
{
kotlinOptions
{
if
(
platformType
==
KotlinPlatformType
.
jvm
&&
!
KtorBuildProperties
.
ideaActive
)
{
if
(
platformType
==
KotlinPlatformType
.
jvm
&&
!
IDEA_ACTIVE
)
{
allWarningsAsErrors
=
true
}
freeCompilerArgs
+=
"-Xopt-in=kotlin.RequiresOptIn"
}
}
buildSrc/src/main/kotlin/IdeUtils.kt
0 → 100644
Просмотр файла @
4b4b73a6
/*
* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
import
org.jetbrains.kotlin.gradle.dsl.*
import
org.jetbrains.kotlin.gradle.plugin.mpp.*
import
org.jetbrains.kotlin.konan.target.*
fun
KotlinMultiplatformExtension
.
createIdeaTarget
(
name
:
String
):
KotlinNativeTarget
=
when
{
HostManager
.
hostIsLinux
->
linuxX64
(
name
)
HostManager
.
hostIsMac
->
macosX64
(
name
)
HostManager
.
hostIsMingw
->
mingwX64
(
name
)
else
->
error
(
"Unknown target"
)
}
buildSrc/src/main/kotlin/JsConfig
uration
.kt
→
buildSrc/src/main/kotlin/JsConfig.kt
Просмотр файла @
4b4b73a6
...
...
@@ -5,13 +5,7 @@ import org.gradle.api.*
import
org.gradle.kotlin.dsl.*
import
java.io.*
val
skipModules
=
listOf
(
"ktor-client-cio"
)
fun
Project
.
configureJsModules
()
{
if
(
skipModules
.
contains
(
project
.
name
))
return
fun
Project
.
configureJs
()
{
configureJsTasks
()
kotlin
{
...
...
buildSrc/src/main/kotlin/JvmConfig.kt
0 → 100644
Просмотр файла @
4b4b73a6
/*
* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
import
org.gradle.api.*
import
org.gradle.api.tasks.testing.*
import
org.gradle.jvm.tasks.*
import
org.gradle.kotlin.dsl.*
import
org.jetbrains.kotlin.gradle.targets.jvm.tasks.*
fun
Project
.
configureJvm
()
{
val
jdk
=
when
(
name
)
{
in
jdk11Modules
->
11
in
jdk8Modules
->
8
in
jdk7Modules
->
7
else
->
6
}
val
kotlin_version
:
String
by
extra
val
slf4j_version
:
String
by
extra
val
junit_version
:
String
by
extra
val
coroutines_version
:
String
by
extra
val
configuredVersion
:
String
by
rootProject
.
extra
kotlin
{
sourceSets
.
apply
{
val
jvmMain
by
getting
{
dependencies
{
api
(
"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
)
if
(
jdk
>
6
)
{
api
(
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
)
}
if
(
jdk
>
7
)
{
api
(
"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
)
api
(
"org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutines_version"
)
{
exclude
(
module
=
"kotlin-stdlib"
)
exclude
(
module
=
"kotlin-stdlib-jvm"
)
exclude
(
module
=
"kotlin-stdlib-jdk8"
)
exclude
(
module
=
"kotlin-stdlib-jdk7"
)
}
}
api
(
"org.slf4j:slf4j-api:$slf4j_version"
)
}
}
val
jvmTest
by
getting
{
dependencies
{
api
(
"org.jetbrains.kotlin:kotlin-test"
)
api
(
"org.jetbrains.kotlin:kotlin-test-junit"
)
api
(
"junit:junit:$junit_version"
)
implementation
(
"org.jetbrains.kotlinx:kotlinx-coroutines-debug:$coroutines_version"
)
}
}
}
}
tasks
.
register
<
Jar
>(
"jarTest"
)
{
dependsOn
(
tasks
.
getByName
(
"jvmTestClasses"
))
classifier
=
"test"
from
(
kotlin
.
targets
.
getByName
(
"jvm"
).
compilations
.
getByName
(
"test"
).
output
)
}
configurations
.
apply
{
val
testCompile
=
findByName
(
"testCompile"
)
?:
return
@apply
val
testOutput
by
creating
{
extendsFrom
(
testCompile
)
}
val
boot
by
creating
{
}
}
val
jvmTest
:
KotlinJvmTest
=
tasks
.
getByName
<
KotlinJvmTest
>(
"jvmTest"
)
{
ignoreFailures
=
true
maxHeapSize
=
"2g"
exclude
(
"**/*StressTest *"
)
}
tasks
.
create
<
Test
>(
"stressTest"
)
{
classpath
=
files
(
jvmTest
.
classpath
)
testClassesDirs
=
files
(
jvmTest
.
testClassesDirs
)
ignoreFailures
=
true
maxHeapSize
=
"2g"
setForkEvery
(
1
)
systemProperty
(
"enable.stress.tests"
,
"true"
)
include
(
"**/*StressTest*"
)
}
tasks
.
getByName
<
Jar
>(
"jvmJar"
).
apply
{
manifest
{
attributes
(
"Implementation-Title"
to
name
,
"Implementation-Version"
to
configuredVersion
)
}
}
}
buildSrc/src/main/kotlin/KotlinExtensions.kt
Просмотр файла @
4b4b73a6
...
...
@@ -5,12 +5,14 @@ import org.gradle.api.*
import
org.gradle.kotlin.dsl.*
import
org.jetbrains.kotlin.gradle.dsl.*
import
org.jetbrains.kotlin.gradle.plugin.*
import
org.jmailen.gradle.kotlinter.*
fun
Project
.
kotlin
(
block
:
KotlinMultiplatformExtension
.()
->
Unit
)
{
configure
(
block
)
}
val
Project
.
kotlin
:
KotlinMultiplatformExtension
get
()
=
the
()
val
Project
.
kotlinter
:
KotlinterExtension
get
()
=
the
()
val
NamedDomainObjectContainer
<
KotlinSourceSet
>.
jvmMain
:
NamedDomainObjectProvider
<
KotlinSourceSet
>
get
()
=
named
<
KotlinSourceSet
>(
"jvmMain"
)
...
...
buildSrc/src/main/kotlin/KtorBuildProperties.kt
Просмотр файла @
4b4b73a6
import
KtorBuildProperties.jdk8Modules
/*
* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
import
org.gradle.api.*
import
org.jetbrains.kotlin.gradle.plugin.mpp.*
/*
* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
...
...
@@ -13,8 +17,18 @@ private val versionComponents = java_version
.
filter
{
it
.
isNotBlank
()
}
.
map
{
Integer
.
parseInt
(
it
)
}
object
KtorBuildProperties
{
val
IDEA_ACTIVE
:
Boolean
=
System
.
getProperty
(
"idea.active"
)
==
"true"
val
OS_NAME
=
System
.
getProperty
(
"os.name"
).
toLowerCase
()
val
HOST_NAME
=
when
{
OS_NAME
.
startsWith
(
"linux"
)
->
"linux"
OS_NAME
.
startsWith
(
"windows"
)
->
"windows"
OS_NAME
.
startsWith
(
"mac"
)
->
"macos"
else
->
error
(
"Unknown os name `$OS_NAME`"
)
}
object
KtorBuildProperties
{
val
jettyAlpnBootVersion
:
String
?
=
when
(
java_version
)
{
"1.8.0_191"
,
"1.8.0_192"
,
...
...
@@ -32,7 +46,7 @@ object KtorBuildProperties {
}
@JvmStatic
val
ideaActive
:
Boolean
=
System
.
getProperty
(
"idea.active"
)
==
"true"
fun
posixTargets
(
project
:
Project
):
Set
<
KotlinNativeTarget
>
=
project
.
kotlin
.
posixTargets
()
@JvmStatic
val
currentJdk
=
if
(
versionComponents
[
0
]
==
1
)
versionComponents
[
1
]
else
versionComponents
[
0
]
...
...
@@ -58,12 +72,4 @@ object KtorBuildProperties {
val
jdk11Modules
=
listOf
(
"ktor-client-java"
)
@JvmStatic
fun
projectJdk
(
name
:
String
):
Int
=
when
(
name
)
{
in
jdk8Modules
->
8
in
jdk11Modules
->
11
in
jdk7Modules
->
7
else
->
6
}
}
buildSrc/src/main/kotlin/NativeUtils.kt
0 → 100644
Просмотр файла @
4b4b73a6
/*
* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
import
org.gradle.api.*
import
org.gradle.api.publish.maven.tasks.*
import
org.gradle.api.publish.tasks.*
import
org.gradle.kotlin.dsl.*
import
org.jetbrains.kotlin.gradle.dsl.*
import
org.jetbrains.kotlin.gradle.plugin.mpp.*
fun
KotlinMultiplatformExtension
.
posixTargets
():
Set
<
KotlinNativeTarget
>
=
nixTargets
()
+
mingwX64
()
fun
KotlinMultiplatformExtension
.
nixTargets
():
Set
<
KotlinNativeTarget
>
=
darwinTargets
()
+
linuxX64
()
fun
KotlinMultiplatformExtension
.
darwinTargets
():
Set
<
KotlinNativeTarget
>
=
setOf
(
iosX64
(),
iosArm64
(),
iosArm32
(),
watchosX86
(),
watchosX64
(),
watchosArm32
(),
watchosArm64
(),
tvosX64
(),
tvosArm64
(),
macosX64
()
)
fun
KotlinMultiplatformExtension
.
desktopTargets
():
Set
<
KotlinNativeTarget
>
=
setOf
(
macosX64
(),
linuxX64
(),
mingwX64
()
)
fun
Project
.
disableCompilation
(
target
:
KotlinNativeTarget
)
{
target
.
apply
{
compilations
.
forEach
{
it
.
cinterops
.
forEach
{
cInterop
->
tasks
.
getByName
(
cInterop
.
interopProcessingTaskName
).
enabled
=
false
}
}
binaries
.
forEach
{
it
.
linkTask
.
enabled
=
false
}
mavenPublication
{
tasks
.
withType
<
AbstractPublishToMaven
>().
all
{
onlyIf
{
publication
!=
this
@mavenPublication
}
}
tasks
.
withType
<
GenerateModuleMetadata
>().
all
{
onlyIf
{
publication
.
get
()
!=
this
@mavenPublication
}
}
}
}
}
buildSrc/src/main/kotlin/Publication.kt
0 → 100644
Просмотр файла @
4b4b73a6
/*
* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
import
org.gradle.api.*
import
org.gradle.api.publish.*
import
org.gradle.api.publish.maven.*
import
org.gradle.api.publish.maven.tasks.*
import
org.gradle.jvm.tasks.*
import
org.gradle.kotlin.dsl.*
import
org.gradle.plugins.signing.*
fun
Project
.
selectArtifactId
(
type
:
String
,
defaultName
:
String
):
String
{
val
isCommon
=
extra
.
has
(
"commonStructure"
)
val
commonIsRoot
=
extra
.
has
(
"commonStructure"
)
&&
extra
.
has
(
"commonStructure"
)
val
hasNative
=
extra
.
has
(
"hasNative"
)
&&
extra
.
has
(
"hasNative"
)
return
when
(
type
)
{
"metadata"
->
{
if
(!
isCommon
)
"$name-$type"
else
"$name-metadata"
}
"kotlinMultiplatform"
->
{
if
(!
hasNative
)
"$name-kotlinMultiplatform"
else
name
}
"jvm"
->
if
(
commonIsRoot
)
"$name-jvm"
else
name
else
->
if
(
isCommon
||
hasNative
)
defaultName
else
name
}
}
fun
isAvailableForPublication
(
publication
:
Publication
):
Boolean
{
val
name
=
publication
.
name
if
(
name
==
"maven"
)
return
true
var
result
=
false
val
jvmAndCommon
=
setOf
(
"jvm"
,
"androidRelease"
,
"androidDebug"
,
"js"
,
"jsLegacy"
,
"metadata"
,
"kotlinMultiplatform"
)
result
=
result
||
name
in
jvmAndCommon
result
=
result
||
(
HOST_NAME
==
"linux"
&&
name
==
"linuxX64"
)
result
=
result
||
(
HOST_NAME
==
"windows"
&&
name
==
"mingwX64"
)
val
macPublications
=
setOf
(
"iosX64"
,
"iosArm32"
,
"iosArm64"
,
"macosX64"
,
"watchosArm32"
,
"watchosArm64"
,
"watchosX86"
,
"watchosX64"
,
"tvosArm64"
,
"tvosX64"
)
result
=
result
||
(
HOST_NAME
==
"macos"
&&
name
in
macPublications
)
return
result
}
fun
Project
.
configurePublication
()
{
apply
(
plugin
=
"maven-publish"
)
tasks
.
withType
<
AbstractPublishToMaven
>().
all
{
onlyIf
{
isAvailableForPublication
(
publication
)
}
}
val
publishingUser
:
String
?
=
System
.
getenv
(
"PUBLISHING_USER"
)
val
publishingPassword
:
String
?
=
System
.
getenv
(
"PUBLISHING_PASSWORD"
)
val
publishingUrl
:
String
?
=
System
.
getenv
(
"PUBLISHING_URL"
)
val
publishLocal
:
Boolean
by
rootProject
.
extra
val
globalM2
:
String
by
rootProject
.
extra
val
nonDefaultProjectStructure
:
List
<
String
>
by
rootProject
.
extra
val
emptyJar
=
tasks
.
register
<
Jar
>(
"emptyJar"
)
{
archiveAppendix
.
set
(
"empty"
)
}
the
<
PublishingExtension
>().
apply
{
repositories
{
maven
{
if
(
publishLocal
)
{
setUrl
(
globalM2
)
}
else
{
publishingUrl
?.
let
{
setUrl
(
it
)
}
credentials
{
username
=
publishingUser
password
=
publishingPassword
}
}
}
maven
{
name
=
"testLocal"
setUrl
(
"$rootProject.buildDir/m2"
)
}
}
publications
.
forEach
{
val
publication
=
it
as
?
MavenPublication
?:
return
@forEach
publication
.
pom
.
withXml
{
val
root
=
asNode
()
root
.
appendNode
(
"name"
,
project
.
name
)
root
.
appendNode
(
"description"
,
"Ktor is a framework for quickly creating web applications in Kotlin with minimal effort."
)
root
.
appendNode
(
"url"
,
"https://github.com/ktorio/ktor"
)
root
.
appendNode
(
"licenses"
).
apply
{
appendNode
(
"license"
).
apply
{
appendNode
(
"name"
,
"The Apache Software License, Version 2.0"
)
appendNode
(
"url"
,
"https://www.apache.org/licenses/LICENSE-2.0.txt"
)
appendNode
(
"distribution"
,
"repo"
)
}
}
root
.
appendNode
(
"developers"
).
apply
{
appendNode
(
"developer"
).
apply
{
appendNode
(
"id"
,
"JetBrains"
)
appendNode
(
"name"
,
"JetBrains Team"
)
appendNode
(
"organization"
,
"JetBrains"
)
appendNode
(
"organizationUrl"
,
"https://www.jetbrains.com"
)
}
}
root
.
appendNode
(
"scm"
).
apply
{
appendNode
(
"url"
,
"https://github.com/ktorio/ktor.git"
)
}
}
val
type
=
publication
.
name
val
id
=
selectArtifactId
(
type
,
it
.
artifactId
)
publication
.
artifactId
=
id
if
(
name
==
"kotlinMultiplatform"
)
{
it
.
artifact
(
emptyJar
)
{
classifier
=
"javadoc"
}
it
.
artifact
(
emptyJar
)
{
classifier
=
"kdoc"
}
}
}
if
(
nonDefaultProjectStructure
.
contains
(
project
.
name
))
return
@apply
kotlin
.
targets
.
forEach
{
target
->
val
publication
=
publications
.
findByName
(
target
.
name
)
as
?
MavenPublication
?:
return
@forEach
if
(
target
.
platformType
.
name
==
"jvm"
)
{
publication
.
artifact
(
emptyJar
)
{
classifier
=
"javadoc"
}
}
else
{
publication
.
artifact
(
emptyJar
)
{
classifier
=
"javadoc"
}
publication
.
artifact
(
emptyJar
)
{
classifier
=
"kdoc"
}
}
if
(
target
.
platformType
.
name
==
"native"
)
{
publication
.
artifact
(
emptyJar
)
}
}
}
val
publishToMavenLocal
=
tasks
.
getByName
(
"publishToMavenLocal"
)
tasks
.
getByName
(
"publish"
).
dependsOn
(
publishToMavenLocal
)
val
signingKey
=
System
.
getenv
(
"SIGN_KEY_ID"
)
val
signingKeyPassphrase
=
System
.
getenv
(
"SIGN_KEY_PASSPHRASE"
)
if
(
signingKey
!=
null
&&
signingKey
!=
""
)
{
extra
[
"signing.gnupg.keyName"
]
=
signingKey
extra
[
"signing.gnupg.passphrase"
]
=
signingKeyPassphrase
apply
(
plugin
=
"signing"
)
the
<
SigningExtension
>().
apply
{
useGpgCmd
()
sign
(
the
<
PublishingExtension
>().
publications
)
}
}
}
buildSrc/src/main/kotlin/TargetsConfig.kt
0 → 100644
Просмотр файла @
4b4b73a6
/*
* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
@
file
:
Suppress
(
"UNUSED_VARIABLE"
)
import
org.gradle.api.*
import
org.gradle.kotlin.dsl.*
import
org.jetbrains.kotlin.gradle.targets.native.tasks.*
fun
Project
.
configureTargets
()
{
val
coroutines_version
:
String
by
extra
val
kotlin_version
:
String
by
extra
val
files
=
project
.
projectDir
.
listFiles
()
?:
emptyArray
()
val
hasCommon
=
files
.
any
{
it
.
name
==
"common"
}
val
hasJvmAndNix
=
hasCommon
||
files
.
any
{
it
.
name
==
"jvmAndNix"
}
val
hasPosix
=
hasCommon
||
files
.
any
{
it
.
name
==
"posix"
}
val
hasDesktop
=
hasPosix
||
files
.
any
{
it
.
name
==
"desktop"
}
val
hasNix
=
hasPosix
||
files
.
any
{
it
.
name
==
"nix"
}
val
hasDarwin
=
hasNix
||
files
.
any
{
it
.
name
==
"darwin"
}
val
hasJs
=
hasCommon
||
files
.
any
{
it
.
name
==
"js"
}
val
hasJvm
=
hasCommon
||
files
.
any
{
it
.
name
==
"jvm"
}
kotlin
{
if
(
hasJvm
)
{
jvm
()
configureJvm
()
}
if
(
hasJs
)
{
js
{
nodejs
()
browser
()
}
configureJs
()
}
if
(
hasPosix
||
hasDarwin
)
extra
.
set
(
"hasNative"
,
true
)
if
(
IDEA_ACTIVE
)
{
if
(
hasPosix
)
createIdeaTarget
(
"posix"
)
if
(
hasNix
)
createIdeaTarget
(
"nix"
)
if
(
hasDarwin
)
createIdeaTarget
(
"darwin"
)
if
(
hasDesktop
)
createIdeaTarget
(
"desktop"
)
}
else
{
sourceSets
{
if
(
hasPosix
)
{
val
posixMain
by
creating
val
posixTest
by
creating
}
if
(
hasNix
)
{
val
nixMain
by
creating
val
nixTest
by
creating
}
if
(
hasDarwin
)
{
val
darwinMain
by
creating
val
darwinTest
by
creating
}
if
(
hasDesktop
)
{
val
desktopMain
by
creating
val
desktopTest
by
creating
}
}
}
sourceSets
{
if
(
hasCommon
)
{
val
commonMain
by
getting
{
dependencies
{
api
(
"org.jetbrains.kotlin:kotlin-stdlib-common"
)
api
(
"org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
)
}
}
val
commonTest
by
getting
{
dependencies
{
api
(
"org.jetbrains.kotlin:kotlin-test-common:$kotlin_version"
)
api
(
"org.jetbrains.kotlin:kotlin-test-annotations-common:$kotlin_version"
)
}
}
extra
.
set
(
"commonStructure"
,
true
)
}
if
(
hasJvmAndNix
)
{
val
jvmAndNixMain
by
creating
{
findByName
(
"commonMain"
)
?.
let
{
dependsOn
(
it
)
}
}
val
jvmAndNixTest
by
creating
{
}
}
if
(
hasJvm
)
{
val
jvmMain
by
getting
{
findByName
(
"jvmAndNixMain"
)
?.
let
{
dependsOn
(
it
)
}
}
val
jvmTest
by
getting
{
findByName
(
"jvmAndNixTest"
)
?.
let
{
dependsOn
(
it
)
}
}
}
if
(
hasPosix
)
{
val
posixMain
by
getting
{
findByName
(
"commonMain"
)
?.
let
{
dependsOn
(
it
)
}
}
val
posixTest
by
getting
posixTargets
().
forEach
{
getByName
(
"${it.name}Main"
).
dependsOn
(
posixMain
)
getByName
(
"${it.name}Test"
).
dependsOn
(
posixTest
)
}
}
if
(
hasNix
)
{
val
nixMain
by
getting
{
findByName
(
"posixMain"
)
?.
let
{
dependsOn
(
it
)
}
findByName
(
"jvmAndNixMain"
)
?.
let
{
dependsOn
(
it
)
}
}
val
nixTest
by
getting
{
findByName
(
"jvmAndNixTest"
)
?.
let
{
dependsOn
(
it
)
}
}
nixTargets
().
forEach
{
getByName
(
"${it.name}Main"
).
dependsOn
(
nixMain
)
getByName
(
"${it.name}Test"
).
dependsOn
(
nixTest
)
}
}
if
(
hasDarwin
)
{
val
darwinMain
by
getting
{
findByName
(
"nixMain"
)
?.
let
{
dependsOn
(
it
)
}
}
val
darwinTest
by
getting
darwinTargets
().
forEach
{
getByName
(
"${it.name}Main"
).
dependsOn
(
darwinMain
)
getByName
(
"${it.name}Test"
).
dependsOn
(
darwinTest
)
}
}
if
(
hasDesktop
)
{
val
desktopMain
by
getting
{
findByName
(
"posixMain"
)
?.
let
{
dependsOn
(
it
)
}
}
val
desktopTest
by
getting
desktopTargets
().
forEach
{
getByName
(
"${it.name}Main"
).
dependsOn
(
desktopMain
)
getByName
(
"${it.name}Test"
).
dependsOn
(
desktopTest
)
if
(!
it
.
name
.
startsWith
(
HOST_NAME
))
{
disableCompilation
(
it
)
}
}
}
}
}
tasks
.
findByName
(
"mingwX64Test"
)
?.
apply
{
if
(
this
!
is
KotlinNativeTest
)
return
@apply
environment
(
"PATH"
,
"C:\\msys64\\mingw64\\bin;C:\\Tools\\msys64\\mingw64\\bin;C:\\Tools\\msys2\\mingw64\\bin"
)
}
}
buildSrc/src/main/kotlin/Versions.kt
0 → 100644
Просмотр файла @
4b4b73a6
/*
* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
val
jdk8Modules
=
setOf
(
"ktor-client-tests"
,
"ktor-server-core"
,
"ktor-server-host-common"
,
"ktor-server-servlet"
,
"ktor-server-netty"
,
"ktor-server-tomcat"
,
"ktor-server-test-host"
,
"ktor-server-test-suites"
,
"ktor-websockets"
,
"ktor-webjars"
,
"ktor-metrics"
,
"ktor-server-sessions"
,
"ktor-auth"
,
"ktor-auth-jwt"
,
"ktor-network-tls-certificates"
)
val
jdk7Modules
=
setOf
(
"ktor-http"
,
"ktor-http-cio"
,
"ktor-utils"
,
"ktor-network-tls"
,
"ktor-websockets"
,
"ktor-client-okhttp"
,
"ktor-metrics-micrometer"
)
val
jdk11Modules
=
setOf
(
"ktor-client-java"
)
gradle.properties
Просмотр файла @
4b4b73a6
...
...
@@ -19,7 +19,7 @@ org.gradle.vfs.watch=true
org.gradle.jvmargs
=
-Xmx6g -XX:MaxPermSize=6g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# kotlin
kotlin_version
=
1.5.3
0
kotlin_version
=
1.5.3
1
kotlin.native.ignoreDisabledTargets
=
true
kotlin.mpp.stability.nowarn
=
true
...
...
@@ -47,7 +47,7 @@ dokka_version=1.4.32
nodejs_version
=
14.17.1
npm_version
=
6.4.1
slf4j_version
=
1.7.30
ktlint_version
=
3.
3
.0
ktlint_version
=
3.
6
.0
mockk_version
=
1.12.0
mokito_kotlin_version
=
1.6.0
jansi_version
=
2.3.4
...
...
@@ -73,6 +73,3 @@ android_gradle_version=3.5.3
android_stetho_version
=
1.5.1
kotlin.js.compiler
=
both
kotlin.mpp.enableGranularSourceSetsMetadata
=
true
kotlin.mpp.enableCompatibilityMetadataVariant
=
true
gradle/codestyle.gradle
удалено
100644 → 0
Просмотр файла @
0081f943
/*
* Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
subprojects
{
apply
plugin:
"org.jmailen.kotlinter"
kotlinter
{
ignoreFailures
=
true
reporters
=
[
'checkstyle'
,
'plain'
]
experimentalRules
=
true
disabledRules
=
[
'no-wildcard-imports'
,
'experimental:spacing-between-declarations-with-annotations'
,
'experimental:enum-entry-name-case'
]
}
}
gradle/common.gradle
удалено
100644 → 0
Просмотр файла @
0081f943
kotlin
.
sourceSets
{
commonMain
.
dependencies
{
api
"org.jetbrains.kotlin:kotlin-stdlib-common"
api
group:
"org.jetbrains.kotlinx"
,
name:
"kotlinx-coroutines-core"
,
version:
coroutines_version
}
commonTest
.
dependencies
{
api
"org.jetbrains.kotlin:kotlin-test-common:$kotlin_version"
api
"org.jetbrains.kotlin:kotlin-test-annotations-common:$kotlin_version"
}
}
project
.
ext
.
set
(
"commonStructure"
,
true
)
gradle/darwin.gradle
удалено
100644 → 0
Просмотр файла @
0081f943
apply
from:
rootProject
.
file
(
"gradle/ide.gradle"
)
kotlin
{
targets
{
if
(
KtorBuildProperties
.
ideaActive
)
{
fromPreset
(
project
.
ext
.
ideaPreset
,
'darwin'
)
}
else
{
fromPreset
(
presets
.
iosArm64
,
'iosArm64'
)
fromPreset
(
presets
.
iosArm32
,
'iosArm32'
)
fromPreset
(
presets
.
iosX64
,
'iosX64'
)
fromPreset
(
presets
.
macosX64
,
'macosX64'
)
fromPreset
(
presets
.
tvosArm64
,
'tvosArm64'
)
fromPreset
(
presets
.
tvosX64
,
'tvosX64'
)
fromPreset
(
presets
.
watchosArm32
,
'watchosArm32'
)
fromPreset
(
presets
.
watchosArm64
,
'watchosArm64'
)
fromPreset
(
presets
.
watchosX86
,
'watchosX86'
)
fromPreset
(
presets
.
watchosX64
,
'watchosX64'
)
}
}
sourceSets
{
darwinMain
{
dependsOn
commonMain
}
darwinTest
if
(!
KtorBuildProperties
.
ideaActive
)
{
configure
([
iosArm32Main
,
iosArm64Main
,
iosX64Main
,
macosX64Main
,
tvosArm64Main
,
tvosX64Main
,
watchosArm32Main
,
watchosArm64Main
,
watchosX86Main
,
watchosX64Main
])
{
dependsOn
darwinMain
}
configure
([
iosArm32Test
,
iosArm64Test
,
iosX64Test
,
macosX64Test
,
tvosArm64Test
,
tvosX64Test
,
watchosArm32Test
,
watchosArm64Test
,
watchosX86Test
,
watchosX64Test
])
{
dependsOn
darwinTest
}
}
}
}
project
.
ext
.
set
(
"hasNative"
,
true
)
gradle/experimental.gradle
удалено
100644 → 0
Просмотр файла @
0081f943
/*
* Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
ext
.
experimentalAnnotations
=
[
"kotlin.RequiresOptIn"
,
"kotlin.ExperimentalUnsignedTypes"
,
"io.ktor.util.InternalAPI"
,
"io.ktor.utils.io.core.ExperimentalIoApi"
,
"io.ktor.utils.io.core.internal.DangerousInternalIoApi"
,
"kotlin.contracts.ExperimentalContracts"
]
gradle/ide.gradle
удалено
100644 → 0
Просмотр файла @
0081f943
assemble
.
doLast
{
copy
{
if
(
project
.
ext
.
isLinuxHost
)
{
from
"build/classes/kotlin/linuxX64"
}
if
(
project
.
ext
.
isMacosHost
)
{
from
"build/classes/kotlin/macosX64"
}
if
(
project
.
ext
.
isWinHost
)
{
from
"build/classes/kotlin/mingwX64"
}
into
"build/classes/kotlin/posix"
}
}
Пред
1
2
3
4
5
...
8
След
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать