-
Notifications
You must be signed in to change notification settings - Fork 2
Fix filtering #173
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
Open
dmdashenkov
wants to merge
31
commits into
master
Choose a base branch
from
fix-filtering
base: master
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.
Open
Fix filtering #173
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
5eae93f
Bump version 0.12.0
dmdashenkov d140c06
Introduce `SourceFileSetMarker`
dmdashenkov 91a084b
Add stub markers
dmdashenkov 368b73e
Simplify a precondition check
dmdashenkov 436df68
Reduce repetition in tests
dmdashenkov e7bea69
Use `paths` in the Gradle plugin (WIP)
dmdashenkov 162cc35
Fix CLI param syntax
dmdashenkov 068c938
Fix alignment
dmdashenkov 5204e0c
Check if a renderer supports the given sources file set
dmdashenkov 4bcdce0
Make regex parsing more resilient
dmdashenkov 162142f
Merge branch 'master' into fix-filtering
dmdashenkov 1dd7385
Update Gradle plugin tests
dmdashenkov 186e1c2
Set up incremental build
dmdashenkov 0fcecf9
Add some doc
dmdashenkov 368ae6e
More doc
dmdashenkov 1c32f45
More doc
dmdashenkov 454ca48
More doc and stricter deprecation
dmdashenkov 6d69dbc
Yet more doc
dmdashenkov 5ddd630
More doc for test env
dmdashenkov 2793061
Remove debug output
dmdashenkov dffa31e
Remove redundant checks, add logging and another test
dmdashenkov 8cf7162
Remove unwanted generated subdirs
dmdashenkov 0742a7e
Fix numbering
dmdashenkov 2370ae3
Better doc
dmdashenkov 484e0d3
More doc
dmdashenkov 8747165
Better error message
dmdashenkov 09ccc19
Remove a duplicate string literal
dmdashenkov b006441
More doc
dmdashenkov 44c297d
Make language reference for `AnyLanguage` simpler
dmdashenkov 54bcd5a
Rename new DSL components
dmdashenkov 9a3158e
Add a shortcut for Gradle's providers
dmdashenkov 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
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
54 changes: 54 additions & 0 deletions
54
api/src/main/kotlin/io/spine/protodata/renderer/SourceFileSetLabel.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,54 @@ | ||
| /* | ||
| * Copyright 2023, 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.protodata.renderer | ||
|
|
||
| import io.spine.tools.code.Language | ||
|
|
||
| /** | ||
| * A label for a source file set. | ||
| * | ||
| * The label consists of the programming language that the files use and the name of the code | ||
| * generator that created the files. | ||
| * | ||
| * A label signifies the type of code structures found in the source files. This helps renderers | ||
| * that process those sources to know what to expect from the source file set before ever checking | ||
| * the contents of the files themselves. | ||
| */ | ||
| public data class SourceFileSetLabel( | ||
| public val language: Language, | ||
| public val generator: SourceGeneratorName = DefaultGenerator | ||
| ) { | ||
|
|
||
| /** | ||
| * Creates a new `SourceFileSetLabel` with the given language and a custom generator name. | ||
| */ | ||
| public constructor(language: Language, generatorName: String) | ||
| : this(language, CustomGenerator(generatorName)) | ||
|
|
||
| override fun toString(): String = | ||
| "${language.name}(${generator.name})" | ||
| } |
69 changes: 69 additions & 0 deletions
69
api/src/main/kotlin/io/spine/protodata/renderer/SourceGeneratorName.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,69 @@ | ||
| /* | ||
| * Copyright 2023, 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.protodata.renderer | ||
|
|
||
| /** | ||
| * A name of a source code generator. | ||
| * | ||
| * This can be a `protoc` plugin or builtin, or a custom code generator tool. | ||
| */ | ||
| public sealed interface SourceGeneratorName { | ||
|
|
||
| public val name: String | ||
| get() = javaClass.simpleName.lowercase() | ||
| } | ||
|
|
||
| /** | ||
| * The default generator is the default way for the Protobuf compiler to generate source code for | ||
| * a given language. | ||
| * | ||
| * For example, in Java, the default generator, given a message `Foo`, would generate a message | ||
| * classes and auxiliary types, such as classes `Foo`, `Foo.Builder`, `Foo.Parser`, | ||
| * and the interface `FooOrBuilder`. | ||
| * | ||
| * Most ProtoData plugins will likely work with code generated by the default generator. | ||
| * | ||
| * Since the Protobuf compiler does not support all the existing programming languages, | ||
| * the `DefaultGenerator` is only defined for those languages that are supported, such as Java, JS, | ||
| * C++, etc. For other languages, as well as for other code generation scenarios, | ||
| * see [CustomGenerator]. | ||
| */ | ||
| public object DefaultGenerator : SourceGeneratorName | ||
|
|
||
| /** | ||
| * A name of a custom source code generator. | ||
| * | ||
| * May represent a Protobuf compiler plugin, or any other code generator. | ||
| * | ||
| * Conventionally, the name of the generator should coincide with the name of the directory where | ||
| * the generated files are placed. Users should follow this convention where possible, yet diverge | ||
| * when necessary. For example, Java gRPC stubs should be marked with the `grpc` name. However, | ||
| * files generated for Dart should be marked with the name `dart`, not `lib`. | ||
| */ | ||
| public class CustomGenerator( | ||
| override val name: String | ||
| ) : SourceGeneratorName | ||
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something strange.
"Generator" in all cases is the thing producing the code. Why would we need a "default" and "custom" generators? They both generate something, and why would we care about their origin?
And again, in this piece of documentation, you mention "labels". Which still does not add up: "generator"s, source set labels and "language" all dance around :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Default" simply references the case most users will likely face most of the time. And it is the default way in which Protoc generated code, as opposed to custom generators/Protoc plugins.
I've cleared up the doc's wording a bit so that there is no confusion with the labels.