Открыть боковую панель
Aurora OS
Kotlin Multiplatform
Libraries
ktor
Коммиты
49257088
Не подтверждена
Коммит
49257088
создал
Июн 28, 2021
по автору
Leonid Stashevsky
Зафиксировано автором
GitHub
Июн 28, 2021
Просмотр файлов
KTOR-2399 Configure npm publishing (#2521)
владелец
dc70b1b7
Изменения
6
Скрыть пробелы
Построчно
Рядом
build.gradle.kts
Просмотр файла @
49257088
...
@@ -122,6 +122,10 @@ val disabledExplicitApiModeProjects = listOf(
...
@@ -122,6 +122,10 @@ val disabledExplicitApiModeProjects = listOf(
apply
(
from
=
"gradle/compatibility.gradle"
)
apply
(
from
=
"gradle/compatibility.gradle"
)
plugins
{
id
(
"org.jetbrains.dokka"
)
version
"1.4.32"
}
allprojects
{
allprojects
{
group
=
"io.ktor"
group
=
"io.ktor"
version
=
configuredVersion
version
=
configuredVersion
...
@@ -149,7 +153,11 @@ allprojects {
...
@@ -149,7 +153,11 @@ allprojects {
platforms
.
forEach
{
platform
->
platforms
.
forEach
{
platform
->
if
(
projectNeedsPlatform
(
this
,
platform
))
{
if
(
projectNeedsPlatform
(
this
,
platform
))
{
apply
(
from
=
rootProject
.
file
(
"gradle/$platform.gradle"
))
if
(
platform
==
"js"
)
{
configureJsModules
()
}
else
{
apply
(
from
=
rootProject
.
file
(
"gradle/$platform.gradle"
))
}
}
}
}
}
...
@@ -198,10 +206,6 @@ if (project.hasProperty("enable-coverage")) {
...
@@ -198,10 +206,6 @@ if (project.hasProperty("enable-coverage")) {
apply
(
from
=
"gradle/jacoco.gradle"
)
apply
(
from
=
"gradle/jacoco.gradle"
)
}
}
plugins
{
id
(
"org.jetbrains.dokka"
)
version
"1.4.32"
}
subprojects
{
subprojects
{
plugins
.
apply
(
"org.jetbrains.dokka"
)
plugins
.
apply
(
"org.jetbrains.dokka"
)
...
@@ -217,6 +221,6 @@ subprojects {
...
@@ -217,6 +221,6 @@ subprojects {
val
docs
:
String
?
by
extra
val
docs
:
String
?
by
extra
if
(
docs
!=
null
)
{
if
(
docs
!=
null
)
{
tasks
.
withType
<
DokkaMultiModuleTask
>
{
tasks
.
withType
<
DokkaMultiModuleTask
>
{
pluginsMapConfiguration
.
set
(
mapOf
(
"org.jetbrains.dokka.versioning.VersioningPlugin"
to
"""{ "version": "$configuredVersion", "olderVersionsDir":"$
{
docs
}
" }"""
))
pluginsMapConfiguration
.
set
(
mapOf
(
"org.jetbrains.dokka.versioning.VersioningPlugin"
to
"""{ "version": "$configuredVersion", "olderVersionsDir":"$docs" }"""
))
}
}
}
}
buildSrc/build.gradle.kts
Просмотр файла @
49257088
...
@@ -23,10 +23,6 @@ repositories {
...
@@ -23,10 +23,6 @@ repositories {
}
}
}
}
kotlinDslPluginOptions
{
experimentalWarning
.
set
(
false
)
}
val
props
=
Properties
().
apply
{
val
props
=
Properties
().
apply
{
file
(
"../gradle.properties"
).
inputStream
().
use
{
load
(
it
)
}
file
(
"../gradle.properties"
).
inputStream
().
use
{
load
(
it
)
}
}
}
...
@@ -37,6 +33,7 @@ fun version(target: String): String {
...
@@ -37,6 +33,7 @@ fun version(target: String): String {
val
snapshotVersion
=
properties
[
"kotlin_snapshot_version"
]
val
snapshotVersion
=
properties
[
"kotlin_snapshot_version"
]
if
(
snapshotVersion
!=
null
)
return
snapshotVersion
.
toString
()
if
(
snapshotVersion
!=
null
)
return
snapshotVersion
.
toString
()
}
}
return
props
.
getProperty
(
"${target}_version"
)
return
props
.
getProperty
(
"${target}_version"
)
}
}
...
@@ -45,4 +42,5 @@ sourceSets.main {
...
@@ -45,4 +42,5 @@ sourceSets.main {
dependencies
{
dependencies
{
implementation
(
kotlin
(
"gradle-plugin"
,
version
(
"kotlin"
)))
implementation
(
kotlin
(
"gradle-plugin"
,
version
(
"kotlin"
)))
implementation
(
"com.moowork.gradle:gradle-node-plugin:1.3.1"
)
}
}
buildSrc/src/main/kotlin/JsConfiguration.kt
0 → 100644
Просмотр файла @
49257088
/*
* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
import
com.moowork.gradle.node.npm.*
import
org.gradle.api.*
import
org.gradle.api.tasks.*
import
org.gradle.internal.file.impl.DefaultFileMetadata.*
import
org.gradle.kotlin.dsl.*
import
org.jetbrains.kotlin.gradle.plugin.*
import
java.io.*
val
skipModules
=
listOf
(
"ktor-client-cio"
)
fun
Project
.
configureJsModules
()
{
if
(
skipModules
.
contains
(
project
.
name
))
return
configureJsTasks
()
kotlin
{
val
kotlin_version
:
String
by
extra
sourceSets
{
val
jsMain
by
getting
{
dependencies
{
api
(
"org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
)
}
}
val
jsTest
by
getting
{
dependencies
{
api
(
"org.jetbrains.kotlin:kotlin-test-js:$kotlin_version"
)
api
(
npm
(
"puppeteer"
,
"*"
))
}
}
}
}
configureTestTask
()
configurePublishing
()
}
private
fun
Project
.
configureJsTasks
()
{
kotlin
{
js
{
nodejs
{
testTask
{
useMocha
{
timeout
=
"10000"
}
}
}
browser
{
testTask
{
useKarma
{
useChromeHeadless
()
useConfigDirectory
(
File
(
project
.
rootProject
.
projectDir
,
"karma"
))
}
}
}
val
main
by
compilations
.
getting
main
.
kotlinOptions
.
apply
{
metaInfo
=
true
sourceMap
=
true
moduleKind
=
"umd"
this
.
main
=
"noCall"
sourceMapEmbedSources
=
"always"
}
val
test
by
compilations
.
getting
test
.
kotlinOptions
.
apply
{
metaInfo
=
true
sourceMap
=
true
moduleKind
=
"umd"
this
.
main
=
"call"
sourceMapEmbedSources
=
"always"
}
}
}
}
private
fun
Project
.
configureTestTask
()
{
val
shouldRunJsBrowserTest
=
!
hasProperty
(
"teamcity"
)
||
hasProperty
(
"enable-js-tests"
)
val
jsLegacyBrowserTest
by
tasks
.
getting
jsLegacyBrowserTest
.
onlyIf
{
shouldRunJsBrowserTest
}
val
jsIrBrowserTest
by
tasks
.
getting
jsIrBrowserTest
.
onlyIf
{
shouldRunJsBrowserTest
}
}
private
val
Project
.
NPM_TEMP_DIR
:
File
get
()
=
file
(
"$projectDir/npm"
)
private
val
Project
.
NPM_DEPLOY_DIR
:
File
get
()
=
file
(
"$buildDir/npm"
)
private
val
NPM_AUTH_TOKEN
:
String
?
get
()
=
System
.
getenv
(
"NPM_AUTH_TOKEN"
)
private
val
Project
.
jsTarget
:
KotlinTarget
get
()
=
kotlin
.
targets
.
findByName
(
"jsLegacy"
)
?:
kotlin
.
targets
.
findByName
(
"js"
)
?:
error
(
"Fail to find js target"
)
private
fun
Project
.
configurePublishing
()
{
NPM_AUTH_TOKEN
?:
return
val
kotlin_version
:
String
by
extra
apply
(
plugin
=
"com.moowork.node"
)
val
prepareTask
=
tasks
.
create
<
Copy
>(
"preparePublishTask"
)
{
from
(
NPM_TEMP_DIR
)
{
afterEvaluate
{
this
@from
.
expand
(
properties
+
mapOf
(
"kotlinDependency"
to
"\"kotlin\": \"$kotlin_version\""
))
}
}
val
main
by
jsTarget
.
compilations
.
getting
from
(
main
.
output
.
allOutputs
)
into
(
NPM_DEPLOY_DIR
)
}
tasks
.
create
<
NpmTask
>(
"publishNpm"
)
{
dependsOn
(
prepareTask
)
setWorkingDir
(
NPM_DEPLOY_DIR
)
setArgs
(
listOf
(
"publish"
,
"--//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN"
,
"--tag=latest"
))
}
}
buildSrc/src/main/kotlin/Train.kt
Просмотр файла @
49257088
...
@@ -45,7 +45,6 @@ fun Project.filterSnapshotTests() {
...
@@ -45,7 +45,6 @@ fun Project.filterSnapshotTests() {
}
}
}
}
fun
Project
.
setupTrainForSubproject
()
{
fun
Project
.
setupTrainForSubproject
()
{
val
build_snapshot_train
:
Boolean
?
by
extra
val
build_snapshot_train
:
Boolean
?
by
extra
if
(
build_snapshot_train
!=
true
)
return
if
(
build_snapshot_train
!=
true
)
return
...
...
gradle.properties
Просмотр файла @
49257088
...
@@ -44,7 +44,7 @@ jwks_rsa_version=0.17.0
...
@@ -44,7 +44,7 @@ jwks_rsa_version=0.17.0
logback_version
=
1.2.3
logback_version
=
1.2.3
junit_version
=
4.12
junit_version
=
4.12
dokka_version
=
1.4.32
dokka_version
=
1.4.32
nodejs_version
=
1
0
.1
5
.1
nodejs_version
=
1
4
.1
7
.1
npm_version
=
6.4.1
npm_version
=
6.4.1
slf4j_version
=
1.7.30
slf4j_version
=
1.7.30
ktlint_version
=
3.3.0
ktlint_version
=
3.3.0
...
...
gradle/js.gradle
удалено
100644 → 0
Просмотр файла @
dc70b1b7
def
skipModules
=
[
"ktor-client-cio"
]
if
(
skipModules
.
contains
(
project
.
name
))
return
kotlin
{
js
{
nodejs
{
testTask
{
useMocha
{
timeout
=
10000
}
debug
=
false
}
}
browser
{
testTask
{
useKarma
{
useChromeHeadless
()
useConfigDirectory
(
new
File
(
project
.
rootProject
.
projectDir
,
"karma"
))
}
}
}
compilations
.
main
.
kotlinOptions
{
metaInfo
=
true
sourceMap
=
true
moduleKind
=
'umd'
main
=
'noCall'
sourceMapEmbedSources
=
'always'
}
compilations
.
test
.
kotlinOptions
{
metaInfo
=
true
sourceMap
=
true
moduleKind
=
'umd'
main
=
'call'
sourceMapEmbedSources
=
'always'
}
}
sourceSets
{
jsMain
.
dependencies
{
api
"org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
}
jsTest
.
dependencies
{
api
"org.jetbrains.kotlin:kotlin-test-js:$kotlin_version"
api
(
npm
(
"puppeteer"
,
"*"
))
}
}
}
def
shouldRunJsBrowserTest
=
!
project
.
hasProperty
(
"teamcity"
)
||
project
.
hasProperty
(
"enable-js-tests"
)
jsLegacyBrowserTest
.
onlyIf
{
shouldRunJsBrowserTest
}
jsIrBrowserTest
.
onlyIf
{
shouldRunJsBrowserTest
}
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать