From cf6dc885200c134a9c8f829d39c59daf681b2aed Mon Sep 17 00:00:00 2001 From: Sam Gammon Date: Wed, 21 Feb 2024 13:10:00 -0800 Subject: [PATCH] chore: run spotless Signed-off-by: Sam Gammon --- build.gradle.kts | 91 ++++++++++--------- pkl-core/src/main/java/module-info.java | 49 +++++----- .../java/org/pkl/core/runtime/VmInfo.java | 4 +- settings.gradle.kts | 50 ++++++---- 4 files changed, 110 insertions(+), 84 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index bc4acc98f..769b073e4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -28,6 +28,7 @@ plugins { } group = "org.pkl-lang" + description = "Configuration that is Programmable, Scalable, and Safe" nexusPublishing { @@ -39,16 +40,19 @@ nexusPublishing { } } -val apiLockedProjects = listOf( - projects.pklCli, - projects.pklConfigKotlin, - projects.pklGradle, -).map { it.name } +val apiLockedProjects = + listOf( + projects.pklCli, + projects.pklConfigKotlin, + projects.pklGradle, + ) + .map { it.name } apiValidation { - ignoredProjects = ignoredProjects.plus(allprojects.filter { - it.name !in apiLockedProjects - }.map { it.name }).toMutableSet() + ignoredProjects = + ignoredProjects + .plus(allprojects.filter { it.name !in apiLockedProjects }.map { it.name }) + .toMutableSet() } idea { @@ -76,25 +80,27 @@ spotless { dependencies { listOf( - projects.pklCli, - projects.pklCodegenJava, - projects.pklCodegenKotlin, - projects.pklCommons, - projects.pklCommonsCli, - projects.pklConfigJava, - projects.pklConfigKotlin, - projects.pklDoc, - projects.pklExecutor, - projects.pklGradle, - projects.pklServer, - projects.pklTools, - ).forEach { - kover(it) - testReportAggregation(it) - } + projects.pklCli, + projects.pklCodegenJava, + projects.pklCodegenKotlin, + projects.pklCommons, + projects.pklCommonsCli, + projects.pklConfigJava, + projects.pklConfigKotlin, + projects.pklDoc, + projects.pklExecutor, + projects.pklGradle, + projects.pklServer, + projects.pklTools, + ) + .forEach { + kover(it) + testReportAggregation(it) + } } -val message = """ +val message = + """ ==== Gradle version : ${gradle.gradleVersion} Java version : ${System.getProperty("java.version")} @@ -109,7 +115,9 @@ Git Commit ID : ${buildInfo.commitId} ==== """ -val formattedMessage = message.replace("\n====", "\n" + "=".repeat(message.lines().maxByOrNull { it.length }!!.length)) +val formattedMessage = + message.replace("\n====", "\n" + "=".repeat(message.lines().maxByOrNull { it.length }!!.length)) + logger.info(formattedMessage) detekt { @@ -121,32 +129,27 @@ detekt { dependencyCheck { nvd.apiKey = System.getenv("NVD_API_KEY") - suppressionFiles = listOf( - "config/owasp/suppressions.xml" - ) + suppressionFiles = listOf("config/owasp/suppressions.xml") } -val allTestsReport by reporting.reports.creating(AggregateTestReport::class) { - testType = TestSuiteType.UNIT_TEST -} +val allTestsReport by + reporting.reports.creating(AggregateTestReport::class) { testType = TestSuiteType.UNIT_TEST } tasks { - val clean by getting(Delete::class) { - delete(layout.buildDirectory) - } + val clean by getting(Delete::class) { delete(layout.buildDirectory) } - val printVersion by registering { - doFirst { println(buildInfo.pklVersion) } - } + val printVersion by registering { doFirst { println(buildInfo.pklVersion) } } // --- Tasks: Detekt // - val detektMergeSarif: TaskProvider by registering(ReportMergeTask::class) { - output.set(layout.buildDirectory.file("reports/detekt/detekt.sarif")) - } - val detektMergeXml: TaskProvider by registering(ReportMergeTask::class) { - output.set(layout.buildDirectory.file("reports/detekt/detekt.xml")) - } + val detektMergeSarif: TaskProvider by + registering(ReportMergeTask::class) { + output.set(layout.buildDirectory.file("reports/detekt/detekt.sarif")) + } + val detektMergeXml: TaskProvider by + registering(ReportMergeTask::class) { + output.set(layout.buildDirectory.file("reports/detekt/detekt.xml")) + } withType(Detekt::class) detekt@{ finalizedBy(detektMergeSarif, detektMergeXml) reports.sarif.required = true diff --git a/pkl-core/src/main/java/module-info.java b/pkl-core/src/main/java/module-info.java index 50ebd7c61..4aaf03705 100644 --- a/pkl-core/src/main/java/module-info.java +++ b/pkl-core/src/main/java/module-info.java @@ -1,44 +1,47 @@ /** * 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 + *

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 + *

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 + *

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. */ -/** - * Pkl: Core. - */ -@SuppressWarnings("module") open module pkl.core { +/** Pkl: Core. */ +@SuppressWarnings("module") +open module pkl.core { requires java.base; requires java.naming; - requires org.graalvm.nativeimage; requires org.graalvm.truffle; - requires org.snakeyaml.engine.v2; - exports org.pkl.core.module to pkl.cli; - exports org.pkl.core.packages to pkl.cli; - exports org.pkl.core.project to pkl.cli; - exports org.pkl.core.repl to pkl.cli; - exports org.pkl.core.resource to pkl.cli; - exports org.pkl.core.runtime to pkl.cli; - exports org.pkl.core.stdlib.test.report to pkl.cli; - exports org.pkl.core.util to pkl.cli; + exports org.pkl.core.module to + pkl.cli; + exports org.pkl.core.packages to + pkl.cli; + exports org.pkl.core.project to + pkl.cli; + exports org.pkl.core.repl to + pkl.cli; + exports org.pkl.core.resource to + pkl.cli; + exports org.pkl.core.runtime to + pkl.cli; + exports org.pkl.core.stdlib.test.report to + pkl.cli; + exports org.pkl.core.util to + pkl.cli; exports org.pkl.core; uses org.pkl.core.StackFrameTransformer; uses org.pkl.core.module.ModuleKeyFactory; provides com.oracle.truffle.api.provider.TruffleLanguageProvider with - org.pkl.core.runtime.VmLanguageProvider; + org.pkl.core.runtime.VmLanguageProvider; } diff --git a/pkl-core/src/main/java/org/pkl/core/runtime/VmInfo.java b/pkl-core/src/main/java/org/pkl/core/runtime/VmInfo.java index 2d627e906..0ef9963f6 100644 --- a/pkl-core/src/main/java/org/pkl/core/runtime/VmInfo.java +++ b/pkl-core/src/main/java/org/pkl/core/runtime/VmInfo.java @@ -16,7 +16,9 @@ package org.pkl.core.runtime; public class VmInfo { - private VmInfo() { /* no instantiation */ } + private VmInfo() { + /* no instantiation */ + } /** Pkl core engine version */ public static final String PKL_CORE_VERSION = "0.26.0-dev"; diff --git a/settings.gradle.kts b/settings.gradle.kts index ce2b6902c..f15668be3 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -12,22 +12,37 @@ pluginManagement { rootProject.name = "pkl" include("bench") + include("docs") + include("stdlib") include("pkl-cli") + include("pkl-codegen-java") + include("pkl-codegen-kotlin") + include("pkl-commons") + include("pkl-commons-cli") + include("pkl-commons-test") + include("pkl-config-java") + include("pkl-config-kotlin") + include("pkl-core") + include("pkl-doc") + include("pkl-gradle") + include("pkl-executor") + include("pkl-tools") + include("pkl-server") plugins { @@ -40,18 +55,18 @@ dependencyResolutionManagement { repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS rulesMode = RulesMode.FAIL_ON_PROJECT_RULES - repositories { - mavenCentral() - } + repositories { mavenCentral() } } val javaVersion = JavaVersion.current() + require(javaVersion.isJava11Compatible) { "Project requires Java 11 or higher, but found ${javaVersion.majorVersion}." } -if (gradle.startParameter.taskNames.contains("updateDependencyLocks") || - gradle.startParameter.taskNames.contains("uDL") +if ( + gradle.startParameter.taskNames.contains("updateDependencyLocks") || + gradle.startParameter.taskNames.contains("uDL") ) { gradle.startParameter.isWriteDependencyLocks = true } @@ -67,20 +82,23 @@ buildCache { directory = file("../.codebase/build-cache") } - System.getenv("BUILDLESS_APIKEY")?.ifBlank { null }?.let { apiKey -> - remote { - isEnabled = extra.properties["remoteCache"] == "true" || !System.getenv("CI").isNullOrBlank() - isPush = extra.properties["cachePush"] != "false" || !System.getenv("CI").isNullOrBlank() - isUseExpectContinue = true - url = uri("https://gradle.less.build/cache/generic") - credentials { - username = "apikey" - password = apiKey + System.getenv("BUILDLESS_APIKEY") + ?.ifBlank { null } + ?.let { apiKey -> + remote { + isEnabled = + extra.properties["remoteCache"] == "true" || !System.getenv("CI").isNullOrBlank() + isPush = extra.properties["cachePush"] != "false" || !System.getenv("CI").isNullOrBlank() + isUseExpectContinue = true + url = uri("https://gradle.less.build/cache/generic") + credentials { + username = "apikey" + password = apiKey + } } } - } } enableFeaturePreview("STABLE_CONFIGURATION_CACHE") -enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")