Skip to content

Commit

Permalink
chore: run spotless
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Gammon <sam@elide.ventures>
  • Loading branch information
sgammon committed Feb 21, 2024
1 parent cd86776 commit cf6dc88
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 84 deletions.
91 changes: 47 additions & 44 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ plugins {
}

group = "org.pkl-lang"

description = "Configuration that is Programmable, Scalable, and Safe"

nexusPublishing {
Expand All @@ -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 {
Expand Down Expand Up @@ -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")}
Expand All @@ -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 {
Expand All @@ -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<ReportMergeTask> by registering(ReportMergeTask::class) {
output.set(layout.buildDirectory.file("reports/detekt/detekt.sarif"))
}
val detektMergeXml: TaskProvider<ReportMergeTask> by registering(ReportMergeTask::class) {
output.set(layout.buildDirectory.file("reports/detekt/detekt.xml"))
}
val detektMergeSarif: TaskProvider<ReportMergeTask> by
registering(ReportMergeTask::class) {
output.set(layout.buildDirectory.file("reports/detekt/detekt.sarif"))
}
val detektMergeXml: TaskProvider<ReportMergeTask> by
registering(ReportMergeTask::class) {
output.set(layout.buildDirectory.file("reports/detekt/detekt.xml"))
}
withType(Detekt::class) detekt@{
finalizedBy(detektMergeSarif, detektMergeXml)
reports.sarif.required = true
Expand Down
49 changes: 26 additions & 23 deletions pkl-core/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -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
* <p>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
* <p>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
* <p>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;
}
4 changes: 3 additions & 1 deletion pkl-core/src/main/java/org/pkl/core/runtime/VmInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
50 changes: 34 additions & 16 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
Expand All @@ -67,20 +82,23 @@ buildCache {
directory = file("../.codebase/build-cache")
}

System.getenv("BUILDLESS_APIKEY")?.ifBlank { null }?.let { apiKey ->
remote<HttpBuildCache> {
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<HttpBuildCache> {
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")

0 comments on commit cf6dc88

Please sign in to comment.