diff --git a/Interop/Runtime/src/main/kotlin/kotlinx/cinterop/Utils.kt b/Interop/Runtime/src/main/kotlin/kotlinx/cinterop/Utils.kt index a9fb3f83c04..2a9ff2b2b0d 100644 --- a/Interop/Runtime/src/main/kotlin/kotlinx/cinterop/Utils.kt +++ b/Interop/Runtime/src/main/kotlin/kotlinx/cinterop/Utils.kt @@ -321,22 +321,6 @@ fun cValuesOf(vararg elements: Int): CValues = fun cValuesOf(vararg elements: Long): CValues = createValues(elements.size) { index -> this.value = elements[index] } -@JvmName("cValuesOfUnsigned") -fun cValuesOf(vararg elements: UByte): CValues = - createValues(elements.size) { index -> this.value = elements[index] } - -@JvmName("cValuesOfUnsigned") -fun cValuesOf(vararg elements: UShort): CValues = - createValues(elements.size) { index -> this.value = elements[index] } - -@JvmName("cValuesOfUnsigned") -fun cValuesOf(vararg elements: UInt): CValues = - createValues(elements.size) { index -> this.value = elements[index] } - -@JvmName("cValuesOfUnsigned") -fun cValuesOf(vararg elements: ULong): CValues = - createValues(elements.size) { index -> this.value = elements[index] } - fun cValuesOf(vararg elements: Float): CValues = object : CValues() { override fun getPointer(scope: AutofreeScope) = scope.allocArrayOf(*elements) override val size get() = 4 * elements.size diff --git a/Interop/Runtime/src/native/kotlin/kotlinx/cinterop/NativeUtils.kt b/Interop/Runtime/src/native/kotlin/kotlinx/cinterop/NativeUtils.kt index 7b943f47ee3..0508f462ddd 100644 --- a/Interop/Runtime/src/native/kotlin/kotlinx/cinterop/NativeUtils.kt +++ b/Interop/Runtime/src/native/kotlin/kotlinx/cinterop/NativeUtils.kt @@ -47,4 +47,16 @@ external fun Number.narrow(): R @Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.FILE) @Retention(AnnotationRetention.SOURCE) -internal annotation class JvmName(val name: String) \ No newline at end of file +internal annotation class JvmName(val name: String) + +fun cValuesOf(vararg elements: UByte): CValues = + createValues(elements.size) { index -> this.value = elements[index] } + +fun cValuesOf(vararg elements: UShort): CValues = + createValues(elements.size) { index -> this.value = elements[index] } + +fun cValuesOf(vararg elements: UInt): CValues = + createValues(elements.size) { index -> this.value = elements[index] } + +fun cValuesOf(vararg elements: ULong): CValues = + createValues(elements.size) { index -> this.value = elements[index] } \ No newline at end of file diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index be8649f558f..e24c6b64f1d 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -65,27 +65,17 @@ project.convention.plugins.executor = ExecutorServiceKt.create(project) allprojects { // Root directories for test output (logs, compiled files, statistics etc). Only single path must be in each set. - sourceSets { - // backend.native/tests - testOutputLocal { - output.dir(rootProject.file("$testOutputRoot/local")) - } + // backend.native/tests + ext.testOutputLocal = rootProject.file("$testOutputRoot/local") - // backend.native/tests/external - testOutputExternal { - output.dir(rootProject.file("$testOutputRoot/external")) - } + // backend.native/tests/external + ext.testOutputExternal = rootProject.file("$testOutputRoot/external") - // backend.native/tests/stdlib_external - testOutputStdlib { - output.dir(rootProject.file("$testOutputRoot/stdlib")) - } + // backend.native/tests/stdlib_external + ext.testOutputStdlib = rootProject.file("$testOutputRoot/stdlib") - // backend.native/tests/framework - testOutputFramework { - output.dir(rootProject.file("$testOutputRoot/framework")) - } - } + // backend.native/tests/framework + ext.testOutputFramework = rootProject.file("$testOutputRoot/framework") } konanArtifacts { @@ -165,7 +155,7 @@ task resultsTask() { def output = ["statistics": statistics, "tests": results] def json = JsonOutput.toJson(output) - def reportFile = new File(sourceSets.testOutputExternal.output.getDirs().getSingleFile(), "results.json") + def reportFile = new File(testOutputExternal, "results.json") reportFile.write(JsonOutput.prettyPrint(json)) println("DONE.\n\n" + "TOTAL: $statistics.total\n" + @@ -2889,13 +2879,6 @@ task produce_dynamic(type: DynamicKonanTest) { "topLevel = 777 3\n" } -/** - * Get sourceSet's output path as a string - */ -static String outputPath(SourceSet set) { - return set.output.getDirs().getSingleFile().toString() -} - if (isMac() && project.testTarget != 'wasm32') { def target = ext.platformManager.targetByName(project.testTarget ?: 'host').name @@ -2904,7 +2887,7 @@ if (isMac() && project.testTarget != 'wasm32') { konanArtifacts { framework(frameworkName, targets: [ target ]) { srcDir 'framework/values' - baseDir outputPath(sourceSets.testOutputFramework) + "/$frameworkName" + baseDir "$testOutputFramework/$frameworkName" if (!useCustomDist) { dependsOn ":${target}CrossDistRuntime", ':commonDistRuntime', ':distCompiler' @@ -2919,7 +2902,7 @@ if (isMac() && project.testTarget != 'wasm32') { konanArtifacts { framework(frameworkName, targets: [ target ]) { srcDir 'framework/stdlib' - baseDir outputPath(sourceSets.testOutputFramework) + "/$frameworkName" + baseDir "$testOutputFramework/$frameworkName" if (!useCustomDist) { dependsOn ":${target}CrossDistRuntime", ':commonDistRuntime', ':distCompiler' diff --git a/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy b/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy index 60137a30447..d6816bc330e 100644 --- a/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy +++ b/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/KonanTest.groovy @@ -62,10 +62,9 @@ abstract class KonanTest extends JavaExec { if (outputDirectory != null) { return } - - def outputSourceSet = project.sourceSets.findByName(getOutputSourceSetName()) + def outputSourceSet = project.findProperty(getOutputSourceSetName()) if (outputSourceSet != null) { - outputDirectory = outputSourceSet.output.getDirs().getSingleFile().absolutePath + "/$name" + outputDirectory = outputSourceSet.absolutePath + "/$name" project.file(outputDirectory).mkdirs() } else { outputDirectory = getTemporaryDir().absolutePath @@ -338,9 +337,9 @@ abstract class ExtKonanTest extends KonanTest { return } - def outputSourceSet = project.sourceSets.findByName(getOutputSourceSetName()) + def outputSourceSet = project.findProperty(getOutputSourceSetName()) if (outputSourceSet != null) { - outputDirectory = outputSourceSet.output.getDirs().getSingleFile().absolutePath + outputDirectory = outputSourceSet.absolutePath project.file(outputDirectory).mkdirs() } else { outputDirectory = getTemporaryDir().absolutePath @@ -882,9 +881,9 @@ fun runTest() { @Override String buildExePath() { def outputDir - def outputSourceSet = project.sourceSets.findByName(getOutputSourceSetName()) + def outputSourceSet = project.findProperty(getOutputSourceSetName()) if (outputSourceSet != null) { - outputDir = outputSourceSet.output.getDirs().getSingleFile().absolutePath + "/$name" + outputDir = outputSourceSet.absolutePath+ "/$name" } else { outputDir = getTemporaryDir().absolutePath } diff --git a/gradle.properties b/gradle.properties index 37f87e0b77b..be580a5cc97 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,7 +15,7 @@ # # A version of the Kotlin "toolchain" (compiler, runtime, stdlib etc) used by the build script. -buildKotlinVersion=1.3-M1 +buildKotlinVersion=1.3-M2 buildKotlinCompilerRepo=http://dl.bintray.com/kotlin/kotlin-eap remoteRoot=konan_tests testDataVersion=1226829:id diff --git a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinNativePlatformPlugin.kt b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinNativePlatformPlugin.kt index f755f1ac2ab..6f366781caf 100644 --- a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinNativePlatformPlugin.kt +++ b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinNativePlatformPlugin.kt @@ -23,6 +23,14 @@ open class KotlinNativePlatformPlugin: KotlinPlatformImplementationPluginBase("n } } + internal fun Project.whenEvaluated(fn: Project.() -> T) { + if (state.executed) { + fn() + } else { + afterEvaluate { it.fn() } + } + } + protected fun addCommonProject(commonProject: Project, platformProject: Project) { commonProjects.add(commonProject) commonProject.whenEvaluated {