Switch to kscience project configuration.

This commit is contained in:
Alexander Nozik 2022-09-06 13:32:13 +03:00
parent 491a4e6000
commit 74e878e7e5
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
6 changed files with 54 additions and 96 deletions

View File

@ -1,5 +1,9 @@
import space.kscience.gradle.isInDevelopment
import space.kscience.gradle.useApache2Licence
import space.kscience.gradle.useSPCTeam
plugins { plugins {
base id("space.kscience.gradle.project")
} }
val ktorVersion by extra("2.0.3") val ktorVersion by extra("2.0.3")
@ -9,81 +13,29 @@ allprojects {
version = "0.1.0-SNAPSHOT" version = "0.1.0-SNAPSHOT"
} }
tasks.create("version") { ksciencePublish{
group = "publishing" pom("https://github.com/SciProgCentre/maps-kt") {
val versionFile = project.buildDir.resolve("project-version.txt") useApache2Licence()
outputs.file(versionFile) useSPCTeam()
doLast {
versionFile.createNewFile()
versionFile.writeText(project.version.toString())
println(project.version)
} }
github("maps-kt", "SciProgCentre")
space(
if (isInDevelopment) {
"https://maven.pkg.jetbrains.space/mipt-npm/p/sci/dev"
} else {
"https://maven.pkg.jetbrains.space/mipt-npm/p/sci/release"
}
)
sonatype()
} }
subprojects { subprojects {
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
maven("https://repo.kotlin.link")
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
} }
plugins.withId("maven-publish") {
configure<PublishingExtension> {
val vcs = "https://github.com/mipt-npm/maps-kt"
// Process each publication we have in this project
publications {
withType<MavenPublication> {
pom {
name.set(project.name)
description.set(project.description)
url.set(vcs)
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
developers {
developer {
id.set("SPC")
name.set("Scientific programming centre")
organization.set("MIPT")
organizationUrl.set("https://sciprog.center/")
}
}
scm {
url.set(vcs)
tag.set(project.version.toString())
}
}
}
}
val spaceRepo = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven"
val spaceUser: String? = project.findProperty("publishing.space.user") as? String
val spaceToken: String? = project.findProperty("publishing.space.token") as? String
if (spaceUser != null && spaceToken != null) {
project.logger.info("Adding mipt-npm Space publishing to project [${project.name}]")
repositories.maven {
name = "space"
url = uri(spaceRepo)
credentials {
username = spaceUser
password = spaceToken
}
}
}
}
}
} }

View File

@ -1,5 +1,9 @@
kotlin.code.style=official kotlin.code.style=official
kotlin.version=1.6.10 kotlin.version=1.6.10
compose.version=1.1.1
compose.version=1.2.0-alpha01-dev774
agp.version=4.2.2 agp.version=4.2.2
android.useAndroidX=true android.useAndroidX=true
toolsVersion=0.13.0-kotlin-1.7.10

View File

@ -1,26 +1,4 @@
plugins { plugins {
kotlin("multiplatform") id("space.kscience.gradle.mpp")
`maven-publish` `maven-publish`
} }
val ktorVersion: String by rootProject.extra
kotlin {
explicitApi = org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode.Warning
jvm {
compilations.all {
kotlinOptions.jvmTarget = "11"
}
}
js(IR) {
browser()
}
sourceSets{
commonTest{
dependencies{
implementation(kotlin("test"))
}
}
}
}

View File

@ -1,13 +1,12 @@
package center.sciprog.maps.coordinates package center.sciprog.maps.coordinates
import kotlin.test.Ignore
import kotlin.test.Test import kotlin.test.Test
import kotlin.test.assertEquals import kotlin.test.assertEquals
internal class DistanceTest { internal class DistanceTest {
companion object { companion object {
val moscow = GMC.ofDegrees(55.76058287719673, 37.60358622841869) val moscow = Gmc.ofDegrees(55.76058287719673, 37.60358622841869)
val spb = GMC.ofDegrees(59.926686023580444, 30.36038109122013) val spb = Gmc.ofDegrees(59.926686023580444, 30.36038109122013)
} }
@Test @Test

View File

@ -11,7 +11,6 @@ kotlin {
compilations.all { compilations.all {
kotlinOptions.jvmTarget = "11" kotlinOptions.jvmTarget = "11"
} }
withJava()
} }
sourceSets { sourceSets {
commonMain { commonMain {
@ -25,6 +24,5 @@ kotlin {
api(compose.desktop.currentOs) api(compose.desktop.currentOs)
} }
} }
val jvmTest by getting
} }
} }

View File

@ -1,12 +1,17 @@
rootProject.name = "maps-kt" rootProject.name = "maps-kt"
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
enableFeaturePreview("VERSION_CATALOGS")
pluginManagement { pluginManagement {
val toolsVersion: String by extra
repositories { repositories {
google() google()
gradlePluginPortal() gradlePluginPortal()
mavenCentral() mavenCentral()
maven("https://repo.kotlin.link")
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
} }
@ -16,9 +21,31 @@ pluginManagement {
id("com.android.application").version(extra["agp.version"] as String) id("com.android.application").version(extra["agp.version"] as String)
id("com.android.library").version(extra["agp.version"] as String) id("com.android.library").version(extra["agp.version"] as String)
id("org.jetbrains.compose").version(extra["compose.version"] as String) id("org.jetbrains.compose").version(extra["compose.version"] as String)
id("space.kscience.gradle.project") version toolsVersion
id("space.kscience.gradle.mpp") version toolsVersion
id("space.kscience.gradle.jvm") version toolsVersion
id("space.kscience.gradle.js") version toolsVersion
} }
} }
dependencyResolutionManagement {
val toolsVersion: String by extra
repositories {
mavenLocal()
maven("https://repo.kotlin.link")
mavenCentral()
gradlePluginPortal()
}
versionCatalogs {
create("spclibs") {
from("space.kscience:version-catalog:$toolsVersion")
}
}
}
include( include(
":maps-kt-core", ":maps-kt-core",