Repository | Build Status |
---|---|
Konsist | |
Konsist Documentation | - |
- Publish Local Snapshot:
./gradlew publishToMavenLocal -Pkonsist.releaseTarget=local
publish to local ~/.m2/repository
- Publish Public Snapshot
./gradlew publish -Pkonsist.releaseTarget=snapshot
publish to snapshot repository - Publish Release
./gradlew publish -Pkonsist.releaseTarget=release
publish to release repository. This artefact will be transferred to maven central repository after some time.
- Run
/scripts/create_release.py
script - Select option
1
on the console - (If needed) Remove deprecated API
- Run
./gradlew publish -Pkonsist.releaseTarget=release
on themain
branch to release a new version - (If needed) Change
Fix versions
for unfinished tickets assigned to this release version - (If needed) Change Kotlin dependency and coroutine dependnecy version in
https://docs.konsist.lemonappdev.com/getting-started/getting-started#add-konsist-dependency (retrieve coroutines
version from
./gradlew dependencies
) - Notify the community about the release
- Notify devs who have reported the issue or asked for the new feature (community links in original ticket)
- Create
hotfix/KON-XXX-...
branch frommain
- Fix the bug and open PR targeting
main
- Merge the PR
- Run
/scripts/create_release.py
script - Select option
2
on the console - (If needed) Remove deprecated API
- Run
./gradlew publish -Pkonsist.releaseTarget=release
on themain
branch to release a new version - Notify the community about the release
- Notify devs who have reported the issue (community link in original ticket)
./gradlew dokkaHtml
- generate KDocs in./lib/build/dokka/html/index.html
We have three options:
KoXDeclaration
not implementsKoNameProvider
(e.g.KoBaseDeclaration
,KoInitBlockDeclaration
)KoXDeclaration
implementsKoNameProvider
(so it has access toname
property, e.g.KoClassDeclaration
,KoFunctionDeclaration
)- some exceptions, like:
KoKDocTagDeclaration
,KoModifier
etc.
In provider with property with type List<KoXDeclaration>
where KoXDeclaration
not implements KoNameProvider
we create:
- properties
- with prefix
num
and the name of the X item in the plural number- Specifies how many items there are.
- with prefix
- functions
- with prefix
count
and the name of the X item in the plural number withpredicate
lambda parameter- Specifies how many items satisfies given predicate.
- with prefix
has
and the name of the X item in the plural number- Specifies whether declaration has any item.
- with prefix
has
and the name of the X item in the singular number withpredicate
lambda parameter- Specifies whether declaration has at least one item that satisfies given predicate.
- with prefix
hasAll
and the name of the X item in the plural number withpredicate
lambda parameter- Specifies whether declaration has all items that satisfies given predicate.
- with prefix
In provider with property with type List<KoXDeclaration>
where KoXDeclaration
implements KoNameProvider
we create
all properties and functions from the Option 1
and also:
- functions
- with prefix
has
, the name of the X item in the singular number and suffixWithName
and with parameters:(name: String, vararg names: String)
- Specifies whether the declaration has at least one item whose name matches any of the specified names
- with prefix
has
and the name of the X item in the plural number and suffixWithAllNames
and with parameters:(name: String, vararg names: String)
- Specifies whether the declaration has items with all the specified names
- with prefix
In this option we have providers for which it makes no sense to pass predicate
lambda parameter, especially if the
list contains enum values. Instead of passing lambda parameter, we pass concrete enums.
- properties
- with prefix
num
and the name of the X item in the plural number- Specifies how many items there are.
- with prefix
- functions
- with prefix
has
and the name of the X item in the plural number- Specifies whether declaration has any item.
- with prefix
has
and the name of the X item in the singular number with parameters:(koXDeclaration: KoXDeclaration, vararg koXDeclarations: KoXDeclaration)
- Specifies whether declaration has at least one specified item.
- with prefix
hasAll
and the name of the X item in the plural number with parameters:(koXDeclaration: KoXDeclaration, vararg koXDeclarations: KoXDeclaration)
- Specifies whether declaration has all specified items.
- with prefix
We have the same three options like above.
For providers with property with type List<KoXDeclaration>
where KoXDeclaration
not implements KoNameProvider
we
create extensions:
- properties
- with the name of the X item in the plural number
- Mapping declaration to its items.
- with the name of the X item in the plural number
- functions
- with prefix
with/without
and the name of the X item in the plural number- Filtering declarations with/without any item.
- with prefix
with/without
and the name of the X item in the singular number withpredicate
lambda parameter (to lambda we passKoXDeclaration
)- Filtering declarations that have at least one/ not have item satisfying the provided predicate.
- with prefix
withAll/withoutAll
and the name of the X item in the plural number withpredicate
lambda parameter (to lambda we passKoXDeclaration
)- Filtering declarations that have all/have at least one item satisfying the provided predicate.
- with prefix
with/without
and the name of the X item in the plural number withpredicate
lambda parameter (to lambda we passList<KoXDeclaration>
)- Filtering declarations with/without items satisfying the provided predicate.
- with prefix
For providers with property with type List<KoXDeclaration>
where KoXDeclaration
implements KoNameProvider
we create
all properties and functions extensions from the Option 1
and also:
- functions
- with prefix
with/without
, the name of the X item in the singular number and suffixNamed
and with parameters:(name: String, vararg names: String)
- Filtering declarations that have at least one/ not have item with the specified name(s)
- with prefix
withAll/withoutAll
and the name of the X item in the plural number and suffixNamed
and with parameters:(name: String, vararg names: String)
- Filtering declarations that have all/ not have any items with the specified name(s)
- with prefix
For such providers we create extensions:
- properties
- with the name of the X item in the plural number
- Mapping declaration to its items.
- with the name of the X item in the plural number
- functions
- with prefix
with/without
and the name of the X item in the plural number- Filtering declarations with/without any item.
- with prefix
with/without
, the name of the X item in the singular number with parameters:(koXDeclaration: KoXDeclaration, vararg koXDeclarations: KoXDeclaration)
- Filtering declarations that have at least one/not have the specified item
- with prefix
withAll/withoutAll
, the name of the X item in the plural number with parameters:(koXDeclaration: KoXDeclaration, vararg koXDeclarations: KoXDeclaration)
- Filtering declarations that have all/not have any the specified item
- with prefix
Examples of such providers: KoTypeProvider
, KoReturnTypeProvider
.
We create extensions:
- properties
- with the name of the X item in the plural number
- Mapping declaration to its item.
- with the name of the X item in the plural number
- functions
- with prefix
with/without
and the name of the property in the singular number withpredicate
lambda parameter- Filtering declarations that have/ not have item satisfying the provided predicate.
- with prefix
E.g. In KoNameProvider
, the name
property returns String
(singular - it's one object),
so we create two extensions:
withName(name: String, vararg names: String)
withoutName(name: String, vararg names: String)
and if it makes sense:
withName(predicate: (String) -> Boolean)
withoutName(predicate: (String) -> Boolean)
E.g. In KoAliasProvider
, the alias
property returns String?
(singular - it's one object:
String
or null ),
so we create two extensions:
withAlias(vararg names: String)
withoutAlias(vararg names: String)
The difference is that in the first case we force passing the parameter, in the second it is optional.
If parameters of extensions is of KClass
type, then we create analogous extensions like for providers not implementing KoNameProvider
but with suffix Of
!
Error
No matching variant of project :buildSrc was found. The consumer was configured to find a library for use during runtime, compatible with Java 17, packaged as a jar,
Fix
Change Gradle version File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle
We take the test method name from Thread.currentThread().stackTrace[index].methodName
which has a different behavior
due to the way assert
is called (depending on whether we use default parameters values or not in the assertTrue
or assertFalse
method).
- If we don't use any of the default parameters (we set them directly) the stack trace looks like this:
So the test method name is at the fourth index.
- If we use any parameter with a default value (we don't set any of them directly) the stack trace looks like this:
So the test method name is at the fifth index.