IJPL-797 review built-in-server-api API

GitOrigin-RevId: f11211e4c92f796f9883f7c54ca958ee84e1237a
This commit is contained in:
Vadim Salavatov
2024-07-12 15:39:24 +02:00
committed by intellij-monorepo-bot
parent 78561794df
commit c50186d5cc
5 changed files with 65 additions and 28 deletions

View File

@@ -15,17 +15,7 @@ f:org.jetbrains.builtInWebServer.PathInfo
- f:isLibrary():Z
- f:isRootNameOptionalInPath():Z
- f:isValid():Z
- f:setModuleName(java.lang.String):V
f:org.jetbrains.builtInWebServer.PathQuery
- <init>():V
- <init>(Z,Z,Z,Z):V
- b:<init>(Z,Z,Z,Z,I,kotlin.jvm.internal.DefaultConstructorMarker):V
- f:component1():Z
- f:component2():Z
- f:component3():Z
- f:component4():Z
- f:copy(Z,Z,Z,Z):org.jetbrains.builtInWebServer.PathQuery
- bs:copy$default(org.jetbrains.builtInWebServer.PathQuery,Z,Z,Z,Z,I,java.lang.Object):org.jetbrains.builtInWebServer.PathQuery
- equals(java.lang.Object):Z
- f:getSearchInArtifacts():Z
- f:getSearchInLibs():Z
@@ -33,16 +23,15 @@ f:org.jetbrains.builtInWebServer.PathQuery
- f:getUseVfs():Z
- hashCode():I
a:org.jetbrains.builtInWebServer.WebServerRootsProvider
- sf:Companion:org.jetbrains.builtInWebServer.WebServerRootsProvider$Companion
- <init>():V
- a:getPathInfo(com.intellij.openapi.vfs.VirtualFile,com.intellij.openapi.project.Project):org.jetbrains.builtInWebServer.PathInfo
- isClearCacheOnFileContentChanged(com.intellij.openapi.vfs.VirtualFile):Z
- a:resolve(java.lang.String,com.intellij.openapi.project.Project,org.jetbrains.builtInWebServer.PathQuery):org.jetbrains.builtInWebServer.PathInfo
f:org.jetbrains.builtInWebServer.WebServerRootsProvider$Companion
- f:getEP_NAME():com.intellij.openapi.extensions.ExtensionPointName
f:org.jetbrains.ide.BuiltInServerBundle
- s:message(java.lang.String,java.lang.Object[]):java.lang.String
- s:messagePointer(java.lang.String,java.lang.Object[]):java.util.function.Supplier
- s:getReloadOnSaveGotItContent():java.lang.String
- s:getReloadOnSaveGotItTitle():java.lang.String
- s:getReloadOnSavePreviewGotItContent():java.lang.String
- s:getReloadOnSavePreviewGotItTitle():java.lang.String
a:org.jetbrains.ide.BuiltInServerManager
- sf:Companion:org.jetbrains.ide.BuiltInServerManager$Companion
- <init>():V
@@ -57,14 +46,11 @@ a:org.jetbrains.ide.BuiltInServerManager
f:org.jetbrains.ide.BuiltInServerManager$Companion
- f:getInstance():org.jetbrains.ide.BuiltInServerManager
a:org.jetbrains.ide.CustomPortServerManager
- sf:Companion:org.jetbrains.ide.CustomPortServerManager$Companion
- sf:EP_NAME:com.intellij.openapi.extensions.ExtensionPointName
- <init>():V
- a:cannotBind(java.lang.Exception,I):V
- a:getPort():I
- a:isAvailableExternally():Z
- a:setManager(org.jetbrains.ide.CustomPortServerManager$CustomPortService):V
f:org.jetbrains.ide.CustomPortServerManager$Companion
org.jetbrains.ide.CustomPortServerManager$CustomPortService
- a:isBound():Z
- a:rebind():Z

View File

