guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#42338] [PATCH 03/34] guix: Add composer-build-system.


From: Julien Lepiller
Subject: [bug#42338] [PATCH 03/34] guix: Add composer-build-system.
Date: Fri, 18 Sep 2020 00:44:03 +0200

Le Mon, 07 Sep 2020 16:09:01 +0200,
Ludovic Courtès <ludo@gnu.org> a écrit :

> Julien Lepiller <julien@lepiller.eu> skribis:
> 
> > * guix/build-system/composer.scm: New file.
> > * guix/build/composer-build-system.scm: New file.
> > * guix/build-system/findclass.php: New file.
> > * Makefile.am: Add them.
> > * doc/guix.texi (Build Systems): Document it.  
> 
> [...]
> 
> > +++ b/guix/build-system/findclass.php
> > @@ -0,0 +1,102 @@
> > +<?php
> > +/**
> > + * Extract the classes in the given file
> > + *
> > + * @param  string            $path The file to check
> > + * @throws \RuntimeException
> > + * @return array             The found classes
> > + */  
> 
> This should rather be under gnu/packages/aux-files IMO.  Also, could
> you add a copyright header and possibly info as to where it
> originates?
> 
> > +(define* (create-autoload vendor composer-file inputs #:key
> > dev-dependencies?)
> > +  (with-output-to-file (string-append vendor "/autoload.php")
> > +    (lambda _
> > +      (format #t "<?php~%")
> > +      (format #t "// autoload.php @generated by Guix~%")
> > +      (format #t "$map = $psr4map = $classmap = array();~%")
> > +      (format #t "require_once '~a/autoload_conf.php';~%" vendor)
> > +      (format #t "require_once
> > '~a/share/web/composer/ClassLoader.php';~%"
> > +                 (assoc-ref inputs "composer-classloader"))
> > +      (format #t "$loader = new
> > \\Composer\\Autoload\\ClassLoader();~%")
> > +      (format #t "foreach ($map as $namespace => $path) {~%")
> > +      (format #t "  $loader->set($namespace, $path);~%")
> > +      (format #t "}~%")
> > +      (format #t "foreach ($psr4map as $namespace => $path) {~%")
> > +      (format #t "  $loader->setPsr4($namespace, $path);~%")
> > +      (format #t "}~%")
> > +      (format #t "$loader->addClassMap($classmap);~%")
> > +      (format #t "$loader->register();~%")))  
> 
> I think it’d be clearer as a single string:
> 
>   (display "\
> <?php
> // autoload.php …")
> 
> Ludo’.

Thanks, here's a new version

Attachment: 0003-guix-Add-composer-build-system.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]