diff --git a/README.md b/README.md index f72a408d87e..cb40c78c55d 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ without the need to ship an additional execution runtime. Prerequisites: * install JDK for your platform, instead of JRE. The build requires ```tools.jar```, which is not included in JRE; -* on macOS install Xcode 10.1 +* on macOS install Xcode 10.2 * on Fedora 26+ ```yum install ncurses-compat-libs``` may be needed To compile from sources use following steps: diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt b/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt index d7efb99d17e..c32f144e059 100644 --- a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt +++ b/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/ExecutorService.kt @@ -128,6 +128,19 @@ fun runProcess(executor: (Action) -> ExecResult?, fun runProcess(executor: (Action) -> ExecResult?, executable: String, vararg args: String) = runProcess(executor, executable, args.toList()) +/** + * Creates a new executor service with additional action [actionParameter] executed after the main one. + * The following is an example how to pass an environment parameter + * @code `executor.add(Action { it.environment = mapOf("JAVA_OPTS" to "-verbose:gc") })::execute` + */ +fun ExecutorService.add(actionParameter: Action) = object : ExecutorService { + override fun execute(action: Action): ExecResult? = + this@add.execute(Action { + action.execute(it) + actionParameter.execute(it) + }) +} + /** * Returns Project's process executor * @see Project.exec diff --git a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/FrameworkTest.kt b/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/FrameworkTest.kt index e8e22d49519..14e3b81551c 100644 --- a/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/FrameworkTest.kt +++ b/buildSrc/plugins/src/main/kotlin/org/jetbrains/kotlin/FrameworkTest.kt @@ -85,9 +85,20 @@ open class FrameworkTest : DefaultTask() { } private fun runTest(testExecutable: Path) { + val target = project.testTarget() + val platform = project.platformManager().platform(target) + val configs = platform.configurables as AppleConfigurables + val swiftPlatform = when (target) { + KonanTarget.IOS_X64 -> "iphonesimulator" + KonanTarget.IOS_ARM32, KonanTarget.IOS_ARM64 -> "iphoneos" + KonanTarget.MACOS_X64 -> "macosx" + else -> throw IllegalStateException("Test target $target is not supported") + } + val libraryPath = configs.absoluteTargetToolchain + "/usr/lib/swift/$swiftPlatform" val executor = (project.convention.plugins["executor"] as? ExecutorService) ?: throw RuntimeException("Executor wasn't found") - val (stdOut, stdErr, exitCode) = runProcess(executor = executor::execute, + val (stdOut, stdErr, exitCode) = runProcess( + executor = executor.add(Action { it.environment = mapOf("DYLD_LIBRARY_PATH" to libraryPath) })::execute, executable = testExecutable.toString()) println(""" diff --git a/gradle.properties b/gradle.properties index 5c6a516f9fd..e887026d921 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,8 +21,9 @@ remoteRoot=konan_tests kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_dev_CompilerAllPlugins),number:1.3.40-dev-937,branch:default:true,pinned:true/artifacts/content/maven kotlinVersion=1.3.40-dev-937 testKotlinVersion=1.3.40-dev-937 -sharedRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinNativeShared_BuildAndTest),number:1.0-dev-16,branch:default:true,pinned:true/artifacts/content/maven -sharedVersion=1.0-dev-16 +# See https://teamcity.jetbrains.com/viewType.html?buildTypeId=Kotlin_KotlinNativeShared_BuildAndTest. +sharedRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinNativeShared_BuildAndTest),number:1.0-dev-23,branch:default:true,pinned:true/artifacts/content/maven +sharedVersion=1.0-dev-23 konanVersion=1.3.0 org.gradle.jvmargs='-Dfile.encoding=UTF-8' org.gradle.workers.max=4 diff --git a/konan/konan.properties b/konan/konan.properties index 842618a8d20..a4808678fe3 100644 --- a/konan/konan.properties +++ b/konan/konan.properties @@ -25,6 +25,8 @@ dependencyProfiles = default alt airplaneMode = false # if true, ignores Xcode version check. ignoreXcodeVersionCheck = false +# Disabled until decided better mechanism. +# useFixedXcodeVersion = 10.2 downloadingAttempts = 10 downloadingAttemptIntervalMs = 3000 @@ -35,11 +37,11 @@ llvmVersion = 6.0.1 # Mac OS X. llvmHome.macos_x64 = clang-llvm-6.0.1-darwin-macos -targetToolchain.macos_x64 = target-toolchain-8-macos_x64 +targetToolchain.macos_x64 = target-toolchain-9-macos_x64 libffiDir.macos_x64 = libffi-3.2.1-3-darwin-macos arch.macos_x64 = x86_64 -targetSysRoot.macos_x64 = target-sysroot-8-macos_x64 +targetSysRoot.macos_x64 = target-sysroot-9-macos_x64 llvmLtoFlags.macos_x64 = llvmLtoOptFlags.macos_x64 = -O3 -function-sections llvmLtoNooptFlags.macos_x64 = -O1 @@ -56,25 +58,25 @@ dependencies.macos_x64 = \ libffi-3.2.1-3-darwin-macos \ clang-llvm-6.0.1-darwin-macos -target-sysroot-8-macos_x64.default = \ +target-sysroot-9-macos_x64.default = \ remote:internal -target-toolchain-8-macos_x64.default = \ +target-toolchain-9-macos_x64.default = \ remote:internal # Apple's 32-bit iOS. -targetToolchain.macos_x64-ios_arm32 = target-toolchain-8-macos_x64 +targetToolchain.macos_x64-ios_arm32 = target-toolchain-9-macos_x64 dependencies.macos_x64-ios_arm32 = \ libffi-3.2.1-3-darwin-macos \ clang-llvm-6.0.1-darwin-macos -target-sysroot-8-ios_arm32.default = \ +target-sysroot-9-ios_arm32.default = \ remote:internal arch.ios_arm32 = armv7 entrySelector.ios_arm32 = -alias _Konan_main _main # Shared with 64-bit version. -targetSysRoot.ios_arm32 = target-sysroot-8-ios_arm64 +targetSysRoot.ios_arm32 = target-sysroot-9-ios_arm64 llvmLtoFlags.ios_arm32 = llvmLtoOptFlags.ios_arm32 = -O3 -function-sections linkerNoDebugFlags.ios_arm32 = -S @@ -88,17 +90,17 @@ osVersionMinFlagClang.ios_arm32 = -miphoneos-version-min osVersionMin.ios_arm32 = 9.0 # Apple's 64-bit iOS. -targetToolchain.macos_x64-ios_arm64 = target-toolchain-8-macos_x64 +targetToolchain.macos_x64-ios_arm64 = target-toolchain-9-macos_x64 dependencies.macos_x64-ios_arm64 = \ libffi-3.2.1-3-darwin-macos \ clang-llvm-6.0.1-darwin-macos -target-sysroot-8-ios_arm64.default = \ +target-sysroot-9-ios_arm64.default = \ remote:internal arch.ios_arm64 = arm64 entrySelector.ios_arm64 = -alias _Konan_main _main -targetSysRoot.ios_arm64 = target-sysroot-8-ios_arm64 +targetSysRoot.ios_arm64 = target-sysroot-9-ios_arm64 llvmLtoFlags.ios_arm64 = llvmLtoOptFlags.ios_arm64 = -O3 -function-sections linkerNoDebugFlags.ios_arm64 = -S @@ -112,17 +114,17 @@ osVersionMinFlagClang.ios_arm64 = -miphoneos-version-min osVersionMin.ios_arm64 = 9.0 # Apple's iOS simulator. -targetToolchain.macos_x64-ios_x64 = target-toolchain-8-macos_x64 +targetToolchain.macos_x64-ios_x64 = target-toolchain-9-macos_x64 dependencies.macos_x64-ios_x64 = \ libffi-3.2.1-3-darwin-macos \ clang-llvm-6.0.1-darwin-macos -target-sysroot-8-ios_x64.default = \ +target-sysroot-9-ios_x64.default = \ remote:internal arch.ios_x64 = x86_64 entrySelector.ios_x64 = -alias _Konan_main _main -targetSysRoot.ios_x64 = target-sysroot-8-ios_x64 +targetSysRoot.ios_x64 = target-sysroot-9-ios_x64 llvmLtoFlags.ios_x64 = llvmLtoOptFlags.ios_x64 = -O3 -function-sections llvmLtoNooptFlags.ios_x64 = -O1 diff --git a/tools/scripts/update_xcode.sh b/tools/scripts/update_xcode.sh index 80d460b6dbc..886096badaf 100755 --- a/tools/scripts/update_xcode.sh +++ b/tools/scripts/update_xcode.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash -KONAN_TOOLCHAIN_VERSION=8 +# "brew install coreutils" for grealpath. +KONAN_TOOLCHAIN_VERSION=9 SDKS="macosx iphoneos iphonesimulator" TARBALL_macosx=target-sysroot-$KONAN_TOOLCHAIN_VERSION-macos_x64 TARBALL_iphoneos=target-sysroot-$KONAN_TOOLCHAIN_VERSION-ios_arm64