This commit is contained in:
Alexander Nozik 2021-07-21 13:01:29 +03:00
parent 252a633583
commit 100f7cd55f
4 changed files with 46 additions and 4 deletions

View File

@ -17,6 +17,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
### Security
## [0.10.2]
### Added
- Experimental automatic JS project bundling in MPP
### Changed
### Deprecated
### Removed
### Fixed
-Release task (#19)
### Security
## [0.10.0]
### Added
- Lazy readme properties

View File

@ -8,9 +8,6 @@ A primary plugin. When used with kotlin-jvm, kotlin-js or kotlin-mulitplatform c
## ru.mipt.npm.gradle.project
Root project tool including JetBrains changelog plugin an kotlin binary compatibility validator tool.
## ru.mipt.npm.gradle.publish
Enables publishing to maven-central, bintray, Space and github.
## ru.mipt.npm.gradle.mpp
`= kotlin("multiplatform") + ru.mipt.npm.gradle.common`

View File

@ -8,7 +8,7 @@ plugins {
}
group = "ru.mipt.npm"
version = "0.10.1"
version = "0.10.2"
description = "Build tools for DataForge and kscience projects"

View File

@ -2,9 +2,13 @@ package ru.mipt.npm.gradle.internal
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.tasks.Copy
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.getByName
import org.gradle.kotlin.dsl.maven
import org.gradle.language.jvm.tasks.ProcessResources
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.LanguageSettingsBuilder
internal fun LanguageSettingsBuilder.applySettings(): Unit {
@ -47,6 +51,32 @@ internal fun Copy.fromJsDependencies(configurationName: String) = project.run {
}
fun KotlinMultiplatformExtension.bundleJsBinaryAsResource(bundleName: String = "js/bundle.js"){
js {
binaries.executable()
browser {
webpackTask {
outputFileName = bundleName
}
}
}
jvm {
val processResourcesTaskName =
compilations[org.jetbrains.kotlin.gradle.plugin.KotlinCompilation.MAIN_COMPILATION_NAME]
.processResourcesTaskName
val jsBrowserDistribution = project.tasks.getByName("jsBrowserDistribution")
project.tasks.getByName<ProcessResources>(processResourcesTaskName) {
duplicatesStrategy = DuplicatesStrategy.WARN
dependsOn(jsBrowserDistribution)
from(jsBrowserDistribution)
}
}
}
//
//internal fun Copy.copyJVMResources(configuration: Configuration): Unit = project.afterEvaluate {
// val projectDeps = configuration.allDependencies