SpotiFlyer/fuzzywuzzy/app/build.gradle
2021-03-18 23:41:45 +05:30

216 lines
6.7 KiB
Groovy

apply plugin: 'java'
apply plugin: 'kotlin-multiplatform'
apply plugin: 'com.moowork.node'
archivesBaseName = 'fuzzywuzzy-kotlin'
group 'com.willowtreeapps'
version '0.1.1'
final nodeVersion = '11.2.0'
final nodeWorkingDir = project.buildDir
final nodeModules = "$nodeWorkingDir/node_modules"
final mochaVersion = '5.2.0'
final pathSeparator = System.properties["path.separator"]
kotlin {
jvm()
js() {
browser()
[compileKotlinJs, compileTestKotlinJs].each { configuration ->
configuration.kotlinOptions {
moduleKind = 'umd'
sourceMap = true
metaInfo = true
}
}
}
/*
wasm32("wasm")
iosArm64("ios")
iosX64("iosSim")
macosX64("macos")
mingwX64("win")
linuxArm32Hfp("linArm32")
linuxMips32("linMips32")
linuxMipsel32("linMipsel32")
linuxX64("lin64")
*/
sourceSets {
commonMain {
dependencies {
implementation kotlin("stdlib-common")
}
}
jvmMain {
kotlin.srcDir('src/jvmMain/kotlin')
dependencies {
implementation kotlin("stdlib")
}
}
jsMain {
kotlin.srcDir('src/jsMain/kotlin')
dependencies {
implementation kotlin("stdlib-js")
}
compileKotlinJs {
kotlinOptions.metaInfo = true
kotlinOptions.sourceMap = true
kotlinOptions.suppressWarnings = true
kotlinOptions.verbose = true
kotlinOptions.main = "call"
kotlinOptions.moduleKind = "umd"
}
}
/*
commonTest {
kotlin.srcDir('src/test')
dependencies {
implementation kotlin("test-common")
implementation kotlin("test-annotations-common")
}
}
jsTest {
dependencies {
implementation kotlin("test-js")
implementation kotlin("stdlib-js")
}
}
jvmTest {
dependencies {
implementation kotlin("test")
implementation kotlin("test-junit")
implementation 'junit:junit:4.13.2'
}
}
*/
/*nativeMain {
kotlin.srcDir('src/nativeMain/kotlin')
}*/
//iosSimMain.dependsOn iosMain
//iosSimTest.dependsOn iosTest
/*configure([targets.ios, targets.iosSim, targets.macos, targets.win, targets.linArm32, targets.linMips32, targets.linMipsel32, targets.lin64]) {
compilations.main.source(sourceSets.nativeMain)
}*/
}
}
/*
* * Copyright (c) 2021 Shabinder Singh
* * This program is free software: you can redistribute it and/or modify
* * it under the terms of the GNU General Public License as published by
* * the Free Software Foundation, either version 3 of the License, or
* * (at your option) any later version.
* *
* * This program is distributed in the hope that it will be useful,
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* * GNU General Public License for more details.
* *
* * You should have received a copy of the GNU General Public License
* * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
//Workaround to copy kotlin libraries so they are visible during testing
//def jsLibDir = "$compileKotlinJs.destinationDir/lib"
//def jsTestLibDir = "$compileTestKotlinJs.destinationDir/lib"
//uncomment below to test JS. This conflicts with iOS config
/*
configurations {
jsLibs
jsTestLibs
}
dependencies {
jsLibs "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlinRuntimeVersion"
jsTestLibs "org.jetbrains.kotlin:kotlin-test-js:$kotlinRuntimeVersion"
}
task copyJsDependencies(type: Copy, dependsOn: compileKotlinJs) {
configurations.jsLibs.each {
from zipTree(it.absolutePath).matching { include '*.js'}
}
into jsLibDir
}
jsMainClasses.dependsOn copyJsDependencies
task copyJsTestDependencies(type: Copy) {
configurations.jsTestLibs.each {
from zipTree(it.absolutePath).matching { include '*.js'}
}
into jsTestLibDir
}
jsTestClasses.dependsOn copyJsTestDependencies
*/
/*
node {
version = nodeVersion
download = true
workDir = file("$project.buildDir/nodejs")
nodeModulesDir = file(nodeWorkingDir)
}
task installMocha(type: NpmTask, group: 'npm') {
outputs.dir "$nodeModules/mocha"
args = ['install', "mocha@$mochaVersion"]
}
task runMocha(type: NodeTask, dependsOn: [installMocha, jsMainClasses, jsTestClasses], group: 'npm') {
environment = ["NODE_PATH": "$jsLibDir$pathSeparator$jsTestLibDir$pathSeparator$compileKotlinJs.destinationDir"]
script = file("$nodeWorkingDir/node_modules/mocha/bin/mocha")
args = [compileTestKotlinJs.outputFile]
}
//Use mocha to run js tests
jsTest.dependsOn runMocha
task iosTest(dependsOn: 'linkTestDebugExecutableIosSim') {
doLast {
def binary = kotlin.targets.iosSim.compilations.test.getBinary('EXECUTABLE', 'DEBUG')
exec {
commandLine 'xcrun', 'simctl', 'spawn', "iPhone XR", binary.absolutePath
}
}
}
tasks.check.dependsOn iosTest
// workaround for https://youtrack.jetbrains.com/issue/KT-27170
//configurations {
// compileClasspath
//}
afterEvaluate {
// Alias the task names we use elsewhere to the new task names.
tasks.create('installMP').dependsOn('publishKotlinMultiplatformPublicationToMavenLocal')
tasks.create('installLocally') {
dependsOn 'publishKotlinMultiplatformPublicationToTestRepository'
dependsOn 'publishJvmPublicationToTestRepository'
dependsOn 'publishJsPublicationToTestRepository'
dependsOn 'publishMetadataPublicationToTestRepository'
}
tasks.create('installIosLocally') {
dependsOn 'publishKotlinMultiplatformPublicationToTestRepository'
dependsOn 'publishIosArm32PublicationToTestRepository'
dependsOn 'publishIosArm64PublicationToTestRepository'
dependsOn 'publishIosX64PublicationToTestRepository'
dependsOn 'publishMetadataPublicationToTestRepository'
}
// NOTE: We do not alias uploadArchives because CI runs it on Linux and we only want to run it on Mac OS.
//tasks.create('uploadArchives').dependsOn('publishKotlinMultiplatformPublicationToMavenRepository')
}
apply from: rootProject.file('fuzzywuzzy/gradle/publish.gradle')
publishing {
publications.all {
// Rewrite all artifacts from using the project name to just 'runtime'.
artifactId = artifactId.replace(project.name, 'fuzzywuzzy-kotlin')
}
}
*/