Unverified Commit 4765af76 authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

jetbrains: add support for plugins on darwin (#242562)

parents eb7dfa26 9e6b7f92
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -19,8 +19,10 @@ let
  loname = lib.toLower productShort;
in
stdenvNoCC.mkDerivation {
  inherit pname meta src version plugins;
  inherit pname src version plugins;
  passthru.buildNumber = buildNumber;
  passthru.product = product;
  meta = meta // { mainProgram = loname; };
  desktopName = product;
  dontFixup = true;
  installPhase = ''
+16 −6
Original line number Diff line number Diff line
@@ -90,23 +90,33 @@ in {
      passthru.plugins = plugins ++ (ide.plugins or [ ]);
      newPlugins = plugins;
      disallowedReferences = [ ide ];
      nativeBuildInputs = [ autoPatchelfHook ] ++ (ide.nativeBuildInputs or [ ]);
      nativeBuildInputs = (lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook) ++ (ide.nativeBuildInputs or [ ]);
      buildInputs = lib.unique ((ide.buildInputs or [ ]) ++ [ glib ]);

      inherit (ide) meta;

      buildPhase = ''
      buildPhase =
      let
        rootDir = if stdenv.hostPlatform.isDarwin then "Applications/${ide.product}.app/Contents" else meta.mainProgram;
      in
      ''
        cp -r ${ide} $out
        chmod +w -R $out
        rm -f $out/${meta.mainProgram}/plugins/plugin-classpath.txt
        rm -f $out/${rootDir}/plugins/plugin-classpath.txt
        IFS=' ' read -ra pluginArray <<< "$newPlugins"
        for plugin in "''${pluginArray[@]}"
        do
          ln -s "$plugin" -t $out/${meta.mainProgram}/plugins/
          ln -s "$plugin" -t "$out/${rootDir}/plugins/"
        done
        sed "s|${ide.outPath}|$out|" \
          -i $(realpath $out/bin/${meta.mainProgram}) \
          -i $(realpath $out/bin/${meta.mainProgram})

        if test -f "$out/bin/${meta.mainProgram}-remote-dev-server"; then
          sed "s|${ide.outPath}|$out|" \
            -i $(realpath $out/bin/${meta.mainProgram}-remote-dev-server)
        fi

      '' + lib.optionalString stdenv.hostPlatform.isLinux ''
        autoPatchelf $out
      '';
    };
+4 −4
Original line number Diff line number Diff line
@@ -4,17 +4,17 @@
{
  "631" = {
    # Python
    nativeBuildInputs = [ autoPatchelfHook ];
    nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook;
    buildInputs = [ stdenv.cc.cc.lib ];
  };
  "7322" = {
    # Python community edition
    nativeBuildInputs = [ autoPatchelfHook ];
    nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook;
    buildInputs = [ stdenv.cc.cc.lib ];
  };
  "8182" = {
    # Rust (deprecated)
    nativeBuildInputs = [ autoPatchelfHook ];
    nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook;
    buildInputs = [ stdenv.cc.cc.lib ];
    buildPhase = ''
      runHook preBuild
@@ -65,7 +65,7 @@
  };
  "22407" = {
    # Rust
    nativeBuildInputs = [ autoPatchelfHook ];
    nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook;
    buildInputs = [ stdenv.cc.cc.lib ];
    buildPhase = ''
      runHook preBuild