Skip to content

Commit 285df6b

Browse files
committed
Update docs for KordEx v2
1 parent 66ab934 commit 285df6b

File tree

11 files changed

+574
-39
lines changed

11 files changed

+574
-39
lines changed

.github/set-version.main.kts

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,30 @@ val client = OkHttpClient()
1616
val gson = Gson()
1717

1818
val PLUGIN_URL = "https://plugins.gradle.org/m2/dev/kordex/gradle/plugins/kordex/maven-metadata.xml"
19-
val RELEASES_URL = "https://repo1.maven.org/maven2/com/kotlindiscord/kord/extensions/kord-extensions/maven-metadata.xml"
20-
val SNAPSHOTS_URL = "https://s01.oss.sonatype.org/service/local/repositories/snapshots/content/" +
21-
"com/kotlindiscord/kord/extensions/kord-extensions" +
22-
"/maven-metadata.xml"
19+
val RELEASES_URL = "https://releases-repo.kordex.dev/dev/kordex/kord-extensions/maven-metadata.xml"
20+
val SNAPSHOTS_URL = "https://snapshots-repo.kordex.dev/dev/kordex/kord-extensions/maven-metadata.xml"
2321

2422
val FILE_PATH = Path("Writerside/v.list")
2523

2624
println("Finding the latest version...")
2725

