Skip to content

Commit

Permalink
Merge pull request #505 from FWDekker/modern-dokka
Browse files Browse the repository at this point in the history
Modern Dokka
  • Loading branch information
FWDekker authored Dec 5, 2023
2 parents dd6ca0e + a7a7756 commit 6927340
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 24 deletions.
1 change: 1 addition & 0 deletions .config/dokka/logo-icon.svg
17 changes: 14 additions & 3 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
# Security policy
The security of Randomness is important to me.
If you find a vulnerability in Randomness, please
[report the vulnerability](https://github.com/FWDekker/mommy/security/advisories/new) as soon as possible.

Please note that Randomness is distinct from IntelliJ and other IDEs developed by JetBrains.
To report a vulnerability in IntelliJ or another JetBrains product, please
[check JetBrains' security policy](https://www.jetbrains.com/privacy-security/).

## Supported versions
Only the [latest version](https://github.com/FWDekker/intellij-randomness/releases/latest) is ever supported and
supplied with security patches.
Only the [latest version of Randomness](https://github.com/FWDekker/intellij-randomness/releases/latest) is ever
supported and supplied with security patches.

## Reporting a vulnerability
To report a security vulnerability, email `[email protected]` instead of using the issue tracker.
To report a vulnerability in Randomness, please use
[GitHub's vulnerability reporting feature](https://github.com/FWDekker/mommy/security/advisories/new).
You will be contacted as soon as possible.
You will be thanked publicly for reporting the vulnerability, unless you indicate that you prefer to be thanked
anonymously.
59 changes: 59 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CD

on:
release:
types: [ published ]
workflow_dispatch:

jobs:
build-pages:
runs-on: ubuntu-latest

steps:
- name: Checkout Randomness source code
uses: actions/checkout@v4
with:
ref: main
path: main
- name: Checkout Randomness pages
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages
# Required to push updated documentation to repository
token: ${{ secrets.personal_access_token }}

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Set up Gradle
uses: gradle/gradle-build-action@v2
with:
build-root-directory: main/
generate-job-summary: false

- name: Extract version number
working-directory: main/
run: echo "RANDOMNESS_VERSION=v$(cat gradle.properties | grep '^version=' | sed 's/^.*=//')" >> $GITHUB_ENV

- name: Generate new documentation
working-directory: main/
run: ./gradlew dokkaHtml -Pdokka.pagesDir="${{ github.workspace }}/gh-pages/"

- name: Move new documentation into gh-pages
run: |
rm -rf gh-pages/*
mv main/build/dokka/html/* gh-pages/
rm -rf gh-pages/older/**/.git
- name: Push new documentation
working-directory: gh-pages/
run: |
git config --global user.name "FWDekkerBot"
git config --global user.email "[email protected]"
git add --all
git commit -m "Update for ${RANDOMNESS_VERSION}"
git push origin gh-pages
58 changes: 42 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import io.gitlab.arturbosch.detekt.Detekt
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.changelog.Changelog
import org.jetbrains.dokka.DokkaConfiguration.Visibility
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.DokkaBaseConfiguration
import org.jetbrains.dokka.versioning.VersioningConfiguration
import org.jetbrains.dokka.versioning.VersioningPlugin
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URL
import java.time.Year
Expand All @@ -12,18 +17,25 @@ fun properties(key: String) = project.findProperty(key).toString()
/// Plugins
plugins {
// Compilation
id("org.jetbrains.kotlin.jvm") version "1.9.20" // Use latest version, ignoring `gradle.properties`
id("org.jetbrains.intellij") version "1.16.0"
id("org.jetbrains.kotlin.jvm") version "1.9.21" // Use latest version, ignoring `gradle.properties`
id("org.jetbrains.intellij") version "1.16.1"

// Tests/coverage
id("org.jetbrains.kotlinx.kover") version "0.7.4"
id("org.jetbrains.kotlinx.kover") version "0.7.5"

// Static analysis
id("io.gitlab.arturbosch.detekt") version "1.23.3" // See also `gradle.properties`
id("io.gitlab.arturbosch.detekt") version "1.23.4" // See also `gradle.properties`

// Documentation
id("org.jetbrains.changelog") version "2.2.0"
id("org.jetbrains.dokka") version "1.9.10"
id("org.jetbrains.dokka") version "1.9.10" // See also `buildscript { dependencies` below and `gradle.properties`
}

buildscript {
dependencies {
classpath("org.jetbrains.dokka:dokka-base:1.9.10") // See also `plugins` above and `gradle.properties`
classpath("org.jetbrains.dokka:versioning-plugin:1.9.10") // See also `plugins` above and `gradle.properties`
}
}


Expand All @@ -47,6 +59,7 @@ dependencies {
testImplementation("io.kotest:kotest-runner-junit5:${properties("kotestVersion")}")

detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:${properties("detektVersion")}")
dokkaHtmlPlugin("org.jetbrains.dokka:versioning-plugin:${properties("dokkaVersion")}")
}


Expand Down Expand Up @@ -143,13 +156,19 @@ tasks {
dokkaHtml.configure {
notCompatibleWithConfigurationCache("cf. https://github.com/Kotlin/dokka/issues/1217")

pluginsMapConfiguration.set(
mapOf(
"org.jetbrains.dokka.base.DokkaBase" to
"""{ "footerMessage": "© ${Year.now().value} Florine W. Dekker" }"""
)
)
moduleName.set("Randomness v${properties("version")}")
pluginConfiguration<DokkaBase, DokkaBaseConfiguration> {
customAssets = listOf(file(".config/dokka/logo-icon.svg"))
footerMessage = "&copy; ${Year.now().value} Florine&nbsp;W.&nbsp;Dekker"
}
pluginConfiguration<VersioningPlugin, VersioningConfiguration> {
if (project.hasProperty("dokka.pagesDir")) {
val pagesDir = project.property("dokka.pagesDir")
olderVersions = listOf(file("$pagesDir"))
olderVersionsDir = file("$pagesDir/older/")
}
}
moduleName.set("Randomness")
moduleVersion.set("v${properties("version")}")
offlineMode.set(true)
suppressInheritedMembers.set(true)

Expand All @@ -158,11 +177,18 @@ tasks {
includes.from(files("packages.md"))

jdkVersion.set(properties("javaVersion").toInt())

includeNonPublic.set(true)
skipDeprecated.set(false)
languageVersion.set(properties("kotlinVersion"))

documentedVisibilities.set(
setOf(
Visibility.PUBLIC,
Visibility.PRIVATE,
Visibility.PROTECTED,
Visibility.INTERNAL,
Visibility.PACKAGE,
)
)
reportUndocumented.set(true)
skipEmptyPackages.set(true)

sourceLink {
localDirectory.set(file("src/main/kotlin"))
Expand Down
8 changes: 5 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
group=com.fwdekker
# Version number should also be updated in `com.fwdekker.randomness.PersistentSettings.Companion.CURRENT_VERSION`.
version=3.0.0
version=3.0.0-next

# Compatibility
# * `pluginSinceBuild`:
Expand Down Expand Up @@ -30,10 +30,12 @@ kotlinApiVersion=1.7

# Dependencies
# * Detekt should also be updated in `plugins` block.
# * RgxGen should also be updated in `StringSchemeEditor` link.
# * Dokka should also be updated in `plugins` block and in `buildscript { dependencies`.
# * RgxGen should also be updated in `string.ui.value.pattern_help_url` property in `randomness.properties`.
assertjSwingVersion=3.17.1
dateparserVersion=1.0.11
detektVersion=1.23.3
dokkaVersion=1.9.10
emojiVersion=5.1.1
junitVersion=5.10.1
junitRunnerVersion=1.10.1
Expand All @@ -48,5 +50,5 @@ org.gradle.configuration-cache=true
# Kotlin
kotlin.code.style=official
kotlin.stdlib.default.dependency=false
# TODO: Workaround for https://jb.gg/intellij-platform-kotlin-oom, will not be necessary as of Kotlin 1.9.0
# TODO: Workaround for https://jb.gg/intellij-platform-kotlin-oom, will not be necessary once user IDEs use Kotlin 1.9.0
kotlin.incremental.useClasspathSnapshot=false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
2 changes: 1 addition & 1 deletion src/main/kotlin/com/fwdekker/randomness/Settings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,6 @@ class PersistentSettings : PersistentStateComponent<Element> {
/**
* The currently-running version of Randomness.
*/
const val CURRENT_VERSION: String = "3.0.0" // Synchronize this with the version in `gradle.properties`
const val CURRENT_VERSION: String = "3.0.0-next" // Synchronize this with the version in `gradle.properties`
}
}

0 comments on commit 6927340

Please sign in to comment.