Skip to content

Commit 769152f

Browse files
author
Patrick Jackson
committed
initial commit
0 parents  commit 769152f

File tree

12 files changed

+583
-0
lines changed

12 files changed

+583
-0
lines changed

.gitignore

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/libraries
5+
/.idea/modules.xml
6+
/.idea/workspace.xml
7+
/.idea
8+
.DS_Store
9+
/build
10+
/common/build
11+
/captures
12+
.externalNativeBuild
13+
14+
# Created by https://www.gitignore.io/api/swift,xcode
15+
16+
### Swift ###
17+
# Xcode
18+
#
19+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
20+
21+
## Build generated
22+
build/
23+
DerivedData/
24+
25+
26+
## Various settings
27+
*.pbxuser
28+
!default.pbxuser
29+
*.mode1v3
30+
!default.mode1v3
31+
*.mode2v3
32+
!default.mode2v3
33+
*.perspectivev3
34+
!default.perspectivev3
35+
xcuserdata/
36+
37+
## Other
38+
*.moved-aside
39+
*.xccheckout
40+
*.xcscmblueprint
41+
42+
## Obj-C/Swift specific
43+
*.hmap
44+
*.ipa
45+
*.dSYM.zip
46+
*.dSYM
47+
48+
## Playgrounds
49+
timeline.xctimeline
50+
playground.xcworkspace
51+
52+
# Swift Package Manager
53+
#
54+
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
55+
# Packages/
56+
# Package.pins
57+
.build/
58+
59+
# CocoaPods - Refactored to standalone file
60+
61+
# Carthage - Refactored to standalone file
62+
63+
# fastlane
64+
#
65+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
66+
# screenshots whenever they are needed.
67+
# For more information about the recommended setup visit:
68+
# https://docs.fastlane.tools/best-practices/source-control/#source-control
69+
70+
fastlane/report.xml
71+
fastlane/Preview.html
72+
fastlane/screenshots
73+
fastlane/test_output
74+
75+
### Xcode ###
76+
# Xcode
77+
#
78+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
79+
80+
## Build generated
81+
82+
## Various settings
83+
84+
## Other
85+
86+
87+
# End of https://www.gitignore.io/api/swift,xcode

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Function<*> is check bug
2+
3+
This is a reproducer of a bug in Kotlin as [reported in youtrack](https://youtrack.jetbrains.com/issue/KT-33149).
4+
5+
```kotlin
6+
class FunctionCheckTest {
7+
8+
@Test
9+
fun passIsCheck() {
10+
if ({ str: String -> } is Function<*>) {
11+
} else {
12+
fail("Function not recognized in `is Function<*>`")
13+
}
14+
}
15+
}
16+
```
17+
18+
To run:
19+
./gradlew jvmTest <---- passes
20+
./gradlew jsTest <---- fails
21+
22+
Originally thought this was a bug with typealias, however the bug exists with functions.
23+
24+
Behavior is not consistent between platforms. JVM passes. JS & Native fail.
25+
Only JS tests run on this project due to difficulty setting up tests. This has been observed to fail
26+
in the native environment.

build.gradle

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
buildscript {
2+
ext.kotlinVersion = "1.3.50"
3+
repositories {
4+
google()
5+
jcenter()
6+
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
7+
maven { url "https://kotlin.bintray.com/kotlinx" }
8+
maven { url 'https://dl.bintray.com/jetbrains/kotlin-native-dependencies' }
9+
}
10+
dependencies {
11+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
12+
classpath "com.github.ben-manes:gradle-versions-plugin:0.21.0"
13+
classpath "com.moowork.gradle:gradle-node-plugin:1.3.1"
14+
15+
// NOTE: Do not place your application dependencies here; they belong
16+
// in the individual module build.gradle files
17+
}
18+
}
19+
apply plugin: "com.github.ben-manes.versions"
20+
21+
allprojects {
22+
repositories {
23+
google()
24+
jcenter()
25+
mavenCentral()
26+
maven { url "https://jitpack.io" }
27+
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
28+
maven { url "https://kotlin.bintray.com/kotlinx" }
29+
}
30+
}
31+
32+
task clean(type: Delete) {
33+
delete rootProject.buildDir
34+
}

common/build.gradle

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
apply plugin: 'kotlin-multiplatform'
2+
apply plugin: 'com.moowork.node'
3+
4+
final kotlinRuntimeVersion = '1.3.50'
5+
6+
final nodeVersion = '11.2.0'
7+
final nodeWorkingDir = project.buildDir
8+
final nodeModules = "$nodeWorkingDir/node_modules"
9+
final mochaVersion = '5.2.0'
10+
final pathSeparator = System.properties["path.separator"]
11+
12+
kotlin {
13+
14+
targets {
15+
js()
16+
jvm()
17+
}
18+
sourceSets {
19+
commonMain {
20+
dependencies {
21+
api 'org.jetbrains.kotlin:kotlin-stdlib'
22+
}
23+
}
24+
commonTest {
25+
kotlin.srcDir('src/test/kotlin')
26+
dependencies {
27+
implementation "org.jetbrains.kotlin:kotlin-test-common"
28+
implementation "org.jetbrains.kotlin:kotlin-test-annotations-common"
29+
}
30+
}
31+
jvmMain {
32+
dependencies {
33+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
34+
}
35+
}
36+
jvmTest {
37+
dependencies {
38+
implementation 'org.jetbrains.kotlin:kotlin-test'
39+
implementation 'org.jetbrains.kotlin:kotlin-test-junit'
40+
}
41+
}
42+
jsTest {
43+
kotlin.srcDir('src/test/kotlin')
44+
45+
dependencies {
46+
implementation kotlin("test-js")
47+
implementation kotlin("stdlib-js")
48+
}
49+
}
50+
51+
}
52+
53+
}
54+
55+
// workaround for https://youtrack.jetbrains.com/issue/KT-27170
56+
configurations {
57+
compileClasspath
58+
}
59+
60+
//Workaround to copy kotlin libraries so they are visible during testing
61+
def jsLibDir = "$compileKotlinJs.destinationDir/lib"
62+
def jsTestLibDir = "$compileTestKotlinJs.destinationDir/lib"
63+
configurations {
64+
jsLibs
65+
jsTestLibs
66+
}
67+
dependencies {
68+
jsLibs "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlinRuntimeVersion"
69+
jsTestLibs "org.jetbrains.kotlin:kotlin-test-js:$kotlinRuntimeVersion"
70+
}
71+
task copyJsDependencies(type: Copy, dependsOn: compileKotlinJs) {
72+
configurations.jsLibs.each {
73+
from zipTree(it.absolutePath).matching { include '*.js'}
74+
}
75+
into jsLibDir
76+
}
77+
jsMainClasses.dependsOn copyJsDependencies
78+
task copyJsTestDependencies(type: Copy) {
79+
configurations.jsTestLibs.each {
80+
from zipTree(it.absolutePath).matching { include '*.js'}
81+
}
82+
into jsTestLibDir
83+
}
84+
jsTestClasses.dependsOn copyJsTestDependencies
85+
86+
//Use mocha to run js tests
87+
node {
88+
version = nodeVersion
89+
download = true
90+
workDir = file("$project.buildDir/nodejs")
91+
nodeModulesDir = file(nodeWorkingDir)
92+
}
93+
task installMocha(type: NpmTask, group: 'npm') {
94+
outputs.dir "$nodeModules/mocha"
95+
args = ['install', "mocha@$mochaVersion"]
96+
}
97+
task runMocha(type: NodeTask, dependsOn: [installMocha, jsMainClasses, jsTestClasses], group: 'npm') {
98+
environment = [ "NODE_PATH": "$jsLibDir$pathSeparator$jsTestLibDir$pathSeparator$compileKotlinJs.destinationDir" ]
99+
script = file("$nodeWorkingDir/node_modules/mocha/bin/mocha")
100+
args = [compileTestKotlinJs.outputFile]
101+
}
102+
jsTest.dependsOn runMocha
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package com.example.common
2+
3+
4+
val helloWordText = "Hello Kotlin MP"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import kotlin.test.Test
2+
import kotlin.test.fail
3+
4+
class FunctionCheckTest {
5+
6+
@Test
7+
fun passIsCheck() {
8+
if ({ str: String -> } is Function<*>) {
9+
} else {
10+
fail("Function not recognized in `is Function<*>`")
11+
}
12+
}
13+
}

gradle.properties

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Project-wide Gradle settings.
2+
# IDE (e.g. Android Studio) users:
3+
# Gradle settings configured through the IDE *will override*
4+
# any settings specified in this file.
5+
# For more details on how to configure your build environment visit
6+
# http://www.gradle.org/docs/current/userguide/build_environment.html
7+
# Specifies the JVM arguments used for the daemon process.
8+
# The setting is particularly useful for tweaking memory settings.
9+
org.gradle.jvmargs=-Xmx1536m
10+
# When configured, Gradle will run in incubating parallel mode.
11+
# This option should only be used with decoupled projects. More details, visit
12+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13+
# org.gradle.parallel=true
14+
# AndroidX package structure to make it clearer which packages are bundled with the
15+
# Android operating system, and which are packaged with your app's APK
16+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
17+
android.useAndroidX=true
18+
# Automatically convert third-party libraries to use AndroidX
19+
android.enableJetifier=true
20+
# Kotlin code style for this project: "official" or "obsolete":
21+
kotlin.code.style=official

gradle/wrapper/gradle-wrapper.jar

54.3 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Fri Aug 30 13:52:35 EDT 2019
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-rc-2-all.zip

0 commit comments

Comments
 (0)