Skip to content

Commit ef087c9

Browse files
committed
Adjust repository structure to follow the GradleX standard setup
1 parent e62a794 commit ef087c9

File tree

59 files changed

+320
-97
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+320
-97
lines changed

.github/workflows/ci-build.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: git clone
14-
uses: actions/checkout@v2
14+
uses: actions/checkout@v3.1.0
1515
- name: Set up JDK 11
16-
uses: actions/setup-java@v2.5.0
16+
uses: actions/setup-java@v3.6.0
1717
with:
18-
distribution: 'zulu'
18+
distribution: zulu
1919
java-version: 11
2020
- name: gradle check
2121
id: gradle
22-
uses: gradle/gradle-build-action@v2.1.0
22+
uses: gradle/gradle-build-action@v2.3.3
2323
with:
24-
arguments: :check
24+
arguments: ":checkAllVersions"

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Java Ecosystem Capabilities Gradle plugin - Changelog
2+
3+
## Version 0.7
4+
* TODO
5+
6+
## Version 0.6
7+
* [New] [#10](https://github.com/gradlex-org/build-parameters/issues/10) Rules added (Thanks [Boris Petrov](https://github.com/boris-petrov) for reporting)
8+
9+
## Version 0.5
10+
* [New] [#9](https://github.com/gradlex-org/build-parameters/issues/9) Rules added (Thanks [Toldry](https://github.com/Toldry) for contributing)
11+
12+
## Version 0.1 - 0.4
13+
* [New] Initial releases with initial rule set

CODE_OF_CONDUCT.md

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series
86+
of actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or
93+
permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within
113+
the community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.0, available at
119+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120+
121+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122+
enforcement ladder](https://github.com/mozilla/diversity).
123+
124+
[homepage]: https://www.contributor-covenant.org
125+
126+
For answers to common questions about this code of conduct, see the FAQ at
127+
https://www.contributor-covenant.org/faq. Translations are available at
128+
https://www.contributor-covenant.org/translations.

build.gradle.kts

+62-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,67 @@
11
plugins {
2+
id("com.gradle.plugin-publish") version "1.0.0"
23
id("gradlexbuild.java-ecosystem-capabilities-documentation")
4+
id("groovy")
5+
id("java-gradle-plugin")
36
}
47

5-
tasks.check {
6-
dependsOn(gradle.includedBuild("plugin").task(":checkAllVersions"))
8+
group = "de.jjohannes.gradle"
9+
version = "0.6"
10+
11+
gradlePlugin {
12+
plugins.create(project.name) {
13+
id = "de.jjohannes.${project.name}"
14+
implementationClass = "${project.group}.javaecosystem.capabilities.JavaEcosystemCapabilitiesPlugin"
15+
displayName = "Adds Capabilities to well-known Components hosted on Maven Central."
16+
description = "Adds Capabilities to well-known Components hosted on Maven Central."
17+
}
18+
}
19+
20+
pluginBundle {
21+
website = "https://github.com/jjohannes/java-ecosystem-capabilities"
22+
vcsUrl = "https://github.com/jjohannes/java-ecosystem-capabilities.git"
23+
tags = listOf("capabilities", "java",
24+
"asm", "cglib", "dom4j", "javax", "jakarta", "velocity", "hamcrest", "stax", "woodstox") // TODO tags from rules!
25+
}
26+
27+
java {
28+
toolchain.languageVersion.set(JavaLanguageVersion.of(11)) // to run tests that use Android with 11
29+
}
30+
tasks.withType<JavaCompile>().configureEach {
31+
options.release.set(8)
32+
}
33+
34+
dependencies {
35+
testImplementation("org.gradle.exemplar:samples-check:1.0.0")
36+
testImplementation("org.spockframework:spock-core:2.3-groovy-3.0")
37+
testRuntimeOnly("org.junit.vintage:junit-vintage-engine")
38+
}
39+
40+
tasks.test {
41+
useJUnitPlatform()
42+
maxParallelForks = 4
43+
inputs.dir(layout.projectDirectory.dir("samples"))
744
}
45+
46+
val checkAllVersions = tasks.register("checkAllVersions") {
47+
dependsOn(tasks.check)
48+
}
49+
50+
listOf("6.0.1", "6.4.1", "6.9.3", "7.0.2", "7.1.1", "7.2", "7.3.3", "7.4.2", "7.5.1").forEach { gradleVersionUnderTest ->
51+
val testGradle = tasks.register<Test>("testGradle$gradleVersionUnderTest") {
52+
group = LifecycleBasePlugin.VERIFICATION_GROUP
53+
description = "Runs tests against Gradle $gradleVersionUnderTest"
54+
testClassesDirs = sourceSets.test.get().output.classesDirs
55+
classpath = sourceSets.test.get().runtimeClasspath
56+
useJUnitPlatform {
57+
excludeTags("no-cross-version")
58+
}
59+
maxParallelForks = 4
60+
systemProperty("gradleVersionUnderTest", gradleVersionUnderTest)
61+
62+
exclude("**/*SamplesTest.class") // Not yet cross-version ready
63+
}
64+
checkAllVersions {
65+
dependsOn(testGradle)
66+
}
67+
}

gradle/checkstyle/checkstyle.xml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE module PUBLIC
2+
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
3+
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
4+
<module name="Checker">
5+
<module name="Header">
6+
<property name="headerFile" value="${config_loc}/header.txt"/>
7+
</module>
8+
<module name="TreeWalker">
9+
<!-- Imports -->
10+
<module name="AvoidStarImport"/>
11+
<!-- Imports as they are sorted by IntelliJ by default, see https://checkstyle.org/config_imports.html#CustomImportOrder_Examples -->
12+
<module name="CustomImportOrder">
13+
<property name="customImportOrderRules"
14+
value="THIRD_PARTY_PACKAGE###SPECIAL_IMPORTS###STANDARD_JAVA_PACKAGE###STATIC"/>
15+
<property name="specialImportsRegExp" value="^javax\."/>
16+
<property name="standardPackageRegExp" value="^java\."/>
17+
<property name="sortImportsInGroupAlphabetically" value="true"/>
18+
<property name="separateLineBetweenGroups" value="false"/>
19+
</module>
20+
<module name="RedundantImport"/>
21+
<module name="UnusedImports"/>
22+
</module>
23+
</module>

gradle/checkstyle/header.txt

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright 2022 the GradleX team.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
plugins {
2+
id("org.gradlex.build-parameters") version "1.2"
3+
}
4+
5+
buildParameters {
6+
pluginId("gradlexbuild.build-parameters")
7+
bool("ci") {
8+
fromEnvironment()
9+
defaultValue.set(false)
10+
}
11+
}

documentation/build.gradle.kts renamed to gradle/plugins/documentation/build.gradle.kts

-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ plugins {
33
}
44

55
dependencies {
6-
implementation("de.jjohannes.gradle:java-ecosystem-capabilities")
76
implementation("org.reflections:reflections:0.10.2")
87
}

documentation/settings.gradle.kts renamed to gradle/plugins/documentation/settings.gradle.kts

-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ pluginManagement {
44
dependencyResolutionManagement {
55
repositories.gradlePluginPortal()
66
}
7-

documentation/src/main/kotlin/gradlexbuild.java-ecosystem-capabilities-documentation.gradle.kts renamed to gradle/plugins/documentation/src/main/kotlin/gradlexbuild.java-ecosystem-capabilities-documentation.gradle.kts

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,21 @@ import gradlexbuild.javaecosystem.capabilities.documentation.ReadmeUpdate
22
import gradlexbuild.javaecosystem.capabilities.documentation.SamplesCompletenessCheck
33

44
plugins {
5-
id("base")
5+
id("java")
66
}
77

88
val updateReadme = tasks.register<ReadmeUpdate>("updateReadme") {
9+
pluginClasses.from(tasks.jar)
910
readme.set(layout.projectDirectory.file("README.MD"))
1011
}
1112

12-
val checkAllSample = tasks.register<SamplesCompletenessCheck>("checkSamplesForCompleteness") {
13+
val checkSamplesForCompleteness = tasks.register<SamplesCompletenessCheck>("checkSamplesForCompleteness") {
14+
pluginClasses.from(tasks.jar)
1315
samplesBuildFiles.from(layout.projectDirectory.file("samples/sample-all/build.gradle.kts"))
1416
samplesBuildFiles.from(layout.projectDirectory.file("samples/sample-all-deactivated/build.gradle.kts"))
1517
}
1618

1719
tasks.check {
1820
dependsOn(updateReadme)
19-
dependsOn(checkAllSample)
21+
dependsOn(checkSamplesForCompleteness)
2022
}

documentation/src/main/kotlin/gradlexbuild/javaecosystem/capabilities/documentation/ReadmeUpdate.kt renamed to gradle/plugins/documentation/src/main/kotlin/gradlexbuild/javaecosystem/capabilities/documentation/ReadmeUpdate.kt

+20-3
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,39 @@ package gradlexbuild.javaecosystem.capabilities.documentation
22

33
import org.gradle.api.DefaultTask
44
import org.gradle.api.artifacts.ComponentMetadataRule
5+
import org.gradle.api.file.ConfigurableFileCollection
56
import org.gradle.api.file.RegularFileProperty
7+
import org.gradle.api.tasks.Classpath
68
import org.gradle.api.tasks.InputFile
79
import org.gradle.api.tasks.TaskAction
10+
import org.reflections.util.ClasspathHelper
11+
import org.reflections.util.ConfigurationBuilder
12+
import java.net.URLClassLoader
13+
import kotlin.reflect.jvm.internal.impl.load.kotlin.JvmType
814

915
abstract class ReadmeUpdate : DefaultTask() {
1016

1117
@get:InputFile
1218
abstract val readme: RegularFileProperty
1319

20+
@get:Classpath
21+
abstract val pluginClasses: ConfigurableFileCollection
22+
1423
@TaskAction
1524
fun update() {
16-
val reflections = org.reflections.Reflections("de.jjohannes.gradle.javaecosystem.capabilities.rules")
17-
val allClasses = reflections.getSubTypesOf(ComponentMetadataRule::class.java)
25+
val classesUrls = pluginClasses.files.map { it.toURI().toURL() }
26+
val loader = URLClassLoader("pluginClasspath", classesUrls.toTypedArray(), ComponentMetadataRule::class.java.classLoader)
27+
val reflectionConfiguration = ConfigurationBuilder().setUrls(ClasspathHelper.forClassLoader(loader)).addClassLoaders(loader)
28+
val allClasses = org.reflections.Reflections(reflectionConfiguration).getSubTypesOf(ComponentMetadataRule::class.java).filter {
29+
it.`package`.name == "de.jjohannes.gradle.javaecosystem.capabilities.rules" }
30+
31+
if (allClasses.isEmpty()) {
32+
throw RuntimeException("No rule implementations found")
33+
}
34+
1835
val allCapabilities = allClasses.map { ruleClass ->
1936
val capabilityGroup = ruleClass.getDeclaredField("CAPABILITY_GROUP").get(null) as String
20-
var capability = "";
37+
var capability = ""
2138
ruleClass.declaredFields.filter { it.name.startsWith("CAPABILITY_NAME") }.forEach { field ->
2239
if (capability.isNotEmpty()) {
2340
capability += " / "

0 commit comments

Comments
 (0)