mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
OPENIDE #8 Build OpenIDE with bundled amplicode
(cherry picked from commit 61cec1379b6dc44dbb3cd910d39dbcaf335ae7d4) (cherry picked from commit2795822ae6) (cherry picked from commit1c5a2e4844) (cherry picked from commit65566eaa91) (cherry picked from commit40cfdc43b8)
This commit is contained in:
Generated
+1
@@ -2084,6 +2084,7 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/util/test-generator-all/kotlin.util.test-generator-all.iml" filepath="$PROJECT_DIR$/plugins/kotlin/util/test-generator-all/kotlin.util.test-generator-all.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/util/test-generator-api/kotlin.util.test-generator-api.iml" filepath="$PROJECT_DIR$/plugins/kotlin/util/test-generator-api/kotlin.util.test-generator-api.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/kotlin/util/test-generator-fir/kotlin.util.test-generator-fir.iml" filepath="$PROJECT_DIR$/plugins/kotlin/util/test-generator-fir/kotlin.util.test-generator-fir.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/openide/openide.iml" filepath="$PROJECT_DIR$/openide/openide.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@@ -36,5 +36,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.buildScripts.downloader" />
|
||||
<orderEntry type="module" module-name="intellij.idea.community.build.zip" />
|
||||
<orderEntry type="module" module-name="intellij.libraries.maven.resolver.provider" />
|
||||
<orderEntry type="module" module-name="openide" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -9,6 +9,7 @@ import org.jetbrains.intellij.build.createCommunityBuildContext
|
||||
import org.jetbrains.intellij.build.impl.buildDistributions
|
||||
import org.jetbrains.intellij.build.telemetry.TraceManager.spanBuilder
|
||||
import org.jetbrains.intellij.build.telemetry.use
|
||||
import ru.openide.OpenIdePluginBundler
|
||||
|
||||
@ApiStatus.Internal
|
||||
object OpenSourceCommunityInstallersBuildTarget {
|
||||
@@ -41,6 +42,7 @@ object OpenSourceCommunityInstallersBuildTarget {
|
||||
runBlocking(Dispatchers.Default) {
|
||||
val options = OPTIONS.copy(buildStepsToSkip = OPTIONS.buildStepsToSkip + BUILD_STEPS_DISABLED_FOR_GITHUB_ACTIONS)
|
||||
val context = createCommunityBuildContext(options)
|
||||
OpenIdePluginBundler.bundleAmplicodePlugin(context)
|
||||
context.compileModules(moduleNames = null, includingTestsInModules = listOf("intellij.platform.jps.build.tests"))
|
||||
buildDistributions(context)
|
||||
spanBuilder("build standalone JPS").use {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package org.jetbrains.intellij.build
|
||||
|
||||
import org.jetbrains.intellij.build.kotlin.KotlinBinaries
|
||||
import ru.openide.OpenIdePluginBundler
|
||||
import java.nio.file.Path
|
||||
|
||||
open class OpenIdeProperties(val communityHomeDir: Path): IdeaCommunityProperties(communityHomeDir) {
|
||||
@@ -79,4 +80,8 @@ open class OpenIdeProperties(val communityHomeDir: Path): IdeaCommunityPropertie
|
||||
override fun getBaseArtifactName(appInfo: ApplicationInfoProperties, buildNumber: String) = "openIDE-$buildNumber"
|
||||
|
||||
override fun getOutputDirectoryName(appInfo: ApplicationInfoProperties) = "open-ide"
|
||||
|
||||
override fun getAdditionalPluginPaths(context: BuildContext): List<Path> {
|
||||
return OpenIdePluginBundler.getBundlePluginPaths(context)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="kotlin-stdlib" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ide.core" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.jdom" />
|
||||
<orderEntry type="module" module-name="intellij.platform.buildScripts.downloader" />
|
||||
<orderEntry type="module" module-name="intellij.platform.buildScripts" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,57 @@
|
||||
// Copyright (c) Haulmont 2024. All Rights Reserved.
|
||||
// Use is subject to license terms.
|
||||
package ru.openide
|
||||
|
||||
import com.intellij.openapi.util.JDOMUtil
|
||||
import com.intellij.util.io.HttpRequests
|
||||
import org.jdom.Element
|
||||
import org.jetbrains.intellij.build.BuildContext
|
||||
import org.jetbrains.intellij.build.dependencies.BuildDependenciesDownloader
|
||||
import org.jetbrains.intellij.build.dependencies.BuildDependenciesExtractOptions
|
||||
import org.jetbrains.intellij.build.BuildPaths.Companion.COMMUNITY_ROOT
|
||||
import java.net.URI
|
||||
import java.nio.file.Path
|
||||
|
||||
object OpenIdePluginBundler {
|
||||
|
||||
private const val PLUGINS_DIR = "build/download/plugins"
|
||||
private const val AMPLICODE_URL = "https://amplicode.ru"
|
||||
private const val AMPLICODE_MARKETPLACE_URL = "https://amplicode.ru/jetbrains-marketplace"
|
||||
|
||||
fun getBundlePluginPaths(context: BuildContext): List<Path> {
|
||||
val communityHomeDir = context.paths.communityHomeDir
|
||||
return listOf(Path.of("${communityHomeDir}/$PLUGINS_DIR/amplicode"))
|
||||
}
|
||||
|
||||
fun bundleAmplicodePlugin(context: BuildContext) {
|
||||
val majorVersion = context.buildNumber.substringBefore('.')
|
||||
val uri = resolveAmplicodeUri(majorVersion)
|
||||
val archivePath = BuildDependenciesDownloader.downloadFileToCacheLocation(COMMUNITY_ROOT, uri)
|
||||
val targetDir = context.paths.communityHomeDir.resolve("$PLUGINS_DIR/amplicode")
|
||||
BuildDependenciesDownloader.extractFile(archivePath, targetDir, COMMUNITY_ROOT, BuildDependenciesExtractOptions.STRIP_ROOT)
|
||||
}
|
||||
|
||||
private fun resolveAmplicodeUri(majorVersion: String): URI {
|
||||
val result = runCatching {
|
||||
HttpRequests.request(AMPLICODE_MARKETPLACE_URL)
|
||||
.connect { JDOMUtil.load(it.getReader()) }
|
||||
.let { findFragmentUrl(it, majorVersion) }
|
||||
}
|
||||
|
||||
val specificUrl = result.getOrThrow().substring(1)
|
||||
return URI.create("$AMPLICODE_URL$specificUrl")
|
||||
}
|
||||
|
||||
private fun findFragmentUrl(element: Element?, majorVersion: String): String {
|
||||
return element?.getChildren("plugin")
|
||||
?.firstOrNull { it.getAttributeValue("version").extractMajorVersion() == majorVersion }
|
||||
?.getAttributeValue("url")
|
||||
?: throw RuntimeException("Amlicode plugin url not found for $majorVersion version")
|
||||
}
|
||||
|
||||
private fun String.extractMajorVersion(): String? {
|
||||
val regex = Regex("""-(\d+?)-""")
|
||||
val match = regex.find(this)
|
||||
return match?.groupValues?.get(1)
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ object WhiteListUrls {
|
||||
"https://plugins.jetbrains.com", // TODO [OpenIDE]: replace url
|
||||
"https://downloads.marketplace.jetbrains.com/files", // TODO [OpenIDE]: replace url
|
||||
"https://repo1.maven.org/maven2/net/sourceforge/plantuml/plantuml/1.2023.10/plantuml-1.2023.10.jar",
|
||||
"https://amplicode.ru"
|
||||
)
|
||||
|
||||
@JvmStatic
|
||||
|
||||
Reference in New Issue
Block a user