Skip to content
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

Generate bit flags #766

Merged
merged 107 commits into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
c79ce3a
Initial commit on generators
DRSchlaubi Feb 18, 2023
5c9ef09
Fix companion generator
DRSchlaubi Feb 18, 2023
e843b0b
Add deocumentation generator
DRSchlaubi Feb 18, 2023
e4e144b
Protect internal functions
DRSchlaubi Feb 18, 2023
dfa2c81
Remove unessasary imports from generated files
DRSchlaubi Feb 18, 2023
29908fd
Make documentation code examples more customizable
DRSchlaubi Feb 18, 2023
5516d55
Fixes for easier reviewing
lukellmann Feb 19, 2023
41be7ce
Dump API
lukellmann Feb 19, 2023
9ad74c6
Merge branch '0.8.x' into feature/flag-generators
lukellmann Feb 19, 2023
ceccb8c
Adjust KotlinPoetDsl
lukellmann Feb 19, 2023
df77f29
Remove Classes.kt
DRSchlaubi Feb 19, 2023
dc40f3d
Move toPrimitiveKind to KordEnumGeneration.kt
DRSchlaubi Feb 19, 2023
f319d57
Update ksp-processors/build.gradle.kts
DRSchlaubi Feb 19, 2023
2996f1e
Move toPrimitiveKind to KordEnumGeneration.kt
DRSchlaubi Feb 19, 2023
46db18f
Mark Unknown constructor as unsafe
DRSchlaubi Feb 19, 2023
f51a97a
Add equals() and hashCode()
DRSchlaubi Feb 19, 2023
05a53e3
Fix equals() Implementation
DRSchlaubi Feb 19, 2023
0742532
Add missing @KordUnsafe
DRSchlaubi Feb 19, 2023
19efac5
Migrate ActivityFlags to generated class
DRSchlaubi Feb 19, 2023
e569d28
Generate Application flags
DRSchlaubi Feb 19, 2023
491b18c
Generate GuildMemberFlags
DRSchlaubi Feb 19, 2023
b1fee60
Generate SpeakingFlag
DRSchlaubi Feb 19, 2023
441bbd4
Generate SystemChannelFlag
DRSchlaubi Feb 19, 2023
acbf46b
Generate UserFlags
DRSchlaubi Feb 19, 2023
fe5479d
Generate Permissions
DRSchlaubi Feb 19, 2023
10f9cff
Document flags properly
DRSchlaubi Feb 19, 2023
c1ccd5e
Make All flag an object
DRSchlaubi Feb 19, 2023
12a5cfa
Api dump
DRSchlaubi Feb 19, 2023
c7ea130
Fix PermissionsTest
DRSchlaubi Feb 19, 2023
96db7ea
Generate Intents
DRSchlaubi Feb 20, 2023
8c72fbe
Improve documentation generation
DRSchlaubi Feb 20, 2023
19d404b
Add missing %
DRSchlaubi Feb 20, 2023
a04e8ab
Merge branch '0.8.x' into feature/flag-generators
lukellmann Mar 8, 2023
181f046
Merge branch 'main' into feature/flag-generators
lukellmann Jun 23, 2023
b7249f4
remove import
lukellmann Jun 24, 2023
18cdf85
delete empty file
lukellmann Jun 24, 2023
12add23
Remove flag base types
lukellmann Jun 25, 2023
e4bc87a
Rename @GenerateKordEnum to @Generate
lukellmann Jun 28, 2023
58f2aec
Remove redundant qualifier names
lukellmann Jun 28, 2023
899322b
Use getAnnotationsByType
lukellmann Jun 30, 2023
41a0cd2
Restructure generation code
lukellmann Jul 3, 2023
902c7f6
Make generated file comment more stable
lukellmann Jul 3, 2023
7e8140b
Best effort binary compatibility for enums
lukellmann Jul 3, 2023
117569b
Forgot MessageFlag
lukellmann Jul 3, 2023
90e9539
Merge branch 'main' into feature/flag-generators
lukellmann Jul 21, 2023
3985d1c
Construct flags with shift distance
lukellmann Jul 24, 2023
1640877
Suppress Class hack in Dokka output
lukellmann Jul 24, 2023
ba970fe
Use top-level compilerOptions
lukellmann Jul 24, 2023
44c9d5c
Binary compatibility for EnumEntries
lukellmann Jul 24, 2023
919a5e5
Binary compatibility for previous data classes
lukellmann Jul 28, 2023
6c29dc3
Move copy function into collection class
lukellmann Jul 28, 2023
a99c0cc
Add plus to Flag classes
lukellmann Jul 28, 2023
6c58f91
Preserve binary compatibility for some factory functions
lukellmann Jul 28, 2023
6cde837
Use Generate.valueName for flags
lukellmann Jul 31, 2023
e512e11
Back to previous names
lukellmann Jul 31, 2023
090eb5c
Binary compatibility for Collection.flags
lukellmann Jul 31, 2023
2eb7d58
Deduplicate code for contains(), plus() and minus()
lukellmann Aug 2, 2023
e19ad0c
Merge branch 'main' into feature/flag-generators
lukellmann Aug 6, 2023
4255f57
Generate ChannelFlags
lukellmann Aug 7, 2023
b6851f8
Rename Builder.flags() to Builder.build()
lukellmann Aug 7, 2023
cb90c83
Base flags on shift instead of value
lukellmann Aug 14, 2023
46f7d1a
Reduce logging in GenerationProcessor
lukellmann Aug 14, 2023
6b1ac26
Remove hasCombinerFlag special case
lukellmann Aug 14, 2023
e76db16
Merge branch 'main' into feature/flag-generators
lukellmann Aug 14, 2023
16cb350
Add tests
lukellmann Aug 14, 2023
09b3373
oops
lukellmann Aug 14, 2023
4a28fae
Remove CONSTRUCTOR target from KordUnsafe
lukellmann Aug 14, 2023
facfee5
Non-nullable dev.kord.common.Class on non-jvm
lukellmann Aug 14, 2023
bdbfbf4
Second pass over annotations
lukellmann Aug 15, 2023
06aff3f
Tweak Intents and Permissions constants
lukellmann Aug 15, 2023
8360c96
Make collection constructor internal
lukellmann Aug 15, 2023
45056fb
Don't pass collectionCN and builderCN explicitly
lukellmann Aug 15, 2023
43662dd
Fix tests
lukellmann Aug 15, 2023
6dd04a8
Merge branch 'main' into feature/flag-generators
lukellmann Aug 15, 2023
dc7b61b
Only use var in Builder when needed
lukellmann Aug 15, 2023
83cc3d8
Add documentation for contains, plus and minus
lukellmann Aug 20, 2023
02eebc3
Add documentation for values and code/value
lukellmann Aug 20, 2023
7ccd6b8
Add documentation for factory functions
lukellmann Aug 20, 2023
e847ad9
Expression body functions
lukellmann Aug 20, 2023
fcf8dc6
Move collection below flags
lukellmann Aug 20, 2023
bd6449c
Add documentation for copy
lukellmann Aug 20, 2023
091d630
Fix copy for BIT_SET_FLAGS
lukellmann Aug 20, 2023
ce16284
Add documentation for Builder and fix build for BIT_SET_FLAGS
lukellmann Aug 21, 2023
86d2e61
Fix documentation for collection
lukellmann Aug 21, 2023
dc864dc
Fix trailing space
lukellmann Aug 21, 2023
35b625b
Compatibility for ActivityFlags
lukellmann Aug 21, 2023
4eef5bf
Compatibility for GuildMemberFlags
lukellmann Aug 21, 2023
f6bbd68
Compatibility for Permissions
lukellmann Aug 21, 2023
916ce0c
Compatibility for SystemChannelFlags
lukellmann Aug 21, 2023
c036f99
Compatibility for UserFlags
lukellmann Aug 21, 2023
f93ac62
Compatibility for SpeakingFlags
lukellmann Aug 21, 2023
e1e75c4
Compatibility for Intents
lukellmann Aug 21, 2023
54f8cc9
Import in test
lukellmann Aug 21, 2023
2c772f7
Generate annotation cleanup
lukellmann Aug 21, 2023
d158f4c
Better file names
lukellmann Aug 21, 2023
fdf16a2
Use correct MemberName for EXACTLY_ONCE
lukellmann Aug 21, 2023
0da4c62
Don't allow arbitrary modifiers for addEqualsAndHashCodeBasedOnClassA…
lukellmann Aug 21, 2023
6eb9ac1
Serializer cleanup
lukellmann Aug 21, 2023
ef18697
Better compatibility for deprecated builders
lukellmann Aug 21, 2023
df104a0
Fix line breaks in documentation
lukellmann Aug 22, 2023
055ca31
Remove deprecations from commented out annotations
lukellmann Aug 24, 2023
c67e9f3
Formatting
lukellmann Aug 24, 2023
1823433
Fix links
lukellmann Aug 24, 2023
8f21692
Formatting
lukellmann Aug 24, 2023
09ede26
Don't generate not previously present flags()
lukellmann Aug 24, 2023
b571bbd
Share code between serializers
lukellmann Aug 24, 2023
57dde0c
Fix deprecated copy for BIT_SET_FLAGS
lukellmann Aug 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
610 changes: 586 additions & 24 deletions common/api/common.api

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions common/src/commonMain/kotlin/Class.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package dev.kord.common

import dev.kord.common.annotation.KordInternal
import kotlin.reflect.KClass

// TODO remove when enum artifacts are removed from generated flags

/** @suppress */
@Suppress("unused")
public expect class Class<T>

/** @suppress */
@KordInternal
public expect val <T : Any> KClass<T>.java: Class<T>
1 change: 1 addition & 0 deletions common/src/commonMain/kotlin/DiscordBitSet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public class DiscordBitSet(internal var data: LongArray) { // data is in little-
return "DiscordBitSet($binary)"
}

public fun copy(): DiscordBitSet = DiscordBitSet(data = data.copyOf())
}

public fun DiscordBitSet(vararg widths: Long): DiscordBitSet {
Expand Down
Loading