diff --git a/pkgs/applications/editors/jetbrains/patches/bump-jackson-core-in-source.patch b/pkgs/applications/editors/jetbrains/patches/bump-jackson-core-in-source.patch index 2bf5569fe56e..83f94d73a60e 100644 --- a/pkgs/applications/editors/jetbrains/patches/bump-jackson-core-in-source.patch +++ b/pkgs/applications/editors/jetbrains/patches/bump-jackson-core-in-source.patch @@ -5,7 +5,7 @@ ) -private val mavenTelemetryDependencies = listOf("com.fasterxml.jackson.core:jackson-core:2.16.0") -+private val mavenTelemetryDependencies = listOf("com.fasterxml.jackson.core:jackson-core:2.17.0") ++private val mavenTelemetryDependencies = listOf("com.fasterxml.jackson.core:jackson-core:2.19.0") object BundledMavenDownloader { private val mutex = Mutex() diff --git a/pkgs/applications/editors/jetbrains/patches/kotlinc-path.patch b/pkgs/applications/editors/jetbrains/patches/kotlinc-path.patch index 2106611bb412..5a984b42375b 100644 --- a/pkgs/applications/editors/jetbrains/patches/kotlinc-path.patch +++ b/pkgs/applications/editors/jetbrains/patches/kotlinc-path.patch @@ -1,7 +1,7 @@ --- a/src/main/java/org/jetbrains/jpsBootstrap/KotlinCompiler.kt +++ b/src/main/java/org/jetbrains/jpsBootstrap/KotlinCompiler.kt -@@ -14,19 +14,7 @@ - "https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide-plugin-dependencies" +@@ -30,25 +30,7 @@ + fun downloadAndExtractKotlinCompiler(communityRoot: BuildDependenciesCommunityRoot): Path { - // We already have kotlin JPS in the classpath, fetch version from it @@ -10,12 +10,18 @@ - info("Kotlin compiler version is $kotlincVersion") - - val kotlincUrl = getUriForMavenArtifact( -- KOTLIN_IDE_MAVEN_REPOSITORY_URL, +- getMavenRepositoryUrl(), - "org.jetbrains.kotlin", - "kotlin-dist-for-ide", - kotlincVersion, - "jar") -- val kotlincDist = downloadFileToCacheLocation(communityRoot, kotlincUrl) +- val kotlincDist = if (shouldUseMavenLocal()) { +- val path = kotlincUrl.toPath() +- check(path.exists()) { "kotlin-dist-for-ide was not found in the local Maven repository" } +- path +- } else { +- downloadFileToCacheLocation(communityRoot, kotlincUrl) +- } - val kotlinc = extractFileToCacheLocation(communityRoot, kotlincDist) + val kotlinc = Path.of("KOTLIN_PATH_HERE") verbose("Kotlin compiler is at $kotlinc") diff --git a/pkgs/applications/editors/jetbrains/patches/no-download.patch b/pkgs/applications/editors/jetbrains/patches/no-download.patch index 050cd2e57c26..8981d32e4dba 100644 --- a/pkgs/applications/editors/jetbrains/patches/no-download.patch +++ b/pkgs/applications/editors/jetbrains/patches/no-download.patch @@ -46,60 +46,58 @@ return URI.create("${base}/${groupStr}/${artifactId}/${version}/${artifactId}-${version}${classifierStr}.${packaging}") --- a/platform/build-scripts/downloader/src/org/jetbrains/intellij/build/dependencies/JdkDownloader.kt +++ b/platform/build-scripts/downloader/src/org/jetbrains/intellij/build/dependencies/JdkDownloader.kt -@@ -59,11 +59,7 @@ +@@ -71,9 +71,7 @@ infoLog: (String) -> Unit, ): Path { val effectiveVariation = if (isMusl) null else variation - val jdkUrl = getUrl(communityRoot = communityRoot, os = os, arch = arch, isMusl = isMusl, jdkBuildNumber = jdkBuildNumber, variation = effectiveVariation) -- val jdkArchive = downloadFileToCacheLocation(url = jdkUrl.toString(), communityRoot = communityRoot) -- val jdkExtracted = BuildDependenciesDownloader.extractFileToCacheLocation(communityRoot = communityRoot, -- archiveFile = jdkArchive, -- BuildDependenciesExtractOptions.STRIP_ROOT) +- val jdkArchive = downloadFileToCacheLocation(url = jdkUrl, communityRoot = communityRoot) +- val jdkExtracted = extractFileToCacheLocation(communityRoot = communityRoot, archiveFile = jdkArchive, stripRoot = true) + val jdkExtracted = Path.of("JDK_PATH_HERE") val jdkHome = if (os == OS.MACOSX) jdkExtracted.resolve("Contents").resolve("Home") else jdkExtracted infoLog("JPS-bootstrap JDK (jdkHome=$jdkHome, executable=${getJavaExecutable(jdkHome)})") return jdkHome --- a/platform/build-scripts/src/org/jetbrains/intellij/build/LinuxDistributionCustomizer.kt +++ b/platform/build-scripts/src/org/jetbrains/intellij/build/LinuxDistributionCustomizer.kt -@@ -46,7 +46,7 @@ +@@ -62,7 +62,7 @@ /** - * If `true`, a separate *[org.jetbrains.intellij.build.impl.LinuxDistributionBuilder.NO_RUNTIME_SUFFIX].tar.gz artifact without a runtime will be produced. + * If `true`, a separate `*[org.jetbrains.intellij.build.impl.LinuxDistributionBuilder.NO_RUNTIME_SUFFIX].tar.gz` artifact without a runtime will be produced. */ -- var buildArtifactWithoutRuntime = false -+ var buildArtifactWithoutRuntime = true +- var buildArtifactWithoutRuntime: Boolean = false ++ var buildArtifactWithoutRuntime: Boolean = true /** * Set both properties if a .snap package should be produced. --- a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/LinuxDistributionBuilder.kt +++ b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/LinuxDistributionBuilder.kt -@@ -50,7 +50,7 @@ +@@ -76,7 +76,7 @@ val distBinDir = targetPath.resolve("bin") val sourceBinDir = context.paths.communityHomeDir.resolve("bin/linux") - addNativeLauncher(distBinDir, targetPath, arch) + addNativeLauncher(distBinDir = distBinDir, targetPath = targetPath, arch = arch, context = context) - copyFileToDir(NativeBinaryDownloader.getRestarter(context, OsFamily.LINUX, arch), distBinDir) + copyFileToDir(sourceBinDir.resolve("${arch.dirName}/restarter"), distBinDir) copyFileToDir(sourceBinDir.resolve("${arch.dirName}/fsnotifier"), distBinDir) - generateBuildTxt(context, targetPath) - copyDistFiles(context, targetPath, OsFamily.LINUX, arch) -@@ -85,6 +85,8 @@ + generateBuildTxt(context = context, targetDirectory = targetPath) + copyDistFiles(context = context, newDir = targetPath, os = OsFamily.LINUX, arch = arch, libcImpl = targetLibcImpl) +@@ -132,6 +132,8 @@ + } } } - ++ + return@executeStep -+ - val runtimeDir = context.bundledRuntime.extract(os = OsFamily.LINUX, arch = arch) - updateExecutablePermissions(runtimeDir, executableFileMatchers) - val tarGzPath = buildTarGz(arch = arch, runtimeDir = runtimeDir, unixDistPath = osAndArchSpecificDistPath, suffix = suffix(arch)) -@@ -383,7 +385,8 @@ - } - private suspend fun addNativeLauncher(distBinDir: Path, targetPath: Path, arch: JvmArchitecture) { -- val (execPath, licensePath) = NativeBinaryDownloader.getLauncher(context, OsFamily.LINUX, arch) -+ val execPath = Path.of("XPLAT_LAUNCHER_PREBUILT_PATH_HERE/Linux-${arch.archName}/xplat-launcher") -+ val licensePath = Path.of("XPLAT_LAUNCHER_PREBUILT_PATH_HERE/license/xplat-launcher-third-party-licenses.html") - copyFile(execPath, distBinDir.resolve(context.productProperties.baseFileName)) - copyFile(licensePath, targetPath.resolve("license/launcher-third-party-libraries.html")) - } + val runtimeDir = context.bundledRuntime.extract(OsFamily.LINUX, arch, targetLibcImpl) + updateExecutablePermissions(runtimeDir, executableFileMatchers) +@@ -422,7 +424,8 @@ + } + + private suspend fun addNativeLauncher(distBinDir: Path, targetPath: Path, arch: JvmArchitecture, context: BuildContext) { +- val (execPath, licensePath) = NativeBinaryDownloader.getLauncher(context, OsFamily.LINUX, arch) ++ val execPath = Path.of("XPLAT_LAUNCHER_PREBUILT_PATH_HERE/Linux-${arch.archName}/xplat-launcher") ++ val licensePath = Path.of("XPLAT_LAUNCHER_PREBUILT_PATH_HERE/license/xplat-launcher-third-party-licenses.html") + copyFile(execPath, distBinDir.resolve(context.productProperties.baseFileName)) + copyFile(licensePath, targetPath.resolve("license/launcher-third-party-libraries.html")) + } --- a/platform/build-scripts/src/org/jetbrains/intellij/build/impl/brokenPlugins.kt +++ b/platform/build-scripts/src/org/jetbrains/intellij/build/impl/brokenPlugins.kt @@ -9,6 +9,8 @@ @@ -122,20 +120,32 @@ } --- a/platform/build-scripts/src/org/jetbrains/intellij/build/kotlin/KotlinCompilerDependencyDownloader.kt +++ b/platform/build-scripts/src/org/jetbrains/intellij/build/kotlin/KotlinCompilerDependencyDownloader.kt -@@ -23,31 +23,11 @@ +@@ -44,45 +44,11 @@ + - object KotlinCompilerDependencyDownloader { fun downloadAndExtractKotlinCompiler(communityRoot: BuildDependenciesCommunityRoot): Path { - val kotlinJpsPluginVersion = getKotlinJpsPluginVersion(communityRoot) -- val kotlinDistUrl = getUriForMavenArtifact(MAVEN_REPOSITORY_URL, ARTIFACT_GROUP_ID, "kotlin-dist-for-ide", kotlinJpsPluginVersion, "jar") -- val kotlinDistJar = downloadFileToCacheLocation(communityRoot, kotlinDistUrl) +- val kotlinDistUrl = getUriForMavenArtifact(getMavenRepositoryUrl(), ARTIFACT_GROUP_ID, "kotlin-dist-for-ide", kotlinJpsPluginVersion, "jar") +- val kotlinDistJar = if (shouldUseMavenLocal()) { +- val path = kotlinDistUrl.toPath() +- check(path.exists()) { "kotlin-dist-for-ide was not found in the local Maven repository" } +- path +- } else { +- downloadFileToCacheLocation(communityRoot, kotlinDistUrl) +- } - return extractFileToCacheLocation(communityRoot, kotlinDistJar) + return Path.of("KOTLIN_PATH_HERE") } suspend fun downloadKotlinJpsPlugin(communityRoot: BuildDependenciesCommunityRoot): Path = withContext(Dispatchers.IO) { - val kotlinJpsPluginVersion = getKotlinJpsPluginVersion(communityRoot) -- val kotlinJpsPluginUrl = getUriForMavenArtifact(MAVEN_REPOSITORY_URL, ARTIFACT_GROUP_ID, "kotlin-jps-plugin-classpath", kotlinJpsPluginVersion, "jar") +- val kotlinJpsPluginUrl = getUriForMavenArtifact(getMavenRepositoryUrl(), ARTIFACT_GROUP_ID, "kotlin-jps-plugin-classpath", kotlinJpsPluginVersion, "jar") +- +- if (shouldUseMavenLocal()) { +- val kotlinJpsPluginJar = kotlinJpsPluginUrl.toPath() +- check(kotlinJpsPluginJar.exists()) { "kotlin-jps-plugin-classpath was not found in the local Maven repository" } +- return@withContext kotlinJpsPluginJar +- } - - val cacheLocation = getTargetFile(communityRoot, kotlinJpsPluginUrl.toString()) - if (cacheLocation.exists()) { @@ -148,7 +158,9 @@ - println(" * Downloading $kotlinJpsPluginUrl") - val tmpLocation = Files.createTempFile(cacheLocation.parent, cacheLocation.name, ".tmp") - retryWithExponentialBackOff { -- FileUtils.copyURLToFile(kotlinJpsPluginUrl.toURL(), tmpLocation.toFile()) +- kotlinJpsPluginUrl.toURL().openStream().use { +- Files.copy(it, tmpLocation, StandardCopyOption.REPLACE_EXISTING) +- } - } - Files.move(tmpLocation, cacheLocation, StandardCopyOption.ATOMIC_MOVE) - return@withContext cacheLocation diff --git a/pkgs/applications/editors/jetbrains/readme.md b/pkgs/applications/editors/jetbrains/readme.md index 08814498e632..f3998d8d52cf 100644 --- a/pkgs/applications/editors/jetbrains/readme.md +++ b/pkgs/applications/editors/jetbrains/readme.md @@ -43,9 +43,8 @@ fetchurl { - `nix build .#jetbrains.idea-oss.src.src && ./source/build_maven.py source/idea_maven_artefacts.json result/` for IDEA - `nix build .#jetbrains.pycharm-oss.src.src && ./source/build_maven.py source/pycharm_maven_artefacts.json result/` for PyCharm - Update `brokenPlugins` timestamp and hash (from https://web.archive.org/web/*/https://plugins.jetbrains.com/files/brokenPlugins.json) + - Fill out `restarterHash` and `jpsHash` in `./source/sources.json` and make sure the Kotlin version used is correct. - Do a test build - - Notice that sometimes a newer Kotlin version is required to build from source, if build fails, first check the recommended Kotlin version in `.idea/kotlinc.xml` in the IDEA source root - - Feel free to update the Kotlin version to a compatible one - If it succeeds, make a commit - make a PR/merge - If it fails, ping/message GenericNerdyUsername or the nixpkgs Jetbrains maintainer team diff --git a/pkgs/applications/editors/jetbrains/source/build.nix b/pkgs/applications/editors/jetbrains/source/build.nix index 525ee53dc51c..5c53faae74dc 100644 --- a/pkgs/applications/editors/jetbrains/source/build.nix +++ b/pkgs/applications/editors/jetbrains/source/build.nix @@ -37,14 +37,14 @@ let kotlin' = kotlin.overrideAttrs (oldAttrs: { - version = "2.1.10"; + version = "2.2.20"; src = fetchurl { url = oldAttrs.src.url; - sha256 = "sha256-xuniY2iJgo4ZyIEdWriQhiU4yJ3CoxAZVt/uPCqLprE="; + hash = "sha256-gfAmTJBztcu9s/+EGM8sXawHaHn8FW+hpkYvWlrMRCA="; }; }); - jbr = jetbrains.jdk-no-jcef-17; + jbr = jetbrains.jdk-no-jcef; ideaSrc = fetchFromGitHub { owner = "jetbrains"; @@ -238,8 +238,8 @@ let }; brokenPlugins = fetchurl { - url = "https://web.archive.org/web/20250509141038/https://downloads.marketplace.jetbrains.com/files/brokenPlugins.json"; - hash = "sha256-FzYANZSTasCdVEu9jLF1+2PEH8SadUddaIaec5vhKH8="; + url = "https://web.archive.org/web/20251222154957im_/https://downloads.marketplace.jetbrains.com/files/brokenPlugins.json"; + hash = "sha256-Q46zOp5HiY7R8OV3odz5kOybKaLKhzb9rrxnUtEFNZo="; }; in