1
- import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
1
+ import com.github.lamba92.dragalialost.build.ktor
2
2
3
3
plugins {
4
- kotlin(" multiplatform" )
5
- `maven- publish`
4
+ id(" dragalia-gradle-plugin" )
6
5
}
7
6
8
7
kotlin {
9
8
10
- metadata {
11
- mavenPublication {
12
- artifactId = " ${rootProject.name} -${project.name} -metadata"
13
- }
14
- }
9
+ val ktorVersion: String by project
10
+ val textEncodingVersion: String by project
15
11
16
- jvm {
17
- compilations.all {
18
- kotlinOptions {
19
- jvmTarget = " 1.8"
20
- }
21
- }
22
- mavenPublication {
23
- artifactId = " ${rootProject.name} -${project.name} -jvm"
24
- }
12
+ sourceSets[" commonMain" ].dependencies {
13
+ api(project(" :data" ))
14
+ api(ktor(" client-core" , ktorVersion))
25
15
}
26
16
27
- js {
28
- nodejs()
29
- mavenPublication {
30
- artifactId = " ${rootProject.name} -${project.name} -js"
31
- }
17
+ sourceSets[" jvmMain" ].dependencies {
18
+ api(project(" :data" ))
19
+ api(ktor(" client-core-jvm" , ktorVersion))
32
20
}
33
21
34
- sourceSets {
35
-
36
- val ktorVersion: String by project
37
- val textEncodingVersion: String by project
38
-
39
- @Suppress(" UNUSED_VARIABLE" ) val commonMain by getting {
40
- dependencies {
41
- api(project(" :data" ))
42
- api(ktor(" client-core" , ktorVersion))
43
- }
44
- }
45
-
46
- @Suppress(" UNUSED_VARIABLE" ) val jvmMain by getting {
47
- dependencies {
48
- api(project(" :data" ))
49
- api(ktor(" client-core-jvm" , ktorVersion))
50
- }
51
- }
52
-
53
- @Suppress(" UNUSED_VARIABLE" ) val jvmTest by getting {
54
- dependencies {
55
- api(kotlin(" test-junit" ))
56
- }
57
- }
58
-
59
- @Suppress(" UNUSED_VARIABLE" ) val jsMain by getting {
60
- dependencies {
61
- api(project(" :data" ))
62
- api(ktor(" client-core-js" , ktorVersion))
63
- api(npm(" text-encoding" , textEncodingVersion))
64
- }
65
- }
66
-
22
+ sourceSets[" jvmTest" ].dependencies {
23
+ api(kotlin(" test-junit" ))
67
24
}
68
25
69
- }
70
-
71
- fun property (propertyName : String ): String? =
72
- project.findProperty(propertyName) as String? ? : System .getenv(propertyName)
73
-
74
- publishing {
75
- repositories {
76
- maven(" https://maven.pkg.github.com/${property(" githubAccount" )} /${rootProject.name} " ) {
77
- name = " GitHubPackages"
78
- credentials {
79
- username = property(" githubAccount" )
80
- password = property(" githubToken" )
81
- }
82
- }
26
+ sourceSets[" jsMain" ].dependencies {
27
+ api(project(" :data" ))
28
+ api(ktor(" client-core-js" , ktorVersion))
29
+ api(npm(" text-encoding" , textEncodingVersion))
83
30
}
84
- val commonModulePublication = publications[" kotlinMultiplatform" ] as MavenPublication
85
- commonModulePublication.artifactId = " ${rootProject.name} -${project.name} -common"
86
- }
87
- //
88
- // tasks.register<Copy>("buildNodePackage") {
89
- // group = "nodejs"
90
- // val jsJar by tasks.named<Jar>("jsJar")
91
- // val jsPackageJson by tasks.named<org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinPackageJsonTask>("jsPackageJson")
92
- // dependsOn(jsJar, jsPackageJson)
93
- //
94
- // into(file("$buildDir/nodePackage"))
95
- //
96
- // from(jsPackageJson.packageJson)
97
- //
98
- // from(zipTree(jsJar.archiveFile)) {
99
- // include("*.js")
100
- // into("kotlin")
101
- // }
102
- //
103
- // }
104
31
105
- @Suppress(" unused" )
106
- fun KotlinDependencyHandler.ktor (module : String , version : String? = null): Any =
107
- " io.ktor:ktor-$module${version?.let { " :$version " } ? : " " } "
32
+ }
0 commit comments