Skip to content

Commit

Permalink
Add intellij-annotations module for Language
Browse files Browse the repository at this point in the history
  • Loading branch information
Him188 committed Sep 23, 2024
1 parent d5ae23f commit 85ff322
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 13 deletions.
1 change: 1 addition & 0 deletions app/shared/app-data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ plugins {
kotlin {
sourceSets.commonMain.dependencies {
implementation(projects.app.shared.appPlatform)
implementation(projects.utils.intellijAnnotations)
api(projects.app.shared.videoPlayer.videoPlayerApi)
api(projects.app.shared.videoPlayer.torrentSource)
api(libs.kotlinx.coroutines.core)
Expand Down
1 change: 1 addition & 0 deletions app/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ kotlin {

sourceSets.commonMain.dependencies {
api(projects.utils.platform)
api(projects.utils.intellijAnnotations)
api(libs.kotlinx.coroutines.core)
api(libs.kotlinx.serialization.json)
api(libs.kotlinx.serialization.json.io)
Expand Down
18 changes: 5 additions & 13 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
/*
* Ani
* Copyright (C) 2022-2024 Him188
* Copyright (C) 2024 OpenAni and contributors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license, which can be found at the following link.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* https://github.com/open-ani/ani/blob/main/LICENSE
*/

rootProject.name = "ani"
Expand All @@ -38,6 +29,7 @@ fun includeProject(projectPath: String, dir: String? = null) {

// Utilities shared by client and server (targeting JVM)
includeProject(":utils:platform") // 适配各个平台的基础 API
includeProject(":utils:intellij-annotations")
includeProject(":utils:logging") // shared by client and server (targets JVM)
includeProject(":utils:serialization", "utils/serialization")
includeProject(":utils:coroutines", "utils/coroutines")
Expand Down
24 changes: 24 additions & 0 deletions utils/intellij-annotations/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (C) 2024 OpenAni and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license, which can be found at the following link.
*
* https://github.com/open-ani/ani/blob/main/LICENSE
*/

import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi

plugins {
kotlin("multiplatform")
`ani-mpp-lib-targets`
}

kotlin {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions.freeCompilerArgs.add("-Xexpect-actual-classes")

sourceSets.getByName("jvmMain").dependencies {
api(libs.jetbrains.annotations)
}
}
22 changes: 22 additions & 0 deletions utils/intellij-annotations/src/commonMain/kotlin/Language.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (C) 2024 OpenAni and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license, which can be found at the following link.
*
* https://github.com/open-ani/ani/blob/main/LICENSE
*/

package org.intellij.lang.annotations // 必须和 IJ 相同

/**
* @sample org.intellij.lang.annotations.Language
*/
@OptIn(ExperimentalMultiplatform::class)
@Retention(AnnotationRetention.SOURCE) // 我们不分发, 有 SOURCE 就够了
@OptionalExpectation
expect annotation class Language(
val value: String,
val prefix: String = "",
val suffix: String = ""
) // no actual on any platform. 实际上 JVM 有这个类, 所以如果这里 JVM actual, 会有冲突

0 comments on commit 85ff322

Please sign in to comment.