diff --git a/.config/dokka/logo-icon.svg b/.config/dokka/logo-icon.svg new file mode 120000 index 000000000..58298a7a4 --- /dev/null +++ b/.config/dokka/logo-icon.svg @@ -0,0 +1 @@ +../../src/main/resources/icons/randomness.svg \ No newline at end of file diff --git a/.github/SECURITY.md b/.github/SECURITY.md index febc65443..95e102e60 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -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 `security@fwdekker.com` 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. diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 000000000..26eba4913 --- /dev/null +++ b/.github/workflows/cd.yml @@ -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 "bot@fwdekker.com" + git add --all + git commit -m "Update for ${RANDOMNESS_VERSION}" + + git push origin gh-pages diff --git a/build.gradle.kts b/build.gradle.kts index 6a8ef223b..21724ba04 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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 @@ -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` + } } @@ -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")}") } @@ -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 { + customAssets = listOf(file(".config/dokka/logo-icon.svg")) + footerMessage = "© ${Year.now().value} Florine W. Dekker" + } + pluginConfiguration { + 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) @@ -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")) diff --git a/gradle.properties b/gradle.properties index e4a08a450..7a97e8f09 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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`: @@ -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 @@ -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 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5e6b54271..aa49780cd 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/src/main/kotlin/com/fwdekker/randomness/Settings.kt b/src/main/kotlin/com/fwdekker/randomness/Settings.kt index 90c244b0d..5ad707ad3 100644 --- a/src/main/kotlin/com/fwdekker/randomness/Settings.kt +++ b/src/main/kotlin/com/fwdekker/randomness/Settings.kt @@ -126,6 +126,6 @@ class PersistentSettings : PersistentStateComponent { /** * 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` } }