-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f703b4
commit b8fe735
Showing
18 changed files
with
332 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Run Detekt code analysis | ||
|
||
on: push | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: 'true' | ||
|
||
- uses: actions/setup-java@v3 | ||
with: | ||
java-version: 11 | ||
distribution: zulu | ||
cache: gradle | ||
|
||
- name: Run analysis | ||
shell: bash | ||
run: ./gradlew detekt --stacktrace |
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,60 @@ | ||
/* | ||
* Copyright 2022, TeamDev. 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 | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Redistribution and use in source and/or binary forms, with or without | ||
* modification, must retain the above copyright notice and the following | ||
* disclaimer. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
@file:Suppress("unused", "UnusedReceiverParameter") | ||
|
||
import io.spine.internal.dependency.ErrorProne | ||
import io.spine.internal.dependency.GradleDoctor | ||
import io.spine.internal.dependency.Protobuf | ||
import io.spine.internal.dependency.Spine | ||
import io.spine.internal.dependency.Spine.ProtoData | ||
import org.gradle.plugin.use.PluginDependenciesSpec | ||
|
||
/** | ||
* Allows to escape a fully qualified names for dependencies which cannot be used | ||
* under `plugins` section because `io` is a value declared in | ||
* `org.gradle.kotlin.dsl.PluginAccessors.kt`. | ||
* | ||
* We still want to keep versions numbers in [io.spine.internal.dependency.Spine] | ||
* for the time being. So this file allows to reference those without resorting | ||
* to using strings again. | ||
*/ | ||
private const val ABOUT = "" | ||
|
||
val PluginDependenciesSpec.protoData: ProtoData | ||
get() = ProtoData | ||
|
||
val PluginDependenciesSpec.errorPronePlugin: String | ||
get() = ErrorProne.GradlePlugin.id | ||
|
||
val PluginDependenciesSpec.protobufPlugin: String | ||
get() = Protobuf.GradlePlugin.id | ||
|
||
val PluginDependenciesSpec.gradleDoctor: GradleDoctor | ||
get() = GradleDoctor | ||
|
||
val PluginDependenciesSpec.mcJava: Spine.McJava | ||
get() = Spine.McJava |
File renamed without changes.
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,57 @@ | ||
/* | ||
* Copyright 2022, TeamDev. 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 | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Redistribution and use in source and/or binary forms, with or without | ||
* modification, must retain the above copyright notice and the following | ||
* disclaimer. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
import io.spine.internal.gradle.ConfigTester | ||
import io.spine.internal.gradle.SpineRepos | ||
import io.spine.internal.gradle.cleanFolder | ||
import java.nio.file.Path | ||
import java.nio.file.Paths | ||
|
||
// A reference to `config` to use along with the `ConfigTester`. | ||
val config: Path = Paths.get("./") | ||
|
||
// A temp folder to use to check out the sources of other repositories with the `ConfigTester`. | ||
val tempFolder = File("./tmp") | ||
|
||
// Creates a Gradle task which checks out and builds the selected Spine repositories | ||
// with the local version of `config` and `config/buildSrc`. | ||
ConfigTester(config, tasks, tempFolder) | ||
.addRepo(SpineRepos.baseTypes) // Builds `base-types` at `master`. | ||
.addRepo(SpineRepos.base) // Builds `base` at `master`. | ||
.addRepo(SpineRepos.coreJava) // Builds `core-java` at `master`. | ||
|
||
// This is how one builds a specific branch of some repository: | ||
// .addRepo(SpineRepos.coreJava, Branch("grpc-concurrency-fixes")) | ||
|
||
// Register the produced task under the selected name to invoke manually upon need. | ||
.registerUnder("buildDependants") | ||
|
||
// Cleans the temp folder used to check out the sources from Git. | ||
tasks.register("clean") { | ||
doLast { | ||
cleanFolder(tempFolder) | ||
} | ||
} |
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,84 @@ | ||
/* | ||
* Copyright 2022, TeamDev. 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 | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Redistribution and use in source and/or binary forms, with or without | ||
* modification, must retain the above copyright notice and the following | ||
* disclaimer. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
import io.gitlab.arturbosch.detekt.Detekt | ||
|
||
/** | ||
* This script-plugin sets up Kotlin code analyzing with Detekt. | ||
* | ||
* After applying, Detekt is configured to use `${rootDir}/config/quality/detekt-config.yml` file. | ||
* Projects can append their own config files to override some parts of the default one or drop | ||
* it at all in a favor of their own one. | ||
* | ||
* An example of appending a custom config file to the default one: | ||
* | ||
* ``` | ||
* detekt { | ||
* config.from("config/detekt-custom-config.yml") | ||
* } | ||
* ``` | ||
* | ||
* To totally substitute it, just overwrite the corresponding property: | ||
* | ||
* ``` | ||
* detekt { | ||
* config = files("config/detekt-custom-config.yml") | ||
* } | ||
* ``` | ||
* | ||
* Also, it's possible to suppress Detekt findings using [baseline](https://detekt.dev/docs/introduction/baseline/) | ||
* file instead of suppressions in source code. | ||
* | ||
* An example of passing a baseline file: | ||
* | ||
* ``` | ||
* detekt { | ||
* baseline = file("config/detekt-baseline.yml") | ||
* } | ||
* ``` | ||
*/ | ||
private val about = "" | ||
|
||
plugins { | ||
id("io.gitlab.arturbosch.detekt") | ||
} | ||
|
||
detekt { | ||
buildUponDefaultConfig = true | ||
config = files("${rootDir}/config/quality/detekt-config.yml") | ||
} | ||
|
||
tasks { | ||
withType<Detekt>().configureEach { | ||
reports { | ||
html.required.set(true) // Only HTML report is generated. | ||
xml.required.set(false) | ||
txt.required.set(false) | ||
sarif.required.set(false) | ||
md.required.set(false) | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
buildSrc/src/main/kotlin/io/spine/internal/dependency/GradleDoctor.kt
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,37 @@ | ||
/* | ||
* Copyright 2022, TeamDev. 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 | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Redistribution and use in source and/or binary forms, with or without | ||
* modification, must retain the above copyright notice and the following | ||
* disclaimer. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
package io.spine.internal.dependency | ||
|
||
/** | ||
* Helps optimize Gradle Builds by ensuring recommendations at build time. | ||
* | ||
* See [plugin site](https://runningcode.github.io/gradle-doctor) for features and usage. | ||
*/ | ||
object GradleDoctor { | ||
const val version = "0.8.1" | ||
const val pluginId = "com.osacky.doctor" | ||
} |
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
Oops, something went wrong.