| Repository | Build Status |
|---|---|
| Konsist | |
| Konsist Documentation | - |
- Publish Local Snapshot:
./gradlew publishToMavenLocal -Pkonsist.releaseTarget=localpublish to local ~/.m2/repository- Publish Public Snapshot
./gradlew publish -Pkonsist.releaseTarget=snapshotpublish to snapshot repository (snapshots are removed after 90 days) - Publish Release
./gradlew publish -Pkonsist.releaseTarget=releaseupload to Central Portal. After validation, the artifact is:- automatically published to maven central.
- eventually will be visible as mvn repository (third-party site that copies Maven Central's index)
Snapshot and release publishing require these properties in local.properties:
konsist.mavenCentralUsernameandkonsist.mavenCentralPassword- Central Portal user token (generate at Central Portal account)konsist.signingKeyandkonsist.signingPassword- Base64 encoded GPG signing key and password
- Run
/misc/scripts/create_release.pyscript - Select option
1on the console - (If needed) Remove deprecated API
- Run
./gradlew publish -Pkonsist.releaseTarget=releaseon themainbranch to release a new version - (If needed) Change
Fix versionsfor 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
/misc/scripts/create_release.pyscript - Select option
2on the console - (If needed) Remove deprecated API
- Run
./gradlew publish -Pkonsist.releaseTarget=releaseon themainbranch to release a new version - Notify the community about the release
- Notify devs who have reported the issue (community link in original ticket)
We have three options:
KoXDeclarationnot implementsKoNameProvider(e.g.KoBaseDeclaration,KoInitBlockDeclaration)KoXDeclarationimplementsKoNameProvider(so it has access tonameproperty, e.g.KoClassDeclaration,KoFunctionDeclaration)- some exceptions, like:
KoKDocTagDeclaration,KoModifieretc.
In provider with property with type List<KoXDeclaration> where KoXDeclaration not implements KoNameProvider we create:
- properties
- with prefix
numand the name of the X item in the plural number- Specifies how many items there are.
- with prefix
- functions
- with prefix
countand the name of the X item in the plural number withpredicatelambda parameter- Specifies how many items satisfies given predicate.
- with prefix
hasand the name of the X item in the plural number- Specifies whether declaration has any item.
- with prefix
hasand the name of the X item in the singular number withpredicatelambda parameter- Specifies whether declaration has at least one item that satisfies given predicate.
- with prefix
hasAlland the name of the X item in the plural number withpredicatelambda 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 suffixWithNameand 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
hasand the name of the X item in the plural number and suffixWithAllNamesand 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
numand the name of the X item in the plural number- Specifies how many items there are.
- with prefix
- functions
- with prefix
hasand the name of the X item in the plural number- Specifies whether declaration has any item.
- with prefix
hasand 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
hasAlland 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/withoutand the name of the X item in the plural number- Filtering declarations with/without any item.
- with prefix
with/withoutand the name of the X item in the singular number withpredicatelambda parameter (to lambda we passKoXDeclaration)- Filtering declarations that have at least one/ not have item satisfying the provided predicate.
- with prefix
withAll/withoutAlland the name of the X item in the plural number withpredicatelambda parameter (to lambda we passKoXDeclaration)- Filtering declarations that have all/have at least one item satisfying the provided predicate.
- with prefix
with/withoutand the name of the X item in the plural number withpredicatelambda 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 suffixNamedand 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/withoutAlland the name of the X item in the plural number and suffixNamedand 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/withoutand 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/withoutand the name of the property in the singular number withpredicatelambda 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.