From 7405e0c83f8f4eee5c4c40e809a40f2e4407a38c Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sun, 8 Jan 2023 02:07:40 -0500 Subject: [PATCH] gnu: Add ruby-sorbet-runtime. * gnu/packages/ruby.scm (ruby-sorbet-runtime): New variable. (sorbet-version): New variable. (sorbet-monorepo): New variable. (make-sorbet-gem-source): New procedure. --- gnu/packages/ruby.scm | 51 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm index c3edbfa988..ead64b98ea 100644 --- a/gnu/packages/ruby.scm +++ b/gnu/packages/ruby.scm @@ -89,6 +89,7 @@ (define-module (gnu packages ruby) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix gexp) + #:use-module (guix modules) #:use-module (guix utils) #:use-module (guix build-system gnu) #:use-module (gnu packages xml) @@ -12337,6 +12338,56 @@ (define-public ruby-syntax-tree (home-page "https://github.com/ruby-syntax-tree/syntax_tree") (license license:expat))) +(define sorbet-version "0.5.10610.20230106174520-1fa668010") + +(define sorbet-monorepo + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/sorbet/sorbet") + (commit sorbet-version))) + (file-name (string-append "sorbet-" sorbet-version "-checkout")) + (sha256 + (base32 + "0f21dl06alxwn6xgdxyrkd58plmmsv04z2bcls9ld4cfzsrs5537")))) + +(define (make-sorbet-gem-source gem) + "Return the source of GEM, a sub-directory." + (computed-file + (string-append "ruby-sorbet-" gem "-" sorbet-version "-checkout") + (with-imported-modules (source-module-closure '((guix build utils))) + #~(begin + (use-modules (guix build utils)) + (copy-recursively (string-append #$sorbet-monorepo + "/gems/sorbet-" #$gem) + #$output))))) + +(define-public ruby-sorbet-runtime + (package + (name "ruby-sorbet-runtime") + (version sorbet-version) + (source (make-sorbet-gem-source "runtime")) + (build-system ruby-build-system) + ;; 25 out of 841 tests currently fail, seemingly due to invalid + ;; assumptions about file names in the build environment (see: + ;; https://github.com/sorbet/sorbet/issues/6650). + (arguments (list #:tests? #f)) + (native-inputs + (list ruby-minitest + ruby-mocha + ruby-rubocop + ruby-rubocop-performance + ruby-concurrent-ruby + ruby-pry + ruby-pry-byebug + ruby-parser + ruby-subprocess)) + (synopsis "Runtime type checking component for Sorbet") + (description "Sorbet's runtime type checking component. Sorbet is a +powerful type checker for Ruby.") + (home-page "https://sorbet.org") + (license license:asl2.0))) + (define-public ruby-mustache (package (name "ruby-mustache")