Skip to content

Commit

Permalink
Start work on the docs generator
Browse files Browse the repository at this point in the history
  • Loading branch information
NoComment1105 committed Nov 30, 2022
0 parents commit 319ed97
Show file tree
Hide file tree
Showing 30 changed files with 1,482 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
root = true

[*]
charset = utf-8
end_of_line = lf
tab_width = 4
max_line_length = 120
insert_final_newline = true

[*.gradle]
indent_style = tab

[*.kt]
indent_style = tab
ij_kotlin_name_count_to_use_star_import = 99999
ij_kotlin_name_count_to_use_star_import_for_members = 99999

[*.properties]
indent_style = space
indent_size = 2

[*.toml]
indent_style = tab

[.editorconfig]
indent_style = tab
indent_size = 4
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.bat text eol=CRLF
38 changes: 38 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build

on:
push:
branches:
- main
pull-request:
branches:
- main

jobs:
check-api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check API
run: ./gradlew clean apiCheck

build:
needs: check-api
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build Artifacts
uses: gradle/gradle-build-action@v2
with:
arguments: build --stacktrace
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

# gradle

.gradle/
build/
out/
classes/

# eclipse

*.launch

# idea

.idea/
*.iml
*.ipr
*.iws

# vscode

.settings/
.vscode/
bin/
.classpath
.project

# macos

*.DS_Store
7 changes: 7 additions & 0 deletions .idea/discord.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions HEADER
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Copyright (c) 2022 HyacinthBots <[email protected]>

This file is part of doc-generator.

Licensed under the MIT license. For more information,
please see the LICENSE file or https://mit-license.org/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2022 HyacinthBots <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
73 changes: 73 additions & 0 deletions api/doc-generator.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
public abstract interface annotation class org/hyacinthbots/docgenerator/annotations/ConfigurationBuilderDSL : java/lang/annotation/Annotation {
}

public class org/hyacinthbots/docgenerator/builder/ConfigurationBuilder {
public field commandTypes Ljava/util/List;
public field environment Ljava/lang/String;
public field fileFormat Lorg/hyacinthbots/docgenerator/enums/SupportedFileFormat;
public field fileOutputLocation Ljava/nio/file/Path;
public fun <init> ()V
public fun getCommandTypes ()Ljava/util/List;
public fun getEnabled ()Z
public fun getEnvironment ()Ljava/lang/String;
public fun getFileFormat ()Lorg/hyacinthbots/docgenerator/enums/SupportedFileFormat;
public fun getFileOutputLocation ()Ljava/nio/file/Path;
public final fun getTranslationSupport ()Lorg/hyacinthbots/docgenerator/builder/TranslationSupportConfigurationBuilder;
public fun setCommandTypes (Ljava/util/List;)V
public fun setEnabled (Z)V
public fun setEnvironment (Ljava/lang/String;)V
public fun setFileFormat (Lorg/hyacinthbots/docgenerator/enums/SupportedFileFormat;)V
public fun setFileOutputLocation (Ljava/nio/file/Path;)V
public final fun translationSupport (Lkotlin/jvm/functions/Function1;)V
}

public class org/hyacinthbots/docgenerator/builder/TranslationSupportConfigurationBuilder {
public fun <init> ()V
public fun getBaseLanguage ()Ljava/util/Locale;
public fun getSupportTranslations ()Z
public fun getSupportedLanguages ()Ljava/util/List;
public fun setBaseLanguage (Ljava/util/Locale;)V
public fun setSupportTranslations (Z)V
public fun setSupportedLanguages (Ljava/util/List;)V
}

