Update build version of Kotlin to 1.3-M2

Fix tests: replace source sets with properties
Fix interop: move cValuesOfUnsigned to native part
This commit is contained in:
Pavel Punegov
2018-08-31 09:14:47 +03:00
committed by Pavel Punegov
parent 97a423c781
commit 9972a57af6
6 changed files with 39 additions and 53 deletions
@@ -321,22 +321,6 @@ fun cValuesOf(vararg elements: Int): CValues<IntVar> =
fun cValuesOf(vararg elements: Long): CValues<LongVar> = fun cValuesOf(vararg elements: Long): CValues<LongVar> =
createValues(elements.size) { index -> this.value = elements[index] } createValues(elements.size) { index -> this.value = elements[index] }
@JvmName("cValuesOfUnsigned")
fun cValuesOf(vararg elements: UByte): CValues<UByteVar> =
createValues(elements.size) { index -> this.value = elements[index] }
@JvmName("cValuesOfUnsigned")
fun cValuesOf(vararg elements: UShort): CValues<UShortVar> =
createValues(elements.size) { index -> this.value = elements[index] }
@JvmName("cValuesOfUnsigned")
fun cValuesOf(vararg elements: UInt): CValues<UIntVar> =
createValues(elements.size) { index -> this.value = elements[index] }
@JvmName("cValuesOfUnsigned")
fun cValuesOf(vararg elements: ULong): CValues<ULongVar> =
createValues(elements.size) { index -> this.value = elements[index] }
fun cValuesOf(vararg elements: Float): CValues<FloatVar> = object : CValues<FloatVar>() { fun cValuesOf(vararg elements: Float): CValues<FloatVar> = object : CValues<FloatVar>() {
override fun getPointer(scope: AutofreeScope) = scope.allocArrayOf(*elements) override fun getPointer(scope: AutofreeScope) = scope.allocArrayOf(*elements)
override val size get() = 4 * elements.size override val size get() = 4 * elements.size
@@ -47,4 +47,16 @@ external fun <R : Number> Number.narrow(): R
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.FILE) @Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.FILE)
@Retention(AnnotationRetention.SOURCE) @Retention(AnnotationRetention.SOURCE)
internal annotation class JvmName(val name: String) internal annotation class JvmName(val name: String)
fun cValuesOf(vararg elements: UByte): CValues<UByteVar> =
createValues(elements.size) { index -> this.value = elements[index] }
fun cValuesOf(vararg elements: UShort): CValues<UShortVar> =
createValues(elements.size) { index -> this.value = elements[index] }
fun cValuesOf(vararg elements: UInt): CValues<UIntVar> =
createValues(elements.size) { index -> this.value = elements[index] }
fun cValuesOf(vararg elements: ULong): CValues<ULongVar> =
createValues(elements.size) { index -> this.value = elements[index] }
+11 -28
View File
@@ -65,27 +65,17 @@ project.convention.plugins.executor = ExecutorServiceKt.create(project)
allprojects { allprojects {
// Root directories for test output (logs, compiled files, statistics etc). Only single path must be in each set. // Root directories for test output (logs, compiled files, statistics etc). Only single path must be in each set.
sourceSets { // backend.native/tests
// backend.native/tests ext.testOutputLocal = rootProject.file("$testOutputRoot/local")
testOutputLocal {
output.dir(rootProject.file("$testOutputRoot/local"))
}
// backend.native/tests/external // backend.native/tests/external
testOutputExternal { ext.testOutputExternal = rootProject.file("$testOutputRoot/external")
output.dir(rootProject.file("$testOutputRoot/external"))
}
// backend.native/tests/stdlib_external // backend.native/tests/stdlib_external
testOutputStdlib { ext.testOutputStdlib = rootProject.file("$testOutputRoot/stdlib")
output.dir(rootProject.file("$testOutputRoot/stdlib"))
}
// backend.native/tests/framework // backend.native/tests/framework
testOutputFramework { ext.testOutputFramework = rootProject.file("$testOutputRoot/framework")
output.dir(rootProject.file("$testOutputRoot/framework"))
}
}
} }
konanArtifacts { konanArtifacts {
@@ -165,7 +155,7 @@ task resultsTask() {
def output = ["statistics": statistics, "tests": results] def output = ["statistics": statistics, "tests": results]
def json = JsonOutput.toJson(output) 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)) reportFile.write(JsonOutput.prettyPrint(json))
println("DONE.\n\n" + println("DONE.\n\n" +
"TOTAL: $statistics.total\n" + "TOTAL: $statistics.total\n" +
@@ -2889,13 +2879,6 @@ task produce_dynamic(type: DynamicKonanTest) {
"topLevel = 777 3\n" "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') { if (isMac() && project.testTarget != 'wasm32') {
def target = ext.platformManager.targetByName(project.testTarget ?: 'host').name def target = ext.platformManager.targetByName(project.testTarget ?: 'host').name
@@ -2904,7 +2887,7 @@ if (isMac() && project.testTarget != 'wasm32') {
konanArtifacts { konanArtifacts {
framework(frameworkName, targets: [ target ]) { framework(frameworkName, targets: [ target ]) {
srcDir 'framework/values' srcDir 'framework/values'
baseDir outputPath(sourceSets.testOutputFramework) + "/$frameworkName" baseDir "$testOutputFramework/$frameworkName"
if (!useCustomDist) { if (!useCustomDist) {
dependsOn ":${target}CrossDistRuntime", ':commonDistRuntime', ':distCompiler' dependsOn ":${target}CrossDistRuntime", ':commonDistRuntime', ':distCompiler'
@@ -2919,7 +2902,7 @@ if (isMac() && project.testTarget != 'wasm32') {
konanArtifacts { konanArtifacts {
framework(frameworkName, targets: [ target ]) { framework(frameworkName, targets: [ target ]) {
srcDir 'framework/stdlib' srcDir 'framework/stdlib'
baseDir outputPath(sourceSets.testOutputFramework) + "/$frameworkName" baseDir "$testOutputFramework/$frameworkName"
if (!useCustomDist) { if (!useCustomDist) {
dependsOn ":${target}CrossDistRuntime", ':commonDistRuntime', ':distCompiler' dependsOn ":${target}CrossDistRuntime", ':commonDistRuntime', ':distCompiler'
@@ -62,10 +62,9 @@ abstract class KonanTest extends JavaExec {
if (outputDirectory != null) { if (outputDirectory != null) {
return return
} }
def outputSourceSet = project.findProperty(getOutputSourceSetName())
def outputSourceSet = project.sourceSets.findByName(getOutputSourceSetName())
if (outputSourceSet != null) { if (outputSourceSet != null) {
outputDirectory = outputSourceSet.output.getDirs().getSingleFile().absolutePath + "/$name" outputDirectory = outputSourceSet.absolutePath + "/$name"
project.file(outputDirectory).mkdirs() project.file(outputDirectory).mkdirs()
} else { } else {
outputDirectory = getTemporaryDir().absolutePath outputDirectory = getTemporaryDir().absolutePath
@@ -338,9 +337,9 @@ abstract class ExtKonanTest extends KonanTest {
return return
} }
def outputSourceSet = project.sourceSets.findByName(getOutputSourceSetName()) def outputSourceSet = project.findProperty(getOutputSourceSetName())
if (outputSourceSet != null) { if (outputSourceSet != null) {
outputDirectory = outputSourceSet.output.getDirs().getSingleFile().absolutePath outputDirectory = outputSourceSet.absolutePath
project.file(outputDirectory).mkdirs() project.file(outputDirectory).mkdirs()
} else { } else {
outputDirectory = getTemporaryDir().absolutePath outputDirectory = getTemporaryDir().absolutePath
@@ -882,9 +881,9 @@ fun runTest() {
@Override @Override
String buildExePath() { String buildExePath() {
def outputDir def outputDir
def outputSourceSet = project.sourceSets.findByName(getOutputSourceSetName()) def outputSourceSet = project.findProperty(getOutputSourceSetName())
if (outputSourceSet != null) { if (outputSourceSet != null) {
outputDir = outputSourceSet.output.getDirs().getSingleFile().absolutePath + "/$name" outputDir = outputSourceSet.absolutePath+ "/$name"
} else { } else {
outputDir = getTemporaryDir().absolutePath outputDir = getTemporaryDir().absolutePath
} }
+1 -1
View File
@@ -15,7 +15,7 @@
# #
# A version of the Kotlin "toolchain" (compiler, runtime, stdlib etc) used by the build script. # 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 buildKotlinCompilerRepo=http://dl.bintray.com/kotlin/kotlin-eap
remoteRoot=konan_tests remoteRoot=konan_tests
testDataVersion=1226829:id testDataVersion=1226829:id
@@ -23,6 +23,14 @@ open class KotlinNativePlatformPlugin: KotlinPlatformImplementationPluginBase("n
} }
} }
internal fun <T> Project.whenEvaluated(fn: Project.() -> T) {
if (state.executed) {
fn()
} else {
afterEvaluate { it.fn() }
}
}
protected fun addCommonProject(commonProject: Project, platformProject: Project) { protected fun addCommonProject(commonProject: Project, platformProject: Project) {
commonProjects.add(commonProject) commonProjects.add(commonProject)
commonProject.whenEvaluated { commonProject.whenEvaluated {