28-
fun get(url: String): String {
26+
fun get(url: String): String? {
2927
val request = Request.Builder()
3028
.url(url)
3129
.build()
3230

33-
return client.newCall(request).execute().body!!.string()
31+
val response = client.newCall(request).execute()
32+
33+
if (response.code == 200) {
34+
return response.body!!.string()
35+
} else {
36+
return null
37+
}
3438
}
3539

36-
fun getLatest(url: String): String {
40+
fun getLatest(url: String): String? {
3741
val content = get(url)
42+
?: return null
3843

3944
val document = DocumentBuilderFactory.newInstance().newDocumentBuilder()
4045
.parse(content.byteInputStream())
@@ -56,11 +61,23 @@ fun getJavaFromModule(url: String): String {
5661
.get("org.gradle.jvm.version").asString
5762
}
5863

59-
val latestSnapshot = Version.parse(getLatest(SNAPSHOTS_URL))
60-
val latestRelease = Version.parse(getLatest(RELEASES_URL))
64+
val latestSnapshot = getLatest(SNAPSHOTS_URL)?.let { Version.parse(it) }
65+
val latestRelease = getLatest(RELEASES_URL)?.let { Version.parse(it) }
6166

62-
val latest = maxOf(latestSnapshot, latestRelease)
63-
val latestPlugin = Version.parse(getLatest(PLUGIN_URL))
67+
if (latestSnapshot == null && latestRelease == null) {
68+
println("Unable to find latest snapshot or release version - are either published?")
69+
System.exit(-1)
70+
}
71+
72+
val latest = if (latestSnapshot == null) {
73+
latestRelease!!
74+
} else if (latestRelease == null) {
75+
latestSnapshot!!
76+
} else {
77+
maxOf(latestSnapshot!!, latestRelease!!)
78+
}
79+
80+
val latestPlugin = getLatest(PLUGIN_URL)?.let { Version.parse(it) }
6481

6582
println("Latest snapshot version: $latestSnapshot")
6683
println("Latest release version: $latestRelease")
@@ -70,12 +87,11 @@ println("Finding current java version...")
7087
var javaVersion: String
7188

7289
if ("-SNAPSHOT" in latest.toString()) {
73-
val baseUrl = "https://s01.oss.sonatype.org/service/local/repositories/snapshots/content/com/" +
74-
"kotlindiscord/kord/extensions/kord-extensions/$latest"
90+
val baseUrl = "https://snapshots-repo.kordex.dev/dev/kordex/kord-extensions/$latest"
7591

7692
val metadataXml = get("$baseUrl/maven-metadata.xml")
7793
val metadataDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder()
78-
.parse(metadataXml.byteInputStream())
94+
.parse(metadataXml!!.byteInputStream())
7995

8096
val latestBuild = XPathFactory.newInstance().newXPath()
8197
.compile("//snapshotVersions/snapshotVersion[1]/value")
@@ -84,14 +100,17 @@ if ("-SNAPSHOT" in latest.toString()) {
84100
javaVersion = getJavaFromModule("$baseUrl/kord-extensions-$latestBuild.module")
85101
} else {
86102
javaVersion = getJavaFromModule(
87-
"https://repo1.maven.org/maven2/com/kotlindiscord/kord/extensions/kord-extensions" +
88-
"/$latest/kord-extensions-$latest.module"
103+
"https://releases-repo.kordex.dev/dev/kordex/kord-extensions/$latest/kord-extensions-$latest.module"
89104
)
90105
}
91106

107+
println("Updating Gradle plugins version in Writerside/v.list to $latestPlugin")
92108
println("Updating KordEx version in Writerside/v.list to $latest")
93109
println("Updating Java version in Writerside/v.list to $javaVersion")
94110

111+
// Uncommented during local testing
112+
// System.exit(0)
113+
95114
val file = FILE_PATH.toFile()
96115
val fileContents = file.readText()
97116

Writerside/kordex.tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
<toc-element topic="About.topic">
1313
<toc-element topic="Framework-Comparison.topic"/>
14+
<toc-element topic="Licensing.topic"/>
1415
</toc-element>
1516

1617
<toc-element topic="Core-Documentation.topic">

Writerside/labels.list

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<labels xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/labels.xsd">
55
<primary-label short-name="v2" id="v2" name="Version 2" color="tangerine">
6-
New in Kord Extensions version 2 (unreleased)
6+
New in Kord Extensions 2
77
</primary-label>
88

99
<primary-label short-name="v1.1.0" id="gradle-1.1.0" name="Version 1.1.0" color="purple">

Writerside/redirection-rules.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@
66
<accepts>page.html</accepts>
77
</rule>
88
-->
9-
<rule></rule><rule></rule><rule></rule></rules>
9+
<rule></rule><rule></rule><rule></rule>
10+
<rule id="7f18792">
11+
<description>Created after removal of "Version 2" from Kord Extensions</description>
12+
<accepts>Version-2.html</accepts>
13+
</rule>
14+
</rules>

Writerside/topics/About.topic

Lines changed: 142 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@
1414
</p>
1515

1616
<p>
17-
Snapshots:
18-
<a href="https://s01.oss.sonatype.org/content/repositories/snapshots">
19-
Sonatype Snapshots (s01)
20-
</a>
17+
Maven Repo: <code>https://snapshots-repo.kordex.dev</code>
2118
</p>
2219

2320
<p>
2421
Coordinate:
25-
<path>com.kotlindiscord.kord.extensions:kord-extensions</path>
22+
<path>dev.kordex:kord-extensions</path>
2623
</p>
2724
</tldr>
2825

@@ -57,6 +54,146 @@
5754
</p>
5855
</note>
5956

57+
<chapter title="Version 2" id="version-2">
58+
<primary-label ref="v2" />
59+
60+
<p>
61+
The recently released Kord Extensions 2 includes quite a few changes, which we've detailed below.
62+
</p>
63+
64+
<list type="bullet">
65+
<li>
66+
<p>
67+
The root package for all projects is no longer <code>com.kotlindiscord.kord.extensions</code>.
68+
It has been changed to <code>dev.kordex</code>.
69+
</p>
70+
71+
<list type="bullet">
72+
<li>Core package: <code>dev.kordex.core</code></li>
73+
<li>Modules package: <code>dev.kordex.modules</code></li>
74+
<li>Tokenizing parser package: <code>dev.kordex.parser</code></li>
75+
</list>
76+
</li>
77+
78+
<li>
79+
<p>
80+
Kord Extensions is now licensed under
81+
<a
82+
href="https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12"
83+
>the EUPL, version 1.2</a>,
84+
with the specific provision (EUPL articles 14 &amp; 15)
85+
that the applicable law is the (Republic of) Irish law and the
86+
Jurisdiction is Dublin.
87+
</p>
88+
89+
<p>
90+
For more information on this license, how we interpret it, and what it means for your project,
91+
see <a href="Licensing.topic">the license information page</a>.
92+
</p>
93+
</li>
94+
95+
<li>
96+
Due to
97+
<a
98+
href="https://central.sonatype.org/faq/snapshot-releases/#question"
99+
>changes that are coming with the new Maven Central platform</a>,
100+
we no longer publish Kord Extensions to Maven Central or OSSRH.
101+
Instead, you should add the following repository URLs:
102+
103+
<list type="bullet">
104+
<li>Releases: <code>https://releases-repo.kordex.dev</code></li>
105+
<li>Snapshots: <code>https://snapshots-repo.kordex.dev</code></li>
106+
</list>
107+
</li>
108+
109+
<li>
110+
<p>
111+
Version 2 includes a new <a href="Data-Collection.topic" /> system, intended to guide development
112+
foci and provide interesting statistics for the community.
113+
</p>
114+
115+
<p>
116+
If you're concerned about data collection in general, this system may be
117+
<a href="Data-Collection.topic" anchor="config-level">configured in multiple ways</a>
118+
and is easily disabled.
119+
</p>
120+
121+
<p>
122+
Our <a
123+
href="http://stats.kordex.dev/public/dashboard/4b0a4faa-45fb-45af-ab96-43cfbec11779"
124+
>public statistics dashboard</a>
125+
contains aggregated statistics from the data collected.
126+
</p>
127+
</li>
128+
129+
<li>
130+
The modules have been reorganized and renamed to make it easier to figure out their coordinates
131+
and generally keep the Git repository cleaner.
132+
For more information,
133+
<a
134+
href="https://github.com/Kord-Extensions/kord-extensions/blob/root/modules/README.md"
135+
>see the README in the <path>modules</path> folder</a>.
136+
</li>
137+
138+
<li>
139+
Translations have been
140+
<a href="https://github.com/Kord-Extensions/translations">moved to their own repository</a>
141+
and are still licensed under the Mozilla Public License 2.0.
142+
</li>
143+
144+
<li>
145+
The <a
146+
href="https://github.com/Kord-Extensions/.github/blob/master/CONTRIBUTING.md"
147+
>Contribution Guidelines</a>
148+
have been updated with information on the expected code style.
149+
We'll continue to update the guidelines when other questions arise.
150+
</li>
151+
152+
<li>
153+
<p>
154+
Kord Extensions 2 has a greater emphasis on the plugin system, which will be worked on and
155+
documented more over the coming days.
156+
</p>
157+
158+
<p>
159+
There are a lot of plans in motion around this system, so keep an eye out for announcements!
160+
</p>
161+
</li>
162+
163+
<li>
164+
The <a href="Unsafe.topic">Unsafe Module</a> has been updated to support
165+
<a href="Components.topic" /> and <a href="Modals.topic" />.
166+
</li>
167+
168+
<li>
169+
A <a href="Config-About.topic">default about command</a> is now included with Kord Extensions — to help
170+
you meet the EUPL's licensing requirements and provide a standard way for your bots to provide
171+
information about themselves.
172+
</li>
173+
</list>
174+
</chapter>
175+
176+
<chapter title="Version 1" id="version-1">
177+
<p>
178+
If you need to use Kord Extensions 1 for any reason, it can be found in the same Maven repository as
179+
version 2.
180+
You may also continue to use <a href="KordEx-Plugin.topic">the Gradle plugin</a> — just be sure to specify
181+
the Kord Extensions version you need.
182+
</p>
183+
184+
<list type="bullet">
185+
<li>Coordinate: <path>com.kotlindiscord.kord.extensions:kord-extensions</path></li>
186+
<li>Last Version: <code>1.9.0-SNAPSHOT</code></li>
187+
<li>Kord Version: <code>0.15.0-SNAPSHOT</code></li>
188+
</list>
189+
190+
<p>
191+
Version 1 is licensed under the Mozilla Public License, version 2.0.
192+
The code will always be available
193+
<a href="https://github.com/Kord-Extensions/kord-extensions/tree/v1">under the v1 branch on GitHub</a>.
194+
</p>
195+
</chapter>
196+
60197
<seealso style="cards">
61198
<category ref="components">
62199
<a href="Core-Documentation.topic" summary="Kord Extensions core documentation"/>

Writerside/topics/Welcome.topic

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
<a href="Functional-Modules.topic" type="mixed"
4343
summary="First-party modules, which provide user-facing functionality for your bots."/>
4444

45+
<a href="Gradle-Plugins.topic" type="tools"
46+
summary="Gradle plugins, enhancing your project and making your life easier."/>
47+
4548
<a href="Utility-Modules.topic" type="library"
4649
summary="Extra utility modules, which provide specific development tools and libraries."/>
4750
</secondary>
@@ -50,14 +53,17 @@
5053
<cards narrow="true">
5154
<title>Relevant links</title>
5255

56+
<a href="https://kordex.dev"
57+
type="world"
58+
summary="Learn more about Kord Extensions, and find projects using it.">Official Website</a>
59+
5360
<a href="%kordex-discord%"
5461
type="account"
5562
summary="Chat about Kord Extensions, get help or share your projects.">Official Discord Server</a>
5663

5764
<a href="https://github.com/Kord-Extensions/"
5865
type="open-source"
59-
summary="Read the source code, report problems or contribute via Pull Request.">GitHub
60-
Organisation</a>
66+
summary="Read the source code, report problems or contribute via Pull Request.">GitHub Organization</a>
6167

6268
<a href="https://github.com/Kord-Extensions/template"
6369
type="tools"

0 commit comments

Comments
 (0)