public final class org/hyacinthbots/docgenerator/builder/_docGeneratorKt {
public static final fun docsGenerator (Lcom/kotlindiscord/kord/extensions/builders/ExtensibleBotBuilder;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

public final class org/hyacinthbots/docgenerator/enums/CommandTypes : java/lang/Enum {
public static final field MESSAGE Lorg/hyacinthbots/docgenerator/enums/CommandTypes;
public static final field SLASH Lorg/hyacinthbots/docgenerator/enums/CommandTypes;
public static final field USER Lorg/hyacinthbots/docgenerator/enums/CommandTypes;
public static fun valueOf (Ljava/lang/String;)Lorg/hyacinthbots/docgenerator/enums/CommandTypes;
public static fun values ()[Lorg/hyacinthbots/docgenerator/enums/CommandTypes;
}

public final class org/hyacinthbots/docgenerator/enums/Environment : java/lang/Enum {
public static final field DEVELOPMENT Lorg/hyacinthbots/docgenerator/enums/Environment;
public static final field PRODUCTION Lorg/hyacinthbots/docgenerator/enums/Environment;
public final fun getValue ()Ljava/lang/String;
public static fun valueOf (Ljava/lang/String;)Lorg/hyacinthbots/docgenerator/enums/Environment;
public static fun values ()[Lorg/hyacinthbots/docgenerator/enums/Environment;
}

public final class org/hyacinthbots/docgenerator/enums/SupportedFileFormat : java/lang/Enum {
public static final field MARKDOWN Lorg/hyacinthbots/docgenerator/enums/SupportedFileFormat;
public static final field TEXT Lorg/hyacinthbots/docgenerator/enums/SupportedFileFormat;
public final fun getFileExtension ()Ljava/lang/String;
public static fun valueOf (Ljava/lang/String;)Lorg/hyacinthbots/docgenerator/enums/SupportedFileFormat;
public static fun values ()[Lorg/hyacinthbots/docgenerator/enums/SupportedFileFormat;
}

public final class org/hyacinthbots/docgenerator/excpetions/ConflictingFileFormatException : java/lang/Exception {
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
}

public final class org/hyacinthbots/docgenerator/excpetions/InvalidEnvironmentVariableException : java/lang/Exception {
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
}

public class org/hyacinthbots/gradle/docgenerator/GeneratorGradlePlugin {
public fun <init> ()V
}

135 changes: 135 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
`java-library`
`maven-publish`
`java-gradle-plugin`

kotlin("jvm")

id("io.gitlab.arturbosch.detekt")
id("com.github.jakemarsden.git-hooks")
id("org.cadixdev.licenser")

id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.11.1"
}

group = "org.hyacinthbots"
version = "0.1.0"
val javaVersion = 17

repositories {
mavenCentral()

maven {
name = "Kotlin Discord"
url = uri("https://maven.kotlindiscord.com/repository/maven-public/")
}

maven {
name = "Sonatype Snapshots"
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
}
}

dependencies {
detektPlugins(libs.detekt)

implementation(libs.kotlin.stdlib)
implementation(libs.kordex)

implementation(libs.logging)

api(libs.jetbrains.annotations)

testImplementation(kotlin("test"))
}

gitHooks {
setHooks(
mapOf("pre-commit" to "clean apiCheck updateLicense detekt")
)
}

gradlePlugin {
plugins {
create("doc-generator") {
id = "org.hyacinthbots.gradle.docgenerator"
implementationClass = "org.hyacinthbots.gradle.docgenerator.GeneratorGradlePlugin"
}
}
}

kotlin {
explicitApi()
jvmToolchain(javaVersion)
}

java {
sourceCompatibility = JavaVersion.toVersion(javaVersion)
targetCompatibility = JavaVersion.toVersion(javaVersion)

withSourcesJar()
}

val sourceJar = task("sourceJar", Jar::class) {
dependsOn(tasks["classes"])
archiveClassifier.set("source")
from(sourceSets.main.get().allSource)
}

val javadoc = task("javadocJar", Jar::class) {
archiveClassifier.set("javadoc")
from(tasks.javadoc)
from(tasks.javadoc)
}

tasks {
test {
useJUnitPlatform()
}

withType<KotlinCompile> {
kotlinOptions {
jvmTarget = javaVersion.toString()
languageVersion = "1.7"
incremental = true
freeCompilerArgs = freeCompilerArgs + listOf(
"-opt-in=kotlin.RequiresOptIn"
)
}
}

withType<JavaCompile> {
options.encoding = "UTF-8"
options.isDeprecation = true
options.release.set(javaVersion)
}

wrapper {
gradleVersion = "7.6"
distributionType = Wrapper.DistributionType.ALL
}
}

detekt {
buildUponDefaultConfig = true
config = files("$rootDir/detekt.yml")

autoCorrect = true
}

license {
setHeader(rootProject.file("HEADER"))
include("**/*.kt", "**/*.java")
}

publishing {
publications {
create<MavenPublication>("publishToMavenLocal") {
from(components.getByName("java"))
artifact(javadoc)
artifact(sourceJar)
}
}
}
Loading

0 comments on commit 319ed97

Please sign in to comment.