mirror of
https://github.com/apple/pkl.git
synced 2026-05-25 16:19:20 +02:00
Run spotless apply
This commit is contained in:
@@ -1,3 +1,18 @@
|
||||
/**
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
@file:Suppress("MemberVisibilityCanBePrivate")
|
||||
|
||||
import java.io.File
|
||||
@@ -14,13 +29,9 @@ open class BuildInfo(project: Project) {
|
||||
System.getenv("GRAALVM_HOME") ?: "${System.getProperty("user.home")}/.graalvm"
|
||||
}
|
||||
|
||||
val version: String by lazy {
|
||||
libs.findVersion("graalVm").get().toString()
|
||||
}
|
||||
val version: String by lazy { libs.findVersion("graalVm").get().toString() }
|
||||
|
||||
val graalVmJdkVersion: String by lazy {
|
||||
libs.findVersion("graalVmJdkVersion").get().toString()
|
||||
}
|
||||
val graalVmJdkVersion: String by lazy { libs.findVersion("graalVmJdkVersion").get().toString() }
|
||||
|
||||
val osName: String by lazy {
|
||||
when {
|
||||
@@ -31,9 +42,7 @@ open class BuildInfo(project: Project) {
|
||||
}
|
||||
}
|
||||
|
||||
val baseName: String by lazy {
|
||||
"graalvm-jdk-${graalVmJdkVersion}_${osName}-${arch}_bin"
|
||||
}
|
||||
val baseName: String by lazy { "graalvm-jdk-${graalVmJdkVersion}_${osName}-${arch}_bin" }
|
||||
|
||||
val downloadUrl: String by lazy {
|
||||
val jdkMajor = graalVmJdkVersion.takeWhile { it != '.' }
|
||||
@@ -41,18 +50,14 @@ open class BuildInfo(project: Project) {
|
||||
"https://download.oracle.com/graalvm/$jdkMajor/archive/$baseName.$extension"
|
||||
}
|
||||
|
||||
val installDir: File by lazy {
|
||||
File(homeDir, baseName)
|
||||
}
|
||||
val installDir: File by lazy { File(homeDir, baseName) }
|
||||
|
||||
val baseDir: String by lazy {
|
||||
if (os.isMacOsX) "$installDir/Contents/Home" else installDir.toString()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Same logic as [org.gradle.internal.os.OperatingSystem#arch], which is protected.
|
||||
*/
|
||||
/** Same logic as [org.gradle.internal.os.OperatingSystem#arch], which is protected. */
|
||||
val arch: String by lazy {
|
||||
when (val arch = System.getProperty("os.arch")) {
|
||||
"x86" -> "i386"
|
||||
@@ -66,13 +71,9 @@ open class BuildInfo(project: Project) {
|
||||
|
||||
val graalVmAmd64: GraalVm = GraalVm("x64")
|
||||
|
||||
val isCiBuild: Boolean by lazy {
|
||||
System.getenv("CI") != null
|
||||
}
|
||||
val isCiBuild: Boolean by lazy { System.getenv("CI") != null }
|
||||
|
||||
val isReleaseBuild: Boolean by lazy {
|
||||
java.lang.Boolean.getBoolean("releaseBuild")
|
||||
}
|
||||
val isReleaseBuild: Boolean by lazy { java.lang.Boolean.getBoolean("releaseBuild") }
|
||||
|
||||
val hasMuslToolchain: Boolean by lazy {
|
||||
// see "install musl" in .circleci/jobs/BuildNativeJob.pkl
|
||||
@@ -87,10 +88,11 @@ open class BuildInfo(project: Project) {
|
||||
val commitId: String by lazy {
|
||||
// only run command once per build invocation
|
||||
if (project === project.rootProject) {
|
||||
val process = ProcessBuilder()
|
||||
.command("git", "rev-parse", "--short", "HEAD")
|
||||
.directory(project.rootDir)
|
||||
.start()
|
||||
val process =
|
||||
ProcessBuilder()
|
||||
.command("git", "rev-parse", "--short", "HEAD")
|
||||
.directory(project.rootDir)
|
||||
.start()
|
||||
process.waitFor().also { exitCode ->
|
||||
if (exitCode == -1) throw RuntimeException(process.errorStream.reader().readText())
|
||||
}
|
||||
@@ -100,9 +102,7 @@ open class BuildInfo(project: Project) {
|
||||
}
|
||||
}
|
||||
|
||||
val commitish: String by lazy {
|
||||
if (isReleaseBuild) project.version.toString() else commitId
|
||||
}
|
||||
val commitish: String by lazy { if (isReleaseBuild) project.version.toString() else commitId }
|
||||
|
||||
val pklVersion: String by lazy {
|
||||
if (isReleaseBuild) {
|
||||
|
||||
Reference in New Issue
Block a user