Skip to content
Permalink
Browse files

conditional compilation of WIP and relase version of network-pdf

  • Loading branch information...
MarcFontaine committed Jun 14, 2019
1 parent 055e6e2 commit 1a450824385f70c144ffb52a40ca17463682c9eb
Showing with 32 additions and 16 deletions.
  1. +3 −2 default.nix
  2. +1 −1 doc/Makefile
  3. +6 −4 doc/default.nix
  4. +21 −9 doc/network.tex
  5. +1 −0 release.nix
@@ -49,9 +49,10 @@ let
inherit customConfig;
};
tests = import ./nix/nixos/tests { inherit (commonLib) pkgs; };
network-pdf = import ./doc/default.nix {inherit commonLib; };
network-pdf-wip = import ./doc/default.nix {inherit commonLib; isRelease=false; };
network-pdf = import ./doc/default.nix {inherit commonLib; isRelease=true; };
in {
inherit scripts tests;
inherit (nixTools) nix-tools;
inherit network-pdf;
inherit network-pdf network-pdf-wip;
}
@@ -1,4 +1,4 @@
# See `./latexmkrc` for latexmk configuration
# See `./latexmkrc` and `~/.latexmkrc` for latexmk configuration
LATEX = latexmk
PVC = -pvc

@@ -2,13 +2,15 @@
commonLib ? import ../nix/iohk-common.nix,
pkgs ? commonLib.pkgs,
stdenv ? pkgs.stdenv,
texlive ? pkgs.texlive
texlive ? pkgs.texlive,
isRelease ? false
}:

let
tex = texlive.combine {
# more than we need at the moment, but doesn't cost much to include it
inherit (texlive)
etoolbox
scheme-small
collection-bibtexextra
collection-latex
@@ -23,16 +25,17 @@ let
};
in
stdenv.mkDerivation {
name = "network-pdf";
name = if isRelease then "network-pdf" else "network-pdf-wip";
buildInputs = [ tex pkgs.cddl ];
# this is a hack :
# network.tex includes ../ouroboros-network/test/messages.cddl .
# Therefor the src also includes the parrent directory.
src = pkgs.lib.sourceFilesBySuffices ../. [ ".tex" ".bib" ".pdf" ".cddl"];
buildPhase = ''
# generate one output to catch syntax errors in messages.cddl
# run cddl to catch syntax errors in messages.cddl
cddl ouroboros-network/test/messages.cddl generate 1
cd doc
${if isRelease then "echo >.isRelease" else "rm -f .isRelease"}
latexmk -view=pdf network;
'';
installPhase = ''
@@ -41,4 +44,3 @@ stdenv.mkDerivation {
echo "doc-pdf network $out/network.pdf" >> $out/nix-support/hydra-build-products
'';
}

@@ -1,4 +1,7 @@
\documentclass{report}
\usepackage{etoolbox}
\newbool{isRelease}
\IfFileExists{.isRelease}{\booltrue{isRelease}}{\boolfalse{isRelease}}
\usepackage[margin=2.5cm]{geometry}
\usepackage{amsmath, amssymb, stmaryrd, latexsym, amsthm, mathtools}
\usepackage{mathpazo, times}
@@ -8,8 +11,10 @@
\usepackage{natbib}
% \usepackage{parskip} % very ugly with lemmas, invariants, etc without intervening text

\usepackage{todonotes}
% \usepackage[disable]{todonotes}
\ifbool{isRelease}
{\usepackage[disable]{todonotes}}
{\usepackage{todonotes}}

\usepackage{slashed}
\usepackage{tikz}
\usetikzlibrary{automata, positioning, arrows}
@@ -62,13 +67,20 @@
\newcommand{\subtractdom}{\mathbin{\slashed{\restrictdom}}}
\newcommand{\restrictrange}{\rhd}

% add reference to the relevant Haskell source (as comment)
%\newcommand{\hsref}[1]{} should be hidden in the final document
\newcommand{\hsref}[1]{}
%\newcommand{\hsref}[1]{\href{https://github.com/input-output-hk/ouroboros-network/blob/master/#1}{\emph{Haskell source: #1}}}
%\newcommand{\wip}[1]{\color{magenta}{#1}\color{black}}
\newcommand{\wip}[1]{}
\newcommand{\hide}[1]{}
\ifbool{isRelease}
{
\newcommand{\hsref}[1]{}
\newcommand{\wip}[1]{}
\newcommand{\hide}[1]{}
}
{
\newcommand{\hsref}[1]
{\href{https://github.com/input-output-hk/ouroboros-network/blob/master/#1}
{\emph{Haskell source: #1}}}
\newcommand{\wip}[1]{\color{magenta}{#1}\color{black}}
\newcommand{\hide}[1]{}
}

\newcommand{\trans}[1]{\texttt{#1}}
\newcommand{\state}[1]{\texttt{#1}}
\newcommand{\msg}[1]{\texttt{#1}}
@@ -62,6 +62,7 @@ commonLib.pkgs.lib.mapAttrsRecursiveCond
required-name = "ouroboros-network-required-checks";
extraBuilds = {
tests = default.tests;
network-pdf-wip = default.network-pdf-wip;
network-pdf = default.network-pdf;
};
required-targets = jobs: [

0 comments on commit 1a45082

Please sign in to comment.
You can’t perform that action at this time.