Skip to content

Commit

Permalink
kotlin: 2.0.0 -> 2.0.21, jetbrains.idea-community-src: 2024.1 -> 2024…
Browse files Browse the repository at this point in the history
….3.1, jetbrains.pycharm-community-src: 2024.1 -> 2024.3 (#360031)
  • Loading branch information
leona-ya authored Dec 14, 2024
2 parents d71a756 + 2344815 commit 57d5ec0
Show file tree
Hide file tree
Showing 10 changed files with 8,492 additions and 2,375 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/build/deps/src/org/jetbrains/intellij/build/impl/BundledMavenDownloader.kt
+++ b/build/deps/src/org/jetbrains/intellij/build/impl/BundledMavenDownloader.kt
@@ -35,7 +35,7 @@
"org.jdom:jdom2:2.0.6.1",*/
)

-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")

object BundledMavenDownloader {
private val mutex = Mutex()
30 changes: 20 additions & 10 deletions pkgs/applications/editors/jetbrains/patches/no-download.patch
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
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
@@ -33,11 +33,7 @@
}

suspend fun getJdkHome(communityRoot: BuildDependenciesCommunityRoot, os: OS, arch: Arch, infoLog: (String) -> Unit): Path {
- val jdkUrl = getUrl(communityRoot = communityRoot, os = os, arch = arch)
@@ -55,11 +55,7 @@
variation: String? = null,
infoLog: (String) -> Unit,
): Path {
- val jdkUrl = getUrl(communityRoot = communityRoot, os = os, arch = arch, jdkBuildNumber = jdkBuildNumber, variation = variation)
- val jdkArchive = downloadFileToCacheLocation(url = jdkUrl.toString(), communityRoot = communityRoot)
- val jdkExtracted = BuildDependenciesDownloader.extractFileToCacheLocation(communityRoot = communityRoot,
- archiveFile = jdkArchive,
Expand All @@ -72,15 +72,15 @@
* 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
@@ -45,7 +45,7 @@
withContext(Dispatchers.IO) {
@@ -50,7 +50,7 @@
val distBinDir = targetPath.resolve("bin")
val sourceBinDir = context.paths.communityHomeDir.resolve("bin/linux")
- copyFileToDir(NativeBinaryDownloader.downloadRestarter(context = context, os = OsFamily.LINUX, arch = arch), distBinDir)
addNativeLauncher(distBinDir, targetPath, arch)
- copyFileToDir(NativeBinaryDownloader.getRestarter(context, OsFamily.LINUX, arch), distBinDir)
+ copyFileToDir(sourceBinDir.resolve("${arch.dirName}/restarter"), distBinDir)
copyFileToDir(sourceBinDir.resolve("${arch.dirName}/fsnotifier"), distBinDir)
copyFileToDir(sourceBinDir.resolve("${arch.dirName}/libdbm.so"), distBinDir)
generateBuildTxt(context, targetPath)
copyDistFiles(context, targetPath, OsFamily.LINUX, arch)
@@ -85,6 +85,8 @@
}
}
Expand All @@ -90,6 +90,16 @@
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"))
}
--- 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 @@
Expand Down Expand Up @@ -137,7 +147,7 @@
- // Ideal solution would be to move compilation to other process altogether and do not modify current process classpath
- println(" * Downloading $kotlinJpsPluginUrl")
- val tmpLocation = Files.createTempFile(cacheLocation.parent, cacheLocation.name, ".tmp")
- suspendingRetryWithExponentialBackOff {
- retryWithExponentialBackOff {
- FileUtils.copyURLToFile(kotlinJpsPluginUrl.toURL(), tmpLocation.toFile())
- }
- Files.move(tmpLocation, cacheLocation, StandardCopyOption.ATOMIC_MOVE)
Expand Down
8 changes: 6 additions & 2 deletions pkgs/applications/editors/jetbrains/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ To test the build process of every IDE (as well as the process for adding plugin
- This will update binary IDEs and plugins, and automatically commit them
- Source builds need a bit more effort, as they **aren't automated at the moment**:
- Find the build of the stable release you want to target (usually different for pycharm and idea, should have three components)
- I find this at https://jetbrains.com/updates/updates.xml (search for `product name="`, then `fullNumber`)
- Build number is avaliable on JetBrains website:
- IDEA: https://www.jetbrains.com/idea/download/other.html
- PyCharm: https://www.jetbrains.com/pycharm/download/other.html
- Update the `version` & `buildNumber` fields in source/default.nix
- Empty the `ideaHash`, `androidHash`, `jpsHash` and `restarterHash` (only `ideaHash` and `restarterHash` changes on a regular basis) fields and try to build to get the new hashes
- Run `nix build .#jetbrains.(idea/pycharm)-community-src.src.src`, then `./source/build_maven.py source/idea_maven_artefacts.json result/`
- Run these commands respectively:
- `nix build .#jetbrains.idea-community-src.src.src && ./source/build_maven.py source/idea_maven_artefacts.json result/` for IDEA
- `nix build .#jetbrains.pycharm-community-src.src.src && ./source/build_maven.py source/pycharm_maven_artefacts.json result/` for PyCharm
- Update `source/brokenPlugins.json` (from https://plugins.jetbrains.com/files/brokenPlugins.json)
- Do a test build
- If it succeeds, make a PR/merge
Expand Down

Large diffs are not rendered by default.

52 changes: 35 additions & 17 deletions pkgs/applications/editors/jetbrains/source/build.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ fetchFromGitHub
, fetchurl
, fetchzip
, lib
, linkFarm
, makeWrapper
Expand All @@ -11,6 +12,7 @@
, ant
, cmake
, glib
, glibc
, jetbrains
, kotlin
, libdbusmenu
Expand Down Expand Up @@ -118,6 +120,9 @@ let
inherit src;
sourceRoot = "${src.name}/native/restarter";
cargoHash = restarterHash;

# Allow static linking
buildInputs = [ glibc glibc.static ];
};

jpsRepo = runCommand "jps-bootstrap-repository"
Expand Down Expand Up @@ -177,6 +182,8 @@ let
"https://packages.jetbrains.team/maven/p/ki/maven/${entry.url}"
"https://packages.jetbrains.team/maven/p/dpgpv/maven/${entry.url}"
"https://cache-redirector.jetbrains.com/download.jetbrains.com/teamcity-repository/${entry.url}"
"https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide-plugin-dependencies/${entry.url}"
"https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/public/p/compose/dev/${entry.url}"
];
sha256 = entry.hash;
};
Expand All @@ -188,16 +195,22 @@ let
repoUrl = "https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide-plugin-dependencies";
groupId = builtins.replaceStrings [ "." ] [ "/" ] "org.jetbrains.kotlin";
artefactId = "kotlin-jps-plugin-classpath";
version = "1.9.22";
version = "2.0.21-RC";
in
fetchurl {
url = repoUrl + "/" + groupId + "/" + artefactId + "/" + version + "/" + artefactId + "-" + version + ".jar";
hash = "sha256-ZPfEceGoIChDmjIAjjhDZpyMWQ7/DtP9Ll4YIrZN+PM=";
hash = "sha256-jFjxP1LGjrvc1x2XqF5gg/SeKdSFNefxABBlrYl81zA=";
};