@@ -7,6 +7,7 @@ import com.intellij.openapi.util.io.FileUtilRt
import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.openapi.vfs.VfsUtilCore
import com.intellij.openapi.vfs.VirtualFile
import org.jetbrains.annotations.ApiStatus
import java.io.File
import java.nio.file.Files
import java.nio.file.Path
@@ -18,7 +19,7 @@ class PathInfo(val ioFile: Path?, file: VirtualFile?, val root: VirtualFile, mod
private set
var moduleName: String? = moduleName
set
@ApiStatus.Internal set
/**
* URL path.

View File

@@ -4,17 +4,49 @@ package org.jetbrains.builtInWebServer
import com.intellij.openapi.extensions.ExtensionPointName
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
data class PathQuery(val searchInLibs: Boolean = true, val searchInArtifacts: Boolean = true, val useHtaccess: Boolean = true, val useVfs: Boolean = false)
import org.jetbrains.annotations.ApiStatus
abstract class WebServerRootsProvider {
@ApiStatus.Internal
companion object {
val EP_NAME: ExtensionPointName<WebServerRootsProvider> = ExtensionPointName("org.jetbrains.webServerRootsProvider")
}
abstract fun resolve(path: String, project: Project, pathQuery: PathQuery): PathInfo?
abstract fun getPathInfo(file: VirtualFile, project: Project): PathInfo?
open fun isClearCacheOnFileContentChanged(file: VirtualFile): Boolean = false
}
}
class PathQuery @ApiStatus.Internal constructor(
val searchInLibs: Boolean,
val searchInArtifacts: Boolean,
val useHtaccess: Boolean,
val useVfs: Boolean,
) {
@ApiStatus.Internal
constructor() : this(searchInLibs = true, searchInArtifacts = true, useHtaccess = true, useVfs = false)
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is PathQuery) return false
return searchInLibs == other.searchInLibs &&
searchInArtifacts == other.searchInArtifacts &&
useHtaccess == other.useHtaccess &&
useVfs == other.useVfs
}
override fun hashCode(): Int {
var result = searchInLibs.hashCode()
result = 31 * result + searchInArtifacts.hashCode()
result = 31 * result + useHtaccess.hashCode()
result = 31 * result + useVfs.hashCode()
return result
}
override fun toString(): String {
return "PathQuery(searchInLibs=$searchInLibs, searchInArtifacts=$searchInArtifacts, useHtaccess=$useHtaccess, useVfs=$useVfs)"
}
}

View File

@@ -2,10 +2,7 @@
package org.jetbrains.ide;
import com.intellij.DynamicBundle;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.PropertyKey;
import org.jetbrains.annotations.*;
import java.util.function.Supplier;
@@ -16,10 +13,28 @@ public final class BuiltInServerBundle {
private BuiltInServerBundle() {
}
public static @NotNull @Nls String getReloadOnSaveGotItTitle() {
return message("reload.on.save.got.it.title");
}
public static @NotNull @Nls String getReloadOnSaveGotItContent() {
return message("reload.on.save.got.it.content");
}
public static @NotNull @Nls String getReloadOnSavePreviewGotItTitle() {
return message("reload.on.save.preview.got.it.title");
}
public static @NotNull @Nls String getReloadOnSavePreviewGotItContent() {
return message("reload.on.save.preview.got.it.content");
}
@ApiStatus.Internal
public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
}
@ApiStatus.Internal
public static @NotNull Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getLazyMessage(key, params);
}

View File

@@ -2,14 +2,17 @@
package org.jetbrains.ide
import com.intellij.openapi.extensions.ExtensionPointName
import org.jetbrains.annotations.ApiStatus
/**
* See [Remote Communication](https://youtrack.jetbrains.com/articles/IDEA-A-63/Remote-Communication)
*/
abstract class CustomPortServerManager {
@ApiStatus.Internal
companion object {
@ApiStatus.Internal
@JvmField
val EP_NAME = ExtensionPointName<CustomPortServerManager>("org.jetbrains.customPortServerManager")
val EP_NAME: ExtensionPointName<CustomPortServerManager> = ExtensionPointName("org.jetbrains.customPortServerManager")
}
abstract val port: Int