mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-29 19:57:53 +01:00
198 lines
5.9 KiB
Groovy
198 lines
5.9 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() {
|
|
[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")
|
|
}
|
|
}
|
|
commonTest {
|
|
kotlin.srcDir('src/test')
|
|
dependencies {
|
|
implementation kotlin("test-common")
|
|
implementation kotlin("test-annotations-common")
|
|
}
|
|
}
|
|
|
|
jvmMain {
|
|
kotlin.srcDir('src/jvmMain/kotlin')
|
|
dependencies {
|
|
implementation kotlin("stdlib")
|
|
}
|
|
}
|
|
jvmTest {
|
|
dependencies {
|
|
implementation kotlin("test")
|
|
implementation kotlin("test-junit")
|
|
implementation 'junit:junit:4.12'
|
|
}
|
|
}
|
|
/*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"
|
|
}
|
|
}
|
|
jsTest {
|
|
dependencies {
|
|
implementation kotlin("test-js")
|
|
implementation kotlin("stdlib-js")
|
|
}
|
|
}*/
|
|
/*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)
|
|
}*/
|
|
}
|
|
}
|
|
|
|
//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')
|
|
}
|
|
}
|
|
*/
|
|
|