Skip to content

Commit

Permalink
Replace deprecated konan.home with org.jetbrains.kotlin.native.home
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelPunegov committed Feb 13, 2019
1 parent 6e8a56f commit 9c3a133
Show file tree
Hide file tree
Showing 18 changed files with 33 additions and 29 deletions.
4 changes: 2 additions & 2 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ export KONAN_REPO=$PWD/../kotlin-native
# Run this once since it is costly, you can remove the `clean` task if not big changes were made from the last time you did this
pushd $KONAN_REPO && git pull && ./gradlew clean dependencies:update dist distPlatformLibs && popd

# In your project, you set have to the konan.home property, and include as composite the shared and gradle-plugin builds
./gradlew check -Pkonan.home=$KONAN_REPO/dist --include-build $KONAN_REPO/shared --include-build $KONAN_REPO/tools/kotlin-native-gradle-plugin
# In your project, you set have to the org.jetbrains.kotlin.native.home property, and include as composite the shared and gradle-plugin builds
./gradlew check -Porg.jetbrains.kotlin.native.home=$KONAN_REPO/dist --include-build $KONAN_REPO/shared --include-build $KONAN_REPO/tools/kotlin-native-gradle-plugin
```

</div>
Expand Down
4 changes: 2 additions & 2 deletions GRADLE_PLUGIN.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ apply plugin: 'org.jetbrains.kotlin.platform.native'
</div>

By default the plugin downloads the Kotlin/Native compiler during the first run. If you have already downloaded the compiler
manually you can specify the path to its root directory using `konan.home` project property (e.g. in `gradle.properties`).
manually you can specify the path to its root directory using `org.jetbrains.kotlin.native.home` project property (e.g. in `gradle.properties`).

<div class="sample" markdown="1" theme="idea" mode="groovy">

```groovy
konan.home=/home/user/kotlin-native-0.8
org.jetbrains.kotlin.native.home=/home/user/kotlin-native-0.8
```

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import org.jetbrains.kotlin.native.interop.gen.jvm.KotlinPlatform

class ToolConfig(userProvidedTargetName: String?, flavor: KotlinPlatform) {

private val konanHome = System.getProperty("konan.home")
private val konanHome = System.getProperty("org.jetbrains.kotlin.native.home")
private val distribution = customerDistribution(konanHome)
private val platformManager = PlatformManager(distribution)
private val targetManager = platformManager.targetManager(userProvidedTargetName)
Expand Down
6 changes: 3 additions & 3 deletions backend.native/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ task teamcityPublishStdLibSources {

// These files are built before the 'dist' is complete,
// so we provide custom values for
// konan.home, --runtime, -Djava.library.path etc
// org.jetbrains.kotlin.native.home, --runtime, -Djava.library.path etc

targetList.each { target ->
def konanJvmArgs = [*HostManager.regularJvmArgs,
"-Dkonan.home=${rootProject.projectDir}",
"-Dorg.jetbrains.kotlin.native.home=${rootProject.projectDir}",
"-Djava.library.path=${project.buildDir}/nativelibs/$hostName",
]

Expand Down Expand Up @@ -322,7 +322,7 @@ task debugCompiler(type: JavaExec) {
classpath = project.fileTree("${distDir.canonicalPath}/konan/lib/") {
include '*.jar'
}
jvmArgs "-Dkonan.home=${distDir.canonicalPath}",
jvmArgs "-Dorg.jetbrains.kotlin.native.home=${distDir.canonicalPath}",
"-Djava.library.path=${distDir.canonicalPath}/konan/nativelib"
enableAssertions = true
args = findProperty("konan.debug.args").toString().tokenize() ?: []
Expand Down
2 changes: 1 addition & 1 deletion backend.native/debugger-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test {

def dist = project.rootProject.file("dist").canonicalPath
systemProperties = [
'konan.home': dist,
'org.jetbrains.kotlin.native.home': dist,
'java.library.path': "$dist/konan/nativelib"
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import java.nio.file.Paths


object DistProperties {
private val dist: Path = Paths.get(requireProp("konan.home"))
private val dist: Path = Paths.get(requireProp("org.jetbrains.kotlin.native.home"))
private val konancDriver = if (HostManager.host.family == Family.MINGW) "konanc.bat" else "konanc"
val konanc: Path = dist.resolve("bin/$konancDriver")
val lldb: Path = Paths.get("lldb")
Expand Down
6 changes: 3 additions & 3 deletions backend.native/tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ buildscript {
dependencies {
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$gradlePluginVersion"
}
ext.useCustomDist = project.hasProperty("konan.home")
ext.useCustomDist = project.hasProperty("org.jetbrains.kotlin.native.home")
if (!useCustomDist) {
ext.setProperty("konan.home", distDir.absolutePath)
ext.setProperty("org.jetbrains.kotlin.native.home", distDir.absolutePath)
}
}

Expand Down Expand Up @@ -65,7 +65,7 @@ externalStdlibTestsDir.mkdirs()
ext.platformManager = project.rootProject.platformManager
ext.target = platformManager.targetManager(project.testTarget).target

ext.testLibraryDir = "${project.property("konan.home")}/klib/platform/${project.target.name}"
ext.testLibraryDir = "${project.property("org.jetbrains.kotlin.native.home")}/klib/platform/${project.target.name}"

// Add executor to run tests depending on a target
project.convention.plugins.executor = ExecutorServiceKt.create(project)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract class KonanTest extends JavaExec {
public String source
def platformManager = project.rootProject.platformManager
def target = platformManager.targetManager(project.testTarget).target
def dist = project.rootProject.file(project.findProperty("konan.home") ?: "dist")
def dist = project.rootProject.file(project.findProperty("org.jetbrains.kotlin.native.home") ?: "dist")
def dependenciesDir = project.rootProject.dependenciesDir
def konancDriver = project.isWindows() ? "konanc.bat" : "konanc"
def konanc = new File("${dist.canonicalPath}/bin/$konancDriver").absolutePath
Expand Down Expand Up @@ -100,7 +100,7 @@ abstract class KonanTest extends JavaExec {
classpath = project.fileTree("$dist.canonicalPath/konan/lib/") {
include '*.jar'
}
jvmArgs "-Dkonan.home=${dist.canonicalPath}", "-Xmx4G",
jvmArgs "-Dorg.jetbrains.kotlin.native.home=${dist.canonicalPath}", "-Xmx4G",
"-Djava.library.path=${dist.canonicalPath}/konan/nativelib"
enableAssertions = true
def sources = File.createTempFile(name,".lst")
Expand Down Expand Up @@ -521,8 +521,8 @@ class RunDriverKonanTest extends KonanTest {

RunDriverKonanTest() {
super()
// We don't build the compiler if a custom konan.home path is specified.
if (!project.hasProperty("konan.home")) {
// We don't build the compiler if a custom org.jetbrains.kotlin.native.home path is specified.
if (!project.hasProperty("org.jetbrains.kotlin.native.home")) {
dependsOn(project.rootProject.tasks['cross_dist'])
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class NamedNativeInteropConfig implements Named {
new File(project.findProject(":Interop:Indexer").buildDir, "nativelibs"),
new File(project.findProject(":Interop:Runtime").buildDir, "nativelibs")
).asPath
systemProperties "konan.home": project.rootProject.projectDir
systemProperties "org.jetbrains.kotlin.native.home": project.rootProject.projectDir
environment "LIBCLANG_DISABLE_CRASH_RECOVERY": "1"

outputs.dir generatedSrcDir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ open class KlibInstall: Exec() {

override fun configure(config: Closure<*>): Task {
val result = super.configure(config)
val konanHomePath = project.findProperty("konan.home") ?: "dist"
val konanHomePath = project.findProperty("org.jetbrains.kotlin.native.home") ?: "dist"
val konanHome = project.rootProject.file(konanHomePath)
val suffix = if (HostManager.host == KonanTarget.MINGW_X64) ".bat" else ""
val klibProgram = "$konanHome/bin/klib$suffix"
Expand Down
2 changes: 1 addition & 1 deletion cmd/run_konan
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ java_opts=(-ea \
-Xmx3G \
-XX:TieredStopAtLevel=1 \
"-Djava.library.path=${NATIVE_LIB}" \
"-Dkonan.home=${KONAN_HOME}" \
"-Dorg.jetbrains.kotlin.native.home=${KONAN_HOME}" \
-Dfile.encoding=UTF-8 \
${JAVA_OPTS})

Expand Down
2 changes: 1 addition & 1 deletion cmd/run_konan.bat
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ set JAVA_OPTS=-ea ^
-Xmx3G ^
-XX:TieredStopAtLevel=1 ^
"-Djava.library.path=%NATIVE_LIB%" ^
"-Dkonan.home=%_KONAN_HOME%" ^
"-Dorg.jetbrains.kotlin.native.home=%_KONAN_HOME%" ^
-Dfile.encoding=UTF-8 ^
%JAVA_OPTS%

Expand Down
8 changes: 4 additions & 4 deletions klib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ buildscript {
classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:$gradlePluginVersion"
}

ext.useCustomDist = project.hasProperty("konan.home")
ext.useCustomDist = project.hasProperty("org.jetbrains.kotlin.native.home")
if (!useCustomDist) {
ext.setProperty("konan.home", distDir.absolutePath)
ext.setProperty("org.jetbrains.kotlin.native.home", distDir.absolutePath)
}
}

Expand Down Expand Up @@ -50,11 +50,11 @@ dependencies {

test {
dependsOn 'cleanTest'
systemProperty('konan.home', getProperty("konan.home"))
systemProperty('org.jetbrains.kotlin.native.home', getProperty("org.jetbrains.kotlin.native.home"))
dependsOn konanArtifacts.collect { it.getByTarget('host') }
if (useCustomDist) {
// Use the klib utility from the distribution
def distClasspath = fileTree("${project.getProperty("konan.home")}/konan/lib") {
def distClasspath = fileTree("${project.getProperty("org.jetbrains.kotlin.native.home")}/konan/lib") {
include "**/*.jar"
}
classpath = distClasspath + sourceSets.test.runtimeClasspath - sourceSets.main.runtimeClasspath
Expand Down
2 changes: 1 addition & 1 deletion platformLibs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ buildscript {
ext.konanHome = distDir.absolutePath
def jvmArguments = [project.findProperty("platformLibsJvmArgs") ?: "-Xmx6G", *HostManager.defaultJvmArgs]
ext.jvmArgs = jvmArguments.join(" ")
ext.setProperty("konan.home", konanHome)
ext.setProperty("org.jetbrains.kotlin.native.home", konanHome)
ext.setProperty("konan.jvmArgs", jvmArgs)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Distribution(
private fun findKonanHome(): String {
if (konanHomeOverride != null) return konanHomeOverride

val value = System.getProperty("konan.home", "dist")
val value = System.getProperty("org.jetbrains.kotlin.native.home", "dist")
val path = File(value).absolutePath
return path
}
Expand Down
4 changes: 4 additions & 0 deletions tools/kotlin-native-gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,13 @@ test {
systemProperty("kotlin.repo", kotlinCompilerRepo)
if (project.hasProperty("konan.home")) {
systemProperty("konan.home", project.property("konan.home"))
systemProperty("org.jetbrains.kotlin.native.home", project.property("konan.home"))
} else if (project.hasProperty("org.jetbrains.kotlin.native.home")) {
systemProperty("org.jetbrains.kotlin.native.home", project.property("org.jetbrains.kotlin.native.home"))
} else {
// The Koltin/Native compiler must be built before test execution.
systemProperty("konan.home", distDir.absolutePath)
systemProperty("org.jetbrains.kotlin.native.home", distDir.absolutePath)
}
if (project.hasProperty("konan.jvmArgs")) {
systemProperty("konan.jvmArgs", project.property("konan.jvmArgs"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ internal abstract class KonanCliRunner(
}

override val additionalSystemProperties = mutableMapOf(
"konan.home" to project.konanHome,
"org.jetbrains.kotlin.native.home" to project.konanHome,
"java.library.path" to "${project.konanHome}/konan/nativelib"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class KonanProject {
this.targets = targets
projectPath = projectDir.toPath()
konanBuildDir = projectPath.resolve('build/konan').toFile()
def konanHome = System.getProperty("konan.home")
def konanHome = System.getProperty("konan.home") ?: System.getProperty("org.jetbrains.kotlin.native.home")
if (konanHome == null) {
throw new IllegalStateException("konan.home isn't specified")
}
Expand Down

0 comments on commit 9c3a133

Please sign in to comment.