Build: Rename File helper for creating file from pathes list to fileFrom
This commit is contained in:
+1
-1
@@ -680,7 +680,7 @@ tasks.create("findShadowJarsInClasspath").doLast {
|
|||||||
for (task in project.tasks) {
|
for (task in project.tasks) {
|
||||||
when (task) {
|
when (task) {
|
||||||
is ShadowJar -> {
|
is ShadowJar -> {
|
||||||
shadowJars.add(File(task.archivePath))
|
shadowJars.add(fileFrom(task.archivePath))
|
||||||
}
|
}
|
||||||
is ProGuardTask -> {
|
is ProGuardTask -> {
|
||||||
shadowJars.addAll(task.outputs.files.toList())
|
shadowJars.addAll(task.outputs.files.toList())
|
||||||
|
|||||||
@@ -679,7 +679,7 @@ tasks.create("findShadowJarsInClasspath").doLast {
|
|||||||
for (task in project.tasks) {
|
for (task in project.tasks) {
|
||||||
when (task) {
|
when (task) {
|
||||||
is ShadowJar -> {
|
is ShadowJar -> {
|
||||||
shadowJars.add(File(task.archivePath))
|
shadowJars.add(fileFrom(task.archivePath))
|
||||||
}
|
}
|
||||||
is ProGuardTask -> {
|
is ProGuardTask -> {
|
||||||
shadowJars.addAll(task.outputs.files.toList())
|
shadowJars.addAll(task.outputs.files.toList())
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import org.gradle.api.Project
|
|||||||
import org.gradle.api.artifacts.dsl.RepositoryHandler
|
import org.gradle.api.artifacts.dsl.RepositoryHandler
|
||||||
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
|
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
|
||||||
import org.gradle.kotlin.dsl.extra
|
import org.gradle.kotlin.dsl.extra
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
fun RepositoryHandler.androidDxJarRepo(project: Project): IvyArtifactRepository = ivy {
|
fun RepositoryHandler.androidDxJarRepo(project: Project): IvyArtifactRepository = ivy {
|
||||||
val baseDir = File("${project.rootDir}/buildSrc/prepare-deps/android-dx/build/repo")
|
val baseDir = File("${project.rootDir}/buildSrc/prepare-deps/android-dx/build/repo")
|
||||||
|
|||||||
@@ -42,8 +42,9 @@ fun Project.getResourceFiles(): SourceDirectorySet? = withJavaPlugin {
|
|||||||
javaPluginConvention().sourceSets.getByName("main").resources
|
javaPluginConvention().sourceSets.getByName("main").resources
|
||||||
}
|
}
|
||||||
|
|
||||||
fun File(root: File, vararg children: String): File = children.fold(root, { f, c -> File(f, c) })
|
fun fileFrom(root: File, vararg children: String): File = children.fold(root) { f, c -> File(f, c) }
|
||||||
fun File(root: String, vararg children: String): File = children.fold(File(root), { f, c -> File(f, c) })
|
|
||||||
|
fun fileFrom(root: String, vararg children: String): File = children.fold(File(root)) { f, c -> File(f, c) }
|
||||||
|
|
||||||
var Project.jvmTarget: String?
|
var Project.jvmTarget: String?
|
||||||
get() = extra.takeIf { it.has("jvmTarget") }?.get("jvmTarget") as? String
|
get() = extra.takeIf { it.has("jvmTarget") }?.get("jvmTarget") as? String
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ fun Project.preloadedDeps(vararg artifactBaseNames: String, baseDir: File = File
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Project.ideaUltimatePreloadedDeps(vararg artifactBaseNames: String, subdir: String? = null): ConfigurableFileCollection {
|
fun Project.ideaUltimatePreloadedDeps(vararg artifactBaseNames: String, subdir: String? = null): ConfigurableFileCollection {
|
||||||
val ultimateDepsDir = File(rootDir, "ultimate", "dependencies")
|
val ultimateDepsDir = fileFrom(rootDir, "ultimate", "dependencies")
|
||||||
return if (ultimateDepsDir.isDirectory) preloadedDeps(*artifactBaseNames, baseDir = ultimateDepsDir, subdir = subdir)
|
return if (ultimateDepsDir.isDirectory) preloadedDeps(*artifactBaseNames, baseDir = ultimateDepsDir, subdir = subdir)
|
||||||
else files()
|
else files()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import org.gradle.api.file.DuplicatesStrategy
|
|||||||
import org.gradle.jvm.tasks.Jar
|
import org.gradle.jvm.tasks.Jar
|
||||||
import org.gradle.kotlin.dsl.task
|
import org.gradle.kotlin.dsl.task
|
||||||
import org.gradle.kotlin.dsl.*
|
import org.gradle.kotlin.dsl.*
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
|
val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ fun MutableCollection<JdkId>.discoverJdksOnUnix(project: Project) {
|
|||||||
val installedJdks = File(loc).listFiles { dir ->
|
val installedJdks = File(loc).listFiles { dir ->
|
||||||
dir.isDirectory &&
|
dir.isDirectory &&
|
||||||
unixConventionalJdkDirRex.containsMatchIn(dir.name) &&
|
unixConventionalJdkDirRex.containsMatchIn(dir.name) &&
|
||||||
File(dir, "bin", "java").isFile
|
fileFrom(dir, "bin", "java").isFile
|
||||||
} ?: continue
|
} ?: continue
|
||||||
for (dir in installedJdks) {
|
for (dir in installedJdks) {
|
||||||
val versionMatch = javaVersionRegex.find(dir.name)
|
val versionMatch = javaVersionRegex.find(dir.name)
|
||||||
@@ -172,7 +172,7 @@ fun MutableCollection<JdkId>.discoverJdksOnWindows(project: Project) {
|
|||||||
else {
|
else {
|
||||||
javaHome.takeIf { it.isNotEmpty() }
|
javaHome.takeIf { it.isNotEmpty() }
|
||||||
?.let { File(it) }
|
?.let { File(it) }
|
||||||
?.takeIf { it.isDirectory && File(it, "bin", "java.exe").isFile }
|
?.takeIf { it.isDirectory && fileFrom(it, "bin", "java.exe").isFile }
|
||||||
?.let {
|
?.let {
|
||||||
addIfBetter(project, versionMatch.value, jdkKey, it)
|
addIfBetter(project, versionMatch.value, jdkKey, it)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import org.jetbrains.kotlin.serialization.builtins.BuiltInsSerializer
|
|||||||
import org.gradle.jvm.tasks.Jar
|
import org.gradle.jvm.tasks.Jar
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
val builtinsSrc = File(rootDir, "core", "builtins", "src")
|
val builtinsSrc = fileFrom(rootDir, "core", "builtins", "src")
|
||||||
val builtinsNative = File(rootDir, "core", "builtins", "native")
|
val builtinsNative = fileFrom(rootDir, "core", "builtins", "native")
|
||||||
// TODO: rewrite dependent projects on using build results instead of the fixed location
|
// TODO: rewrite dependent projects on using build results instead of the fixed location
|
||||||
val builtinsSerialized = File(rootProject.extra["distDir"].toString(), "builtins")
|
val builtinsSerialized = File(rootProject.extra["distDir"].toString(), "builtins")
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ task("prepare") {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
val allFiles = loadAllFromJar(File(relocatedProtobuf.singleFile))
|
val allFiles = loadAllFromJar(relocatedProtobuf.singleFile)
|
||||||
|
|
||||||
val keepClasses = arrayListOf<String>()
|
val keepClasses = arrayListOf<String>()
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ val pluginXml by tasks.creating {
|
|||||||
|
|
||||||
inputs.property("pluginFullVersionNumber", pluginFullVersionNumber)
|
inputs.property("pluginFullVersionNumber", pluginFullVersionNumber)
|
||||||
inputs.files(kotlinPlugin)
|
inputs.files(kotlinPlugin)
|
||||||
outputs.files(File(buildDir, name, pluginXmlPath))
|
outputs.files(fileFrom(buildDir, name, pluginXmlPath))
|
||||||
|
|
||||||
doFirst {
|
doFirst {
|
||||||
val placeholderRegex = Regex(
|
val placeholderRegex = Regex(
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ val compile by configurations
|
|||||||
|
|
||||||
val compilerBaseName = name
|
val compilerBaseName = name
|
||||||
|
|
||||||
val outputJar = File(buildDir, "libs", "$compilerBaseName.jar")
|
val outputJar = fileFrom(buildDir, "libs", "$compilerBaseName.jar")
|
||||||
|
|
||||||
val compilerModules: Array<String> by rootProject.extra
|
val compilerModules: Array<String> by rootProject.extra
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ val proguard by task<ProGuardTask> {
|
|||||||
dependsOn(packCompiler)
|
dependsOn(packCompiler)
|
||||||
configuration("$rootDir/compiler/compiler.pro")
|
configuration("$rootDir/compiler/compiler.pro")
|
||||||
|
|
||||||
val outputJar = File(buildDir, "libs", "$compilerBaseName-after-proguard.jar")
|
val outputJar = fileFrom(buildDir, "libs", "$compilerBaseName-after-proguard.jar")
|
||||||
|
|
||||||
inputs.files(packCompiler.outputs.files.singleFile)
|
inputs.files(packCompiler.outputs.files.singleFile)
|
||||||
outputs.file(outputJar)
|
outputs.file(outputJar)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ val compile by configurations
|
|||||||
|
|
||||||
val compilerBaseName = name
|
val compilerBaseName = name
|
||||||
|
|
||||||
val outputJar = File(buildDir, "libs", "$compilerBaseName.jar")
|
val outputJar = fileFrom(buildDir, "libs", "$compilerBaseName.jar")
|
||||||
|
|
||||||
val compilerModules: Array<String> by rootProject.extra
|
val compilerModules: Array<String> by rootProject.extra
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ val proguard by task<ProGuardTask> {
|
|||||||
dependsOn(packCompiler)
|
dependsOn(packCompiler)
|
||||||
configuration("$rootDir/compiler/compiler.pro")
|
configuration("$rootDir/compiler/compiler.pro")
|
||||||
|
|
||||||
val outputJar = File(buildDir, "libs", "$compilerBaseName-after-proguard.jar")
|
val outputJar = fileFrom(buildDir, "libs", "$compilerBaseName-after-proguard.jar")
|
||||||
|
|
||||||
inputs.files(packCompiler.outputs.files.singleFile)
|
inputs.files(packCompiler.outputs.files.singleFile)
|
||||||
outputs.file(outputJar)
|
outputs.file(outputJar)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ val compile by configurations
|
|||||||
|
|
||||||
val compilerBaseName = name
|
val compilerBaseName = name
|
||||||
|
|
||||||
val outputJar = File(buildDir, "libs", "$compilerBaseName.jar")
|
val outputJar = fileFrom(buildDir, "libs", "$compilerBaseName.jar")
|
||||||
|
|
||||||
val compilerModules: Array<String> by rootProject.extra
|
val compilerModules: Array<String> by rootProject.extra
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ val proguard by task<ProGuardTask> {
|
|||||||
dependsOn(packCompiler)
|
dependsOn(packCompiler)
|
||||||
configuration("$rootDir/compiler/compiler.pro")
|
configuration("$rootDir/compiler/compiler.pro")
|
||||||
|
|
||||||
val outputJar = File(buildDir, "libs", "$compilerBaseName-after-proguard.jar")
|
val outputJar = fileFrom(buildDir, "libs", "$compilerBaseName-after-proguard.jar")
|
||||||
|
|
||||||
inputs.files(packCompiler.outputs.files.singleFile)
|
inputs.files(packCompiler.outputs.files.singleFile)
|
||||||
outputs.file(outputJar)
|
outputs.file(outputJar)
|
||||||
|
|||||||
Reference in New Issue
Block a user