targetClass = if buildType == "pycharm" then "intellij.pycharm.community.build" else "intellij.idea.community.build";
targetName = if buildType == "pycharm" then "PyCharmCommunityInstallersBuildTarget" else "OpenSourceCommunityInstallersBuildTarget";

xplat-launcher = fetchzip {
url = "https://cache-redirector.jetbrains.com/intellij-dependencies/org/jetbrains/intellij/deps/launcher/242.22926/launcher-242.22926.tar.gz";
hash = "sha256-ttrQZUbBvvyH1BSVt1yWOoD82WwRi/hkoRfrsdCjwTA=";
stripRoot = false;
};

in
stdenvNoCC.mkDerivation rec {
pname = "${buildType}-community";
Expand All @@ -210,27 +223,32 @@ stdenvNoCC.mkDerivation rec {
patches = [
../patches/no-download.patch
../patches/disable-sbom-generation.patch
../patches/bump-jackson-core-in-source.patch
];

postPatch = ''
cp ${restarter}/bin/restarter bin/linux/amd64/restarter
cp ${fsnotifier}/bin/fsnotifier bin/linux/amd64/fsnotifier
cp ${libdbm}/lib/libdbm.so bin/linux/amd64/libdbm.so
sed \
-e 's|JPS_PLUGIN_CLASSPATH_HERE|${kotlin-jps-plugin-classpath}|' \
-e 's|KOTLIN_PATH_HERE|${kotlin}|' \
-i platform/build-scripts/src/org/jetbrains/intellij/build/kotlin/KotlinCompilerDependencyDownloader.kt
sed \
-e 's|JDK_PATH_HERE|${jbr}/lib/openjdk|' \
-i platform/build-scripts/downloader/src/org/jetbrains/intellij/build/dependencies/JdkDownloader.kt
sed \
-e 's|BROKEN_PLUGINS_HERE|${./brokenPlugins.json}|' \
-i platform/build-scripts/src/org/jetbrains/intellij/build/impl/brokenPlugins.kt
sed \
-e 's|MAVEN_REPO_HERE|${mvnRepo}/.m2/repository/|' \
-e 's|MAVEN_PATH_HERE|${maven}/maven|' \
-i build/deps/src/org/jetbrains/intellij/build/impl/BundledMavenDownloader.kt
substituteInPlace \
platform/build-scripts/src/org/jetbrains/intellij/build/kotlin/KotlinCompilerDependencyDownloader.kt \
--replace-fail 'JPS_PLUGIN_CLASSPATH_HERE' '${kotlin-jps-plugin-classpath}' \
--replace-fail 'KOTLIN_PATH_HERE' '${kotlin}'
substituteInPlace \
platform/build-scripts/downloader/src/org/jetbrains/intellij/build/dependencies/JdkDownloader.kt \
--replace-fail 'JDK_PATH_HERE' '${jbr}/lib/openjdk'
substituteInPlace \
platform/build-scripts/src/org/jetbrains/intellij/build/impl/brokenPlugins.kt \
--replace-fail 'BROKEN_PLUGINS_HERE' '${./brokenPlugins.json}'
substituteInPlace \
platform/build-scripts/src/org/jetbrains/intellij/build/impl/LinuxDistributionBuilder.kt \
--replace-fail 'XPLAT_LAUNCHER_PREBUILT_PATH_HERE' '${xplat-launcher}'
substituteInPlace \
build/deps/src/org/jetbrains/intellij/build/impl/BundledMavenDownloader.kt \
--replace-fail 'MAVEN_REPO_HERE' '${mvnRepo}/.m2/repository/' \
--replace-fail 'MAVEN_PATH_HERE' '${maven}/maven'
echo '${buildNumber}.SNAPSHOT' > build.txt
'';

Expand All @@ -244,7 +262,7 @@ stdenvNoCC.mkDerivation rec {
-Djps.kotlin.home=${kotlin} \
-Dintellij.build.target.os=linux \
-Dintellij.build.target.arch=x64 \
-Dintellij.build.skip.build.steps=mac_artifacts,mac_dmg,mac_sit,windows_exe_installer,windows_sign,repair_utility_bundle_step \
-Dintellij.build.skip.build.steps=mac_artifacts,mac_dmg,mac_sit,windows_exe_installer,windows_sign,repair_utility_bundle_step,sources_archive \
-Dintellij.build.unix.snaps=false \
--java-argfile-target=java_argfile \
/build/source \
Expand Down
7 changes: 2 additions & 5 deletions pkgs/applications/editors/jetbrains/source/build_maven.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,8 @@ def add_libraries(root_path: str, hashes: list[dict[str, str]], projects_to_proc
add_entries(sources, targets, hashes)

modules_xml = parse(open(root_path+"/modules.xml").read())
for entry in modules_xml["project"]["component"]:
if entry["@name"] != "ProjectModuleManager":
continue
for module in entry["modules"]["module"]:
projects_to_process.append(module["@filepath"])
for module in modules_xml["project"]["component"]["modules"]["module"]:
projects_to_process.append(module["@filepath"])


def add_iml(path: str, hashes: list[dict[str, str]], projects_to_process: list[str]):
Expand Down
26 changes: 13 additions & 13 deletions pkgs/applications/editors/jetbrains/source/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@

{
idea-community = callPackage ./build.nix {
version = "2024.1.3";
buildNumber = "241.17890.1";
version = "2024.3.1";
buildNumber = "243.22562.145";
buildType = "idea";
ideaHash = "sha256-jWFnewxRkriSmV6CgGX1r//uaErMINfx3Z+JpkE34jk=";
androidHash = "sha256-hX2YdRYNRg0guskNiYfxdl9osgZojRen82IhgA6G0Eo=";
jpsHash = "sha256-Abr7L1FyqzRoUSDtsJs3cTEdkhORY5DzsQnOo5irVRI=";
restarterHash = "sha256-XdjyuJUQMvhC0fl6sMj0sRWlqgUb3ZgBmKKXcD3egkk=";
ideaHash = "sha256-So55gxse7TU05F2c1pe/2BPjZ6xNlCi0Lhaxm+45w/M=";
androidHash = "sha256-2ZLTh3mwrIWOqn1UHqAVibG5JvfvxinqDna/EGxd0Ds=";
jpsHash = "sha256-p3AEHULhVECIicyhCYNkxeQoMAorrbvoIj7jcqxYD2s=";
restarterHash = "sha256-m6HK4kxtAlN6EaszI/xpkVYDaY8W3Qn9FGWgvaW/UYI=";
mvnDeps = ./idea_maven_artefacts.json;
};
pycharm-community = callPackage ./build.nix {
version = "2024.1.3";
buildNumber = "241.17890.14";
version = "2024.3";
buildNumber = "243.21565.199";
buildType = "pycharm";
ideaHash = "sha256-tTB91/RHEWP/ZILPNFAbolVBLvgjLXTdD/uF/pdJ22Y=";
androidHash = "sha256-hX2YdRYNRg0guskNiYfxdl9osgZojRen82IhgA6G0Eo=";
jpsHash = "sha256-Abr7L1FyqzRoUSDtsJs3cTEdkhORY5DzsQnOo5irVRI=";
restarterHash = "sha256-TbTIz9pc5wqL54TAMRoQ/9Ax/qsDp+r+h5jn2ub0hes=";
mvnDeps = ./idea_maven_artefacts.json;
ideaHash = "sha256-NohKF30k3aSYgDUPKrhE2CZmjzT8TK0zw++0Low1OfM=";
androidHash = "sha256-H1JegxX6sj7XG0EdZhtzL92GupCCoIq4akgK9t06nXM=";
jpsHash = "sha256-p3AEHULhVECIicyhCYNkxeQoMAorrbvoIj7jcqxYD2s=";
restarterHash = "sha256-CnTYpYx6SoT6XaS79cm0QpIijIiPKpFh4LfiPJkByXA=";
mvnDeps = ./pycharm_maven_artefacts.json;
};
}
Loading

0 comments on commit 57d5ec0

Please sign in to comment.