IJPL-156609 Plugin licensing is unavailable in community ed. IDEs: ClassNotFoundException JetBrains Marketplace Licensing (part 1)

GitOrigin-RevId: bffeb8a9c6c80c2a4462394e5ff269540e17a236
This commit is contained in:
Vladimir Krivosheev
2024-06-14 07:41:26 +02:00
committed by intellij-monorepo-bot
parent b601b6bb12
commit e7e68d820f
4 changed files with 61 additions and 30 deletions

View File

@@ -32,7 +32,7 @@ fun buildDevMain(): Collection<Path> {
var homePath: String? = null
var newClassPath: Collection<Path>? = null
runBlocking(Dispatchers.Default) {
val batchSpanProcessorScope = childScope()
val batchSpanProcessorScope = childScope("BatchSpanProcessor")
val spanProcessor = BatchSpanProcessor(coroutineScope = batchSpanProcessorScope, spanExporters = java.util.List.of(ConsoleSpanExporter()))
val tracerProvider = SdkTracerProvider.builder()

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.intellij.build
import io.opentelemetry.api.common.AttributeKey
@@ -13,8 +13,7 @@ import java.nio.file.Path
*/
data class ProprietaryBuildTools(
/**
* This tool is required to sign files in distribution. If it is null the files won't be signed and OS may show
* a warning when user tries to run them.
* This tool is required to sign files in distribution. If it is null, the files won't be signed and OS may show a warning when a user tries to run them.
*/
val signTool: SignTool,
@@ -35,7 +34,7 @@ data class ProprietaryBuildTools(
val artifactsServer: ArtifactsServer?,
/**
* Properties required to bundle a default version of feature usage statistics white list into IDE
* Properties required to bundle a default version of feature usage statistics allowlist into the IDE
*/
val featureUsageStatisticsProperties: List<FeatureUsageStatisticsProperties>?,
@@ -46,26 +45,30 @@ data class ProprietaryBuildTools(
val licenseServerHost: String?
) {
companion object {
val DUMMY = ProprietaryBuildTools(
signTool = object : SignTool {
override val signNativeFileMode: SignNativeFileMode
get() = SignNativeFileMode.DISABLED
internal val DUMMY_SIGN_TOOL: SignTool = object : SignTool {
override val signNativeFileMode: SignNativeFileMode
get() = SignNativeFileMode.DISABLED
override suspend fun signFiles(files: List<Path>, context: BuildContext?, options: PersistentMap<String, String>) {
Span.current().addEvent("files won't be signed", Attributes.of(
AttributeKey.stringArrayKey("files"), files.map(Path::toString),
AttributeKey.stringKey("reason"), "sign tool isn't defined",
))
}
override suspend fun signFiles(files: List<Path>, context: BuildContext?, options: PersistentMap<String, String>) {
Span.current().addEvent(
"files won't be signed", Attributes.of(
AttributeKey.stringArrayKey("files"), files.map(Path::toString),
AttributeKey.stringKey("reason"), "sign tool isn't defined",
)
)
}
override suspend fun getPresignedLibraryFile(path: String, libName: String, libVersion: String, context: BuildContext): Path? {
error("Must be not called if signNativeFileMode equals to ENABLED")
}
override suspend fun getPresignedLibraryFile(path: String, libName: String, libVersion: String, context: BuildContext): Path? {
error("Must be not called if signNativeFileMode equals to ENABLED")
}
override suspend fun commandLineClient(context: BuildContext, os: OsFamily, arch: JvmArchitecture): Path? {
return null
}
},
override suspend fun commandLineClient(context: BuildContext, os: OsFamily, arch: JvmArchitecture): Path? {
return null
}
}
val DUMMY: ProprietaryBuildTools = ProprietaryBuildTools(
signTool = DUMMY_SIGN_TOOL,
scrambleTool = null,
macOsCodesignIdentity = null,
artifactsServer = null,

View File

@@ -217,7 +217,23 @@ internal fun generatePluginClassPath(pluginEntries: List<Pair<PluginBuildDescrip
putMoreLikelyPluginJarsFirst(pluginDir.fileName.toString(), filesInLibUnderPluginDir = files)
}
writeEntry(out = out, files = files, pluginDir = pluginDir, pluginDescriptorContent = moduleOutputPatcher.getPatchedPluginXml(pluginAsset.layout.mainModule))
var pluginDescriptorContent: ByteArray? = null
for (file in files) {
if (file.toString().endsWith(".jar")) {
pluginDescriptorContent = HashMapZipFile.load(file).use { zip ->
zip.getRawEntry("META-INF/plugin.xml")?.getData(zip)
}
if (pluginDescriptorContent != null) {
break
}
}
}
if (pluginDescriptorContent == null) {
pluginDescriptorContent = moduleOutputPatcher.getPatchedPluginXml(pluginAsset.layout.mainModule)
}
writeEntry(out = out, files = files, pluginDir = pluginDir, pluginDescriptorContent = pluginDescriptorContent)
}
out.close()

View File

@@ -60,6 +60,7 @@ data class BuildRequest(
@JvmField val generateRuntimeModuleRepository: Boolean = false,
@JvmField val isUnpackedDist: Boolean = System.getProperty("idea.dev.build.unpacked").toBoolean(),
@JvmField val scrambleTool: ScrambleTool? = null,
@JvmField val writeCoreClasspath: Boolean = true,
@@ -150,11 +151,11 @@ internal suspend fun buildProduct(request: BuildRequest, createProductProperties
if (request.writeCoreClasspath) {
launch(Dispatchers.IO) {
val cp = classPath
val classPathString = classPath
.asSequence()
.filter { !excludedLibJars.contains(it.fileName.toString()) }
.joinToString(separator = "\n")
Files.writeString(runDir.resolve("core-classpath.txt"), cp)
Files.writeString(runDir.resolve("core-classpath.txt"), classPathString)
}
}
@@ -202,8 +203,7 @@ internal suspend fun buildProduct(request: BuildRequest, createProductProperties
if (context.generateRuntimeModuleRepository) {
launch {
val allDistributionEntries = platformDistributionEntriesDeferred.await().asSequence() +
pluginDistributionEntriesDeferred.await().first.asSequence().flatMap { it.second }
val allDistributionEntries = platformDistributionEntriesDeferred.await().asSequence() + pluginDistributionEntriesDeferred.await().first.asSequence().flatMap { it.second }
spanBuilder("generate runtime repository").useWithScope(Dispatchers.IO) {
generateRuntimeModuleRepositoryForDevBuild(entries = allDistributionEntries, targetDirectory = runDir, context = context)
}
@@ -443,7 +443,7 @@ private suspend fun createBuildContext(
// will be enabled later in [com.intellij.platform.ide.bootstrap.enableJstack] instead
enableCoroutinesDump = false,
options = options,
customBuildPaths = result
customBuildPaths = result,
)
}
}
@@ -460,8 +460,20 @@ private suspend fun createBuildContext(
windowsDistributionCustomizer = object : WindowsDistributionCustomizer() {},
linuxDistributionCustomizer = object : LinuxDistributionCustomizer() {},
macDistributionCustomizer = object : MacDistributionCustomizer() {},
proprietaryBuildTools = ProprietaryBuildTools.DUMMY,
jarCacheManager = jarCacheManager
jarCacheManager = jarCacheManager,
proprietaryBuildTools = if (request.scrambleTool == null) {
ProprietaryBuildTools.DUMMY
}
else {
ProprietaryBuildTools(
scrambleTool = request.scrambleTool,
signTool = ProprietaryBuildTools.DUMMY_SIGN_TOOL,
macOsCodesignIdentity = null,
featureUsageStatisticsProperties = null,
artifactsServer = null,
licenseServerHost = null,
)
},
)
}
}