-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Generate configuration parameters overview #5932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
mpkorstanje
wants to merge
62
commits into
main
Choose a base branch
from
feature/generate-configuration-parameters-overview
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,246
−16
Draft
Changes from all commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
827df2b
Setup project skeleton
mpkorstanje ed2e1ee
Enable annotation processor for ConfigurationParameter
mpkorstanje 14ffed5
Output minimal junit-platform-configuration-metadata.json
mpkorstanje 63dd21b
Fix workaround for Javadoc
mpkorstanje 578bdca
Fix verifyOSGi
mpkorstanje 2d7547d
Fix describe module tests
mpkorstanje 6bc410b
Fix allPublicTopLevelTypesHaveApiAnnotations test
mpkorstanje e06d4c1
Explain why processing linting is supressed
mpkorstanje ccea87e
Output junit-platform-configuration-metadata for platform-launcher
mpkorstanje fd1baf1
Fix checkBackwardCompatibility
mpkorstanje 3295a99
Fix JarDescribeModuleTests
mpkorstanje 3b5624f
Reduce scope to compileOnly
mpkorstanje 314e8fd
Process annotations for Vintage
mpkorstanje a3aa4e5
Setup minimal unit test
mpkorstanje b155836
Add Eclipse IDE compatibility note
mpkorstanje 149556b
Extract TestCompiler
mpkorstanje 72d715b
Write output with platform independent newline
mpkorstanje c1789d6
Require annotated fields to be static with a constant value string
mpkorstanje 9a1f897
Add Property.sourceType
mpkorstanje 7c3df1f
Add deprecation and refactor
mpkorstanje d764e3f
Remove redundant local variable
mpkorstanje 3b011f7
Generate some json output
mpkorstanje dd5fc8c
Use jakarta.json and serialize by hand
mpkorstanje 7e7476c
Use JSON syntax highlighting in tests
mpkorstanje 9381ee1
Shadow jakarta.json and parsson into processor jar
marcphilipp 3cfa463
Fix ArchUnit check
marcphilipp b63ef2a
Merge branch 'main' into feature/generate-configuration-parameters-ov…
marcphilipp 94a9f04
Fix `aggregateJavadocs` task
marcphilipp ec4e77c
Merge branch 'main' into feature/generate-configuration-parameters-ov…
marcphilipp 433b3b9
Drop dependency on junit-platform-commons
marcphilipp 525aa1c
Merge metadata files for standalone jar
marcphilipp fa5ab92
Fail if attempting to merge non-array nodes
marcphilipp d708416
Extract explicit type for deprecation
mpkorstanje bf68047
Deprecation.Warning level can be omitted
mpkorstanje 5b0eef0
Remove ``: {@value}`` from doc comments
mpkorstanje 8d46a8b
Only use the first paragraph of the documentation
mpkorstanje b8e9230
Add note about error handling
mpkorstanje d6c4cc2
Process Property.type
mpkorstanje 7cf5a6d
Rename ConfigurationProperty to ConfigurationParameter
mpkorstanje 59e4a87
Remove ConfigurationParameter.type from scope
mpkorstanje 1e1741f
Document minimal scope
mpkorstanje 5d7daad
Polish deprecation element
mpkorstanje 3a1fdb9
Implement missing json conversions
mpkorstanje adfc951
Remove unused Json
mpkorstanje 53aca3c
Document ConfigurationMetaData
mpkorstanje ef7e949
Rename JsonWriter to JsonConverter
mpkorstanje 64dc068
Extract AnnotationMirrorUtil
mpkorstanje 0084a4a
Extract ConfigurationParameterHandler
mpkorstanje 8c264aa
Reorg ConfigurationParameterHandler
mpkorstanje c0121e2
Add type and default value
mpkorstanje e4ec3df
Read type and default value from annotation
mpkorstanje 70f6af3
Only support singular default values for now
mpkorstanje 2493c67
Render defaults as json values where applicable
mpkorstanje 5e6d62e
Annotate Jupiter Constants
mpkorstanje a235f3e
Claim ConfigurationParameter annotations
mpkorstanje 6918e32
Extract ProcessingContext
mpkorstanje 93c0e3a
Extract ConfigurationParameterAnnotatedField
mpkorstanje 3a6ce7f
Replace preconditions with error message
mpkorstanje ae8b921
Nitpick
mpkorstanje dc9a43a
Documentation
mpkorstanje 0244147
Add integration test with Maven
mpkorstanje 98f0885
Annotate constant classes
mpkorstanje File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
66 changes: 66 additions & 0 deletions
66
...ugins/common/src/main/kotlin/junitbuild/shadow/ConfigurationMetadataMergingTransformer.kt
This file contains hidden or 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,66 @@ | ||
| package junitbuild.shadow | ||
|
|
||
| import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar | ||
| import com.github.jengelman.gradle.plugins.shadow.transformers.ResourceTransformer | ||
| import com.github.jengelman.gradle.plugins.shadow.transformers.TransformerContext | ||
| import org.apache.tools.zip.ZipEntry | ||
| import org.apache.tools.zip.ZipOutputStream | ||
| import org.gradle.api.file.FileTreeElement | ||
| import org.gradle.api.model.ObjectFactory | ||
| import org.gradle.api.provider.Property | ||
| import org.gradle.api.tasks.Input | ||
| import tools.jackson.databind.json.JsonMapper | ||
| import tools.jackson.databind.node.ArrayNode | ||
| import tools.jackson.databind.node.ObjectNode | ||
| import javax.inject.Inject | ||
|
|
||
| /** | ||
| * Merges JUnit/Spring configuration metadata files by concatenating the array | ||
| * values of their top-level fields (`groups`, `properties`, and `hints`). | ||
| * | ||
| * @see <a href="https://docs.spring.io/spring-boot/specification/configuration-metadata/format.html">Configuration Metadata format</a> | ||
| */ | ||
| abstract class ConfigurationMetadataMergingTransformer @Inject constructor( | ||
| override val objectFactory: ObjectFactory | ||
| ) : ResourceTransformer { | ||
|
|
||
| @get:Input | ||
| abstract val resource: Property<String> | ||
|
|
||
| private var mergedTree: ObjectNode? = null | ||
|
|
||
| override fun canTransformResource(element: FileTreeElement): Boolean { | ||
| return resource.get().equals(element.path, ignoreCase = true) | ||
| } | ||
|
|
||
| override fun transform(context: TransformerContext) { | ||
| val tree = JsonMapper().readTree(context.inputStream) as ObjectNode | ||
| val merged = mergedTree | ||
| if (merged == null) { | ||
| mergedTree = tree | ||
| } else { | ||
| tree.properties().forEach { (name, value) -> | ||
| value as ArrayNode | ||
| val existing = merged.get(name) | ||
| if (existing == null) { | ||
| merged.set(name, value) | ||
| } else { | ||
| existing as ArrayNode | ||
| existing.addAll(value) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| override fun hasTransformedResource(): Boolean = mergedTree != null | ||
|
|
||
| override fun modifyOutputStream(os: ZipOutputStream, preserveFileTimestamps: Boolean) { | ||
| val entry = ZipEntry(resource.get()) | ||
| entry.time = ShadowJar.CONSTANT_TIME_FOR_ZIP_ENTRIES | ||
| os.putNextEntry(entry) | ||
| os.write(JsonMapper().writeValueAsBytes(mergedTree)) | ||
| os.closeEntry() | ||
| mergedTree = null | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.