Build fix for module deploy

This commit is contained in:
Alexander Nozik 2019-06-22 15:33:33 +03:00
parent b275288c55
commit 7f95dcf02c
9 changed files with 36 additions and 23 deletions

View File

@ -1,10 +1,15 @@
import com.jfrog.bintray.gradle.tasks.BintrayUploadTask
import org.gradle.api.Plugin import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.internal.artifact.FileBasedMavenArtifact
import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.getValue import org.gradle.kotlin.dsl.getValue
import org.gradle.kotlin.dsl.getting import org.gradle.kotlin.dsl.getting
import org.gradle.kotlin.dsl.invoke import org.gradle.kotlin.dsl.invoke
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask
open class ScientifikMPPlugin : Plugin<Project> { open class ScientifikMPPlugin : Plugin<Project> {
override fun apply(project: Project) { override fun apply(project: Project) {
@ -72,5 +77,23 @@ open class ScientifikMPPlugin : Plugin<Project> {
} }
} }
project.tasks.filter { it is ArtifactoryTask || it is BintrayUploadTask }.forEach {
it.doFirst {
project.configure<PublishingExtension> {
publications
.filterIsInstance<MavenPublication>()
.forEach { publication ->
val moduleFile = project.buildDir.resolve("publications/${publication.name}/module.json")
if (moduleFile.exists()) {
publication.artifact(object : FileBasedMavenArtifact(moduleFile) {
override fun getDefaultExtension() = "module"
})
}
}
}
}
}
} }
} }

View File

@ -1,4 +1,5 @@
import com.jfrog.bintray.gradle.BintrayExtension import com.jfrog.bintray.gradle.BintrayExtension
import com.jfrog.bintray.gradle.tasks.BintrayUploadTask
import groovy.lang.GroovyObject import groovy.lang.GroovyObject
import org.gradle.api.Plugin import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project
@ -14,6 +15,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention import org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention
import org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig import org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig
import org.jfrog.gradle.plugin.artifactory.dsl.ResolverConfig import org.jfrog.gradle.plugin.artifactory.dsl.ResolverConfig
import org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask
open class ScientifikExtension { open class ScientifikExtension {
@ -65,13 +67,6 @@ open class ScientifikPublishPlugin : Plugin<Project> {
url.set(extension.vcs) url.set(extension.vcs)
} }
} }
val moduleFile = project.buildDir.resolve("publications/${publication.name}/module.json")
if (moduleFile.exists()) {
publication.artifact(object : FileBasedMavenArtifact(moduleFile) {
override fun getDefaultExtension() = "module"
})
}
} }
} }

View File

@ -7,9 +7,6 @@ description = "Context and provider definitions"
val coroutinesVersion: String = Versions.coroutinesVersion val coroutinesVersion: String = Versions.coroutinesVersion
kotlin { kotlin {
jvm()
js()
sourceSets { sourceSets {
val commonMain by getting { val commonMain by getting {
dependencies { dependencies {

View File

@ -7,6 +7,7 @@ import kotlinx.io.core.readBytes
/** /**
* A source of binary data * A source of binary data
*/ */
interface Binary { interface Binary {
/** /**
* The size of binary in bytes * The size of binary in bytes

View File

@ -2,6 +2,7 @@ package hep.dataforge.io
import kotlinx.io.core.* import kotlinx.io.core.*
@ExperimentalUnsignedTypes
class TaggedEnvelopeFormat( class TaggedEnvelopeFormat(
val metaFormats: Collection<MetaFormat>, val metaFormats: Collection<MetaFormat>,
val outputMetaFormat: MetaFormat = metaFormats.first() val outputMetaFormat: MetaFormat = metaFormats.first()

View File

@ -4,7 +4,3 @@ plugins {
description = "Meta definition and basic operations on meta" description = "Meta definition and basic operations on meta"
kotlin {
jvm()
js()
}

View File

@ -197,7 +197,7 @@ fun Meta.seal(): SealedMeta = this as? SealedMeta ?: SealedMeta(items.mapValues
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
fun MetaItem<*>.seal(): MetaItem<SealedMeta> = when (this) { fun MetaItem<*>.seal(): MetaItem<SealedMeta> = when (this) {
is ValueItem -> this as MetaItem<SealedMeta> is ValueItem -> this
is NodeItem -> NodeItem(node.seal()) is NodeItem -> NodeItem(node.seal())
} }

View File

@ -26,7 +26,7 @@ class Styled(val base: Meta, val style: Config = Config().empty()) : AbstractMut
is MetaItem.NodeItem -> MetaItem.NodeItem(Styled(style.empty(), styleValue.node)) is MetaItem.NodeItem -> MetaItem.NodeItem(Styled(style.empty(), styleValue.node))
is MetaItem.ValueItem -> styleValue is MetaItem.ValueItem -> styleValue
} }
is MetaItem.ValueItem -> value as MetaItem<Styled> is MetaItem.ValueItem -> value
is MetaItem.NodeItem -> MetaItem.NodeItem( is MetaItem.NodeItem -> MetaItem.NodeItem(
Styled(value.node, styleValue?.node ?: Config.empty()) Styled(value.node, styleValue?.node ?: Config.empty())
) )

View File

@ -37,11 +37,11 @@ class DynamicMeta(val obj: dynamic) : Meta {
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
private fun asItem(obj: dynamic): MetaItem<DynamicMeta>? { private fun asItem(obj: dynamic): MetaItem<DynamicMeta>? {
if (obj == null) return MetaItem.ValueItem(Null) as MetaItem<DynamicMeta> if (obj == null) return MetaItem.ValueItem(Null)
return when (jsTypeOf(obj as? Any)) { return when (jsTypeOf(obj as? Any)) {
"boolean" -> MetaItem.ValueItem(Value.of(obj as Boolean)) as MetaItem<DynamicMeta> "boolean" -> MetaItem.ValueItem(Value.of(obj as Boolean))
"number" -> MetaItem.ValueItem(Value.of(obj as Number)) as MetaItem<DynamicMeta> "number" -> MetaItem.ValueItem(Value.of(obj as Number))
"string" -> MetaItem.ValueItem(Value.of(obj as String)) as MetaItem<DynamicMeta> "string" -> MetaItem.ValueItem(Value.of(obj as String))
"object" -> MetaItem.NodeItem(DynamicMeta(obj)) "object" -> MetaItem.NodeItem(DynamicMeta(obj))
else -> null else -> null
} }