Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
skiko
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liuqiang
skiko
Commits
71e2477d
Unverified
Commit
71e2477d
authored
Oct 15, 2021
by
Alexey Tsvetkov
Committed by
GitHub
Oct 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make publications comply with Maven Central requirements (#267)
parent
73c0bbc5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
9 deletions
+67
-9
build.gradle.kts
skiko/build.gradle.kts
+59
-2
properties.kt
skiko/buildSrc/src/main/kotlin/properties.kt
+3
-0
utils.kt
skiko/buildSrc/src/main/kotlin/utils.kt
+5
-7
No files found.
skiko/build.gradle.kts
View file @
71e2477d
...
...
@@ -2,10 +2,12 @@ import de.undercouch.gradle.tasks.download.Download
import
org.gradle.crypto.checksum.Checksum
import
org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import
org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile
import
java.util.Locale
plugins
{
kotlin
(
"multiplatform"
)
version
"1.5.31"
// "1.6.0-M1"
`
maven
-
publish
`
signing
id
(
"org.gradle.crypto.checksum"
)
version
"1.1.0"
id
(
"de.undercouch.download"
)
version
"4.1.1"
}
...
...
@@ -950,6 +952,14 @@ afterEvaluate {
}
}
val
emptySourcesJar
by
tasks
.
registering
(
Jar
::
class
)
{
archiveClassifier
.
set
(
"sources"
)
}
val
emptyJavadocJar
by
tasks
.
registering
(
Jar
::
class
)
{
archiveClassifier
.
set
(
"javadoc"
)
}
publishing
{
repositories
{
configureEach
{
...
...
@@ -973,34 +983,81 @@ publishing {
}
}
publications
{
val
pomNameForPublication
=
HashMap
<
String
,
String
>()
pomNameForPublication
[
"kotlinMultiplatform"
]
=
"Skiko MPP"
kotlin
.
targets
.
forEach
{
pomNameForPublication
[
it
.
name
]
=
"Skiko ${toTitleCase(it.name)}"
}
configureEach
{
this
as
MavenPublication
groupId
=
"org.jetbrains.skiko"
if
(
skiko
.
signArtifacts
)
{
signing
.
sign
(
this
)
}
// Necessary for publishing to Maven Central
artifact
(
emptyJavadocJar
)
pom
{
name
.
set
(
"Skiko"
)
description
.
set
(
"Kotlin Skia bindings"
)
url
.
set
(
"http://www.github.com/JetBrains/skiko"
)
packaging
=
"jar"
licenses
{
license
{
name
.
set
(
"The Apache License, Version 2.0"
)
url
.
set
(
"http://www.apache.org/licenses/LICENSE-2.0.txt"
)
}
}
val
repoUrl
=
"https://www.github.com/JetBrains/skiko"
url
.
set
(
repoUrl
)
scm
{
url
.
set
(
repoUrl
)
val
repoConnection
=
"scm:git:$repoUrl.git"
connection
.
set
(
repoConnection
)
developerConnection
.
set
(
repoConnection
)
}
developers
{
developer
{
name
.
set
(
"Compose Multiplatform Team"
)
organization
.
set
(
"JetBrains"
)
organizationUrl
.
set
(
"https://www.jetbrains.com"
)
}
}
}
}
create
<
MavenPublication
>(
"skikoJvmRuntime"
)
{
pomNameForPublication
[
name
]
=
"Skiko JVM Runtime for ${targetOs.name} ${targetArch.name}"
artifactId
=
SkikoArtifacts
.
runtimeArtifactIdFor
(
targetOs
,
targetArch
)
afterEvaluate
{
artifact
(
skikoJvmRuntimeJar
.
map
{
it
.
archiveFile
.
get
()
})
var
jvmSourcesArtifact
:
Any
?
=
null
kotlin
.
jvm
().
mavenPublication
{
jvmSourcesArtifact
=
artifacts
.
find
{
it
.
classifier
==
"sources"
}
}
if
(
jvmSourcesArtifact
==
null
)
{
error
(
"Could not find sources jar artifact for JVM target"
)
}
else
{
artifact
(
jvmSourcesArtifact
)
}
}
}
if
(
supportWasm
)
{
create
<
MavenPublication
>(
"skikoWasmRuntime"
)
{
pomNameForPublication
[
name
]
=
"Skiko WASM Runtime"
artifactId
=
SkikoArtifacts
.
jsWasmArtifactId
artifact
(
skikoWasmJar
.
get
())
artifact
(
emptySourcesJar
)
}
}
val
publicationsWithoutPomNames
=
publications
.
filter
{
it
.
name
!
in
pomNameForPublication
}
if
(
publicationsWithoutPomNames
.
isNotEmpty
())
{
error
(
"Publications with unknown POM names: ${publicationsWithoutPomNames.joinToString { "
'$
it
'
" }}"
)
}
configureEach
{
this
as
MavenPublication
pom
.
name
.
set
(
pomNameForPublication
[
name
]
!!
)
}
}
}
...
...
skiko/buildSrc/src/main/kotlin/properties.kt
View file @
71e2477d
...
...
@@ -127,6 +127,9 @@ class SkikoProperties(private val myProject: Project) {
val
isRelease
:
Boolean
get
()
=
myProject
.
findProperty
(
"deploy.release"
)
==
"true"
val
signArtifacts
:
Boolean
get
()
=
myProject
.
findProperty
(
"deploy.sign"
)
==
"true"
val
buildType
:
SkiaBuildType
get
()
=
if
(
myProject
.
findProperty
(
"skiko.debug"
)
==
"true"
)
SkiaBuildType
.
DEBUG
else
SkiaBuildType
.
RELEASE
...
...
skiko/buildSrc/src/main/kotlin/utils.kt
View file @
71e2477d
...
...
@@ -2,6 +2,7 @@ import org.gradle.api.Task
import
org.gradle.api.provider.Provider
import
org.gradle.api.tasks.TaskContainer
import
org.gradle.kotlin.dsl.register
import
java.util.*
// Utils, that are not needed in scripts can be placed to internal/utils
...
...
@@ -15,10 +16,7 @@ inline fun <reified T : Task> TaskContainer.registerOrGetTask(
}
fun
joinToTitleCamelCase
(
vararg
parts
:
String
):
String
=
parts
.
joinToString
(
separator
=
""
)
{
part
->
if
(
part
.
isEmpty
())
part
else
buildString
{
append
(
part
.
first
().
toTitleCase
())
append
(
part
.
substring
(
1
))
}
}
\ No newline at end of file
parts
.
joinToString
(
separator
=
""
)
{
toTitleCase
(
it
)
}
fun
toTitleCase
(
s
:
String
):
String
=
s
.
capitalize
(
Locale
.
ROOT
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment