SpotiFlyer/fuzzywuzzy/app/build.gradle

216 lines
6.7 KiB
Groovy
Raw Normal View History

2021-01-30 15:10:31 +01:00
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()
2021-01-30 15:10:31 +01:00
[compileKotlinJs, compileTestKotlinJs].each { configuration ->
configuration.kotlinOptions {
moduleKind = 'umd'
sourceMap = true
metaInfo = true
}
}
}
2021-01-30 15:10:31 +01:00
2021-01-30 17:50:04 +01:00
/*
wasm32("wasm")
2021-01-30 15:10:31 +01:00
iosArm64("ios")
iosX64("iosSim")
macosX64("macos")
mingwX64("win")
linuxArm32Hfp("linArm32")
linuxMips32("linMips32")
linuxMipsel32("linMipsel32")
linuxX64("lin64")
2021-01-30 17:50:04 +01:00
*/
2021-01-30 15:10:31 +01:00
sourceSets {
commonMain {
dependencies {
implementation kotlin("stdlib-common")
}
}
jvmMain {
kotlin.srcDir('src/jvmMain/kotlin')
dependencies {
implementation kotlin("stdlib")
}
}
jsMain {
2021-01-30 15:10:31 +01:00
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"
}
}
2021-03-18 01:59:29 +01:00
/*
commonTest {
kotlin.srcDir('src/test')
dependencies {
implementation kotlin("test-common")
implementation kotlin("test-annotations-common")
}
}
jsTest {
2021-01-30 15:10:31 +01:00
dependencies {
implementation kotlin("test-js")
implementation kotlin("stdlib-js")
}
2021-03-18 01:59:29 +01:00
}
jvmTest {
dependencies {
implementation kotlin("test")
implementation kotlin("test-junit")
implementation 'junit:junit:4.13.2'
}
}
*/
2021-01-30 17:50:04 +01:00
/*nativeMain {
2021-01-30 15:10:31 +01:00
kotlin.srcDir('src/nativeMain/kotlin')
2021-01-30 17:50:04 +01:00
}*/
2021-01-30 15:10:31 +01:00
2021-01-30 17:50:04 +01:00
//iosSimMain.dependsOn iosMain
//iosSimTest.dependsOn iosTest
2021-01-30 15:10:31 +01:00
2021-01-30 17:50:04 +01:00
/*configure([targets.ios, targets.iosSim, targets.macos, targets.win, targets.linArm32, targets.linMips32, targets.linMipsel32, targets.lin64]) {
2021-01-30 15:10:31 +01:00
compilations.main.source(sourceSets.nativeMain)
2021-01-30 17:50:04 +01:00
}*/
2021-01-30 15:10:31 +01:00
}
}
2021-03-18 19:11:45 +01:00
/*
* * 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/>.
*/
2021-01-30 15:10:31 +01:00
//Workaround to copy kotlin libraries so they are visible during testing
//def jsLibDir = "$compileKotlinJs.destinationDir/lib"
//def jsTestLibDir = "$compileTestKotlinJs.destinationDir/lib"
2021-01-30 15:10:31 +01:00
//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
*/
/*
2021-01-30 15:10:31 +01:00
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')
}
}
*/
2021-01-30 15:10:31 +01:00