-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #148 from Kotlin/version-0.14.4
Version 0.14.4
- Loading branch information
Showing
12 changed files
with
192 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
project.ext.registerInteropAsSourceSetOutput = { interop, sourceSet -> | ||
afterEvaluate { | ||
def cinteropTask = tasks.named(interop.interopProcessingTaskName) | ||
def cinteropKlib = cinteropTask.map { it.outputFile } | ||
def fakeCinteropCompilation = kotlin.targets["metadata"].compilations[sourceSet.name] | ||
def destination = fakeCinteropCompilation.compileKotlinTask.destinationDir | ||
|
||
def tempDir = "$buildDir/tmp/${sourceSet.name}UnpackedInteropKlib" | ||
|
||
def prepareKlibTaskProvider = tasks.register("prepare${sourceSet.name.capitalize()}InteropKlib", Sync) { | ||
from(files(zipTree(cinteropKlib).matching { | ||
exclude("targets/**", "default/targets/**") | ||
}).builtBy(cinteropTask)) | ||
|
||
into(tempDir) | ||
|
||
doLast { | ||
def manifest140 = file("$tempDir/default/manifest") | ||
def manifest1371 = file("$tempDir/manifest") | ||
def manifest = manifest140.exists() ? manifest140 : manifest1371 | ||
|
||
def lines = manifest.readLines() | ||
def modifiedLines = lines.collect { line -> | ||
line.startsWith("depends=") ? "depends=stdlib ${manifest == manifest140 ? 'org.jetbrains.kotlin.native.platform.posix' : 'posix'}" : | ||
line.startsWith("native_targets=") ? "native_targets=" : | ||
line | ||
} | ||
manifest.text = modifiedLines.join("\n") | ||
} | ||
} | ||
|
||
def copyCinteropTaskProvider = tasks.register("copy${sourceSet.name.capitalize()}CinteropKlib", Zip) { | ||
from(fileTree(tempDir).builtBy(prepareKlibTaskProvider)) | ||
destinationDirectory.set(destination) | ||
archiveFileName.set("${project.name}_${fakeCinteropCompilation.name}.klib") | ||
dependsOn cinteropTask | ||
} | ||
|
||
fakeCinteropCompilation.output.classesDirs.from(files().builtBy(copyCinteropTaskProvider)) | ||
|
||
kotlin.sourceSets.matching { | ||
def visited = new HashSet() | ||
def visit | ||
visit = { s -> if (visited.add(s)) s.dependsOn.each { visit(it) } } | ||
visit(it) | ||
sourceSet in visited | ||
}.all { | ||
project.dependencies.add(implementationMetadataConfigurationName, files(cinteropKlib)) | ||
} | ||
} | ||
} |
Oops, something went wrong.