diff --git a/2ano2/Compiladores/antlr4-bin/view-javadoc b/2ano2/Compiladores/antlr4-bin/view-javadoc index 2125582..1a4baee 100755 --- a/2ano2/Compiladores/antlr4-bin/view-javadoc +++ b/2ano2/Compiladores/antlr4-bin/view-javadoc @@ -4,15 +4,12 @@ # change the following variables to point to browser and javadoc directories! -#BROWSER="/usr/bin/firefox" -BROWSER="firefox" -JDKDIR1=$(ls -fd /usr/share/doc/openjdk-*-jre-headless) -#JDKDIR1="/usr/share/doc/openjdk-8-jre-headless" -#JDKDIR2="/usr/local/share/java/docs" -JDKDIR2="" -#OTHERDIR="/usr/local/doc" -OTHERDIR="/usr/share/doc" -#OTHERDIR="" +# BROWSER="/usr/bin/firefox" +# BROWSER="firefox" +BROWSER="xdg-open" +JDKDIR1="@JDK_DOCS_DIR@" +# JDKDIR2="" +# OTHERDIR="" if [ $# -eq 0 ]; then echo "Usage: view-javadoc " @@ -40,7 +37,7 @@ case ${#docs[@]} in ;; 1) doc=${docs[0]} - "$BROWSER" $doc & + "$BROWSER" $doc >/dev/null & ;; *) select doc in ${docs[@]}; do diff --git a/2ano2/Compiladores/flake.lock b/2ano2/Compiladores/flake.lock index 327c208..a3437a1 100644 --- a/2ano2/Compiladores/flake.lock +++ b/2ano2/Compiladores/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "lastModified": 1709126324, + "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", "owner": "numtide", "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "rev": "d465f4819400de7c8d874d50b982301f28a84605", "type": "github" }, "original": { @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1708958830, - "narHash": "sha256-dsoGSxCJfgisVIzaD6OzJ3xwTk989ZVoLaGLBZNyXmM=", + "lastModified": 1709404120, + "narHash": "sha256-7Y4ybnOhtHIQ47JDeilHKTZeSnFYFkkS2i1S6yFUiBc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "cec67db0d94418c44baae5b81e600c17605bc97d", + "rev": "680c69710d7f94ce712eaaadb2f6e7195c8b2fae", "type": "github" }, "original": { diff --git a/2ano2/Compiladores/flake.nix b/2ano2/Compiladores/flake.nix index 7abdbe5..d87d574 100644 --- a/2ano2/Compiladores/flake.nix +++ b/2ano2/Compiladores/flake.nix @@ -13,12 +13,70 @@ inherit system; }; in { - devShell = pkgs.mkShell { - packages = with pkgs; [ - jdk17 - antlr - doxygen - ]; - }; + devShell = let + string-template = pkgs.stdenv.mkDerivation rec { + pname = "StringTemplate"; + version = "4.3.4"; + src = pkgs.fetchurl { + url = "https://www.stringtemplate.org/download/ST-${version}.jar"; + sha256 = "sha256-+SesOExG10n4texolypTrtIeADE1CSmWFu23O/oV/zM="; + }; + phases = ["installPhase"]; + installPhase = '' + set -eu + mkdir -p $out/share/java + cp ${src} $out/share/java + ''; + }; + + jdk-docs = pkgs.stdenv.mkDerivation rec { + pname = "jdk_doc-all"; + version = "17.0.10"; + src = pkgs.fetchzip { + url = "https://download.oracle.com/otn_software/java/jdk/${version}+11/a473b47039a34b169d45b00685dea3dd/jdk-${version}_doc-all.zip"; + sha256 = "sha256-ZO1BMUhVa6c8C9ey/Ts5MROYA3P2YOkHMjbRs6kdImA="; + }; + installPhase = '' + set -eu + mkdir -p $out/share/doc + cp -r . $out/share/doc + ''; + }; + + antlr4-path = pkgs.symlinkJoin { + name = "antlr4-path"; + paths = [pkgs.antlr string-template]; + }; + + antlr4-bin = pkgs.stdenv.mkDerivation rec { + pname = "antlr4-bin"; + version = "6.4"; + src = ./antlr4-bin; + buildInputs = with pkgs; [bash bc]; + nativeBuildInputs = [pkgs.makeWrapper pkgs.jdk17]; + installPhase = '' + set -e + mkdir -p $out/bin + + substituteInPlace view-javadoc \ + --replace "@JDK_DOCS_DIR@" "${jdk-docs}/share/doc" + + for filename in ./*; do + OUT=$out/bin/"$(basename "$filename")" + cp "$filename" "$OUT" + wrapProgram "$OUT" \ + --prefix PATH : ${pkgs.lib.makeBinPath buildInputs} \ + --set ANTLR4_PATH "${antlr4-path}/share/java" + done + ''; + }; + in + pkgs.mkShell { + packages = with pkgs; [ + jdk17 + doxygen + antlr4-bin + ]; + }; }); } diff --git a/2ano2/Compiladores/libs/ST-4.3.4.jar b/2ano2/Compiladores/libs/ST-4.3.4.jar deleted file mode 100644 index 21a2f61..0000000 Binary files a/2ano2/Compiladores/libs/ST-4.3.4.jar and /dev/null differ