contrib/abcl-build: now runs on new build download infrastructure

Incomplete implementation of probing for working local exectuables.
Currently we always download and use a private ABCL unzip of binary
archives to the XDG user space allocated to such persistence.

All tests succeed under macOS/Windows.
parent 0e7a41a0
......@@ -3,13 +3,22 @@
(defun make-dist (version-string)
(warn "Unimplemented"))
(defun build-abcl (&key force
(batch t)
compile-system
jar
(defun build-abcl (&key
force ;; DEPRECATED: not sure of meaning in new underlying API
(batch t) ;; DEPRECATED: lack of meaning
compile-system ;; DEPRECATED: COMPILE-SYSTEM is always invoked
jar ;; DEPRECATED: a jar archive is always built
clean
full)
(warn "Unimplemented"))
full) ;; DEPRECATED: a full build is always performed
(unless (ignore-errors (asdf:find-system :abcl))
(return-from build-abcl
nil))
(let ((targets '("abcl")))
(when clean
(push "abcl.clean" targets))
(ant/call (asdf:system-relative-pathname :abcl "build.xml")
(nreverse targets))))
......@@ -10,18 +10,29 @@
#+(or) ;; need apache-ant-1.9 for JVM version 49.0
#p"http://www-eu.apache.org/dist/ant/binaries/apache-ant-1.10.1-bin.zip")
(defun xdg/ant-executable ()
(xdg/executable (ant-zip-uri) "bin/ant"))
#+(or)
(defun xdg/ant-executable ()
(let* ((uri (ant-zip-uri))
(directory (xdg/abcl-install-root uri))
(ant-root-name (let ((name (pathname-name uri)))
(subseq name 0 (- (length name) (length "-bin")))))
(ant-home (merge-pathnames (make-pathname :directory `(:relative ,ant-root-name))
directory)))
directory))
(ant (merge-pathnames #p"bin/ant" ant-home))
result)
(dolist (p (possible-executable-names ant))
(when (probe-file p)
(return-from xdg/ant-executable
(values
(probe-file p)
ant))))
;; failure
(values
(probe-file
(localize-executable-name
(merge-pathnames #p"bin/ant" ant-home)))
ant-home)))
nil
ant)))
(defun ant/install ()
(unless (xdg/ant-executable)
......
......@@ -31,7 +31,7 @@
(let ((archive
(download uri))
(root
(xdg/abcl-download-root :for-uri uri)))
(xdg/abcl-install-root uri)))
(ensure-directories-exist root)
(sys:unzip archive root)
(values
......@@ -51,6 +51,27 @@ Returns the local pathname of the download artifact."
destination)
destination)
(defun xdg/executable (uri relative-path)
(let* ((directory (xdg/abcl-install-root uri))
(root (let ((name (pathname-name uri)))
(subseq name 0 (- (length name) (length "-bin")))))
(home (merge-pathnames (make-pathname :directory `(:relative ,root))
directory))
(path (merge-pathnames relative-path home)))
(dolist (p (possible-executable-names path))
(when (probe-file p)
(return-from xdg/executable
(values
(probe-file p)
path))))
;; failure
(values
nil
path)))
......
......@@ -4,10 +4,7 @@
#p"http://www-eu.apache.org/dist/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.zip")
(defun xdg/mvn-executable ()
(probe-file
(localize-executable-name
(merge-pathnames "bin/mvn"
(xdg/abcl-install-root (maven-zip-uri))))))
(xdg/executable (maven-zip-uri) "bin/mvn"))
(defparameter *maven-install-root* nil)
......
......@@ -7,7 +7,6 @@
(prove:ok
(abcl-build:build-abcl)
"Testing BUILD-ABCL…")
(prove:diag )
(prove:ok
(abcl-build:make-dist (format nil "test-" (random (expt 2 32))))
"Testing MAKE-DIST…")
......
(in-package :abcl/build/t)
(prove:plan 1)
(prove:diag "Testing private installation of Ant…")
(prove:ok (build-abcl:ant/install))
(prove:ok
(build-abcl:ant/install)
"Testing ABCL-specific Ant installation of Ant into XDG hierarchy…")
(if (not (ignore-errors (asdf:find-system :abcl)))
(prove:diag "Unable to find 'abcl.asd'.~&Enable ASDF to find 'abcl.asd' by adding symlink to ~~/common-lisp/ to ABCL source directory.")
......
(in-package :abcl/build/t)
(prove:plan 1)
(prove:diag "Testing private installation of Maven…")
(prove:ok
(abcl/build:mvn/install))
(abcl/build:mvn/install)
"Testing ABCL-specific Ant installation of Maven into XDG hierarchy…")
(if (not (ignore-errors (asdf:find-system :abcl)))
(prove:diag "Unable to find 'abcl.asd'.~&Enable ASDF to find 'abcl.asd' by adding symlink to ~~/common-lisp/ to ABCL source directory.")
......
(in-package :abcl/build/t)
(let ((possible-executables
(abcl/build:possible-executable-names "java")))
(prove:plan 1)
(prove:is-type possible-executables
'cons))
(prove:plan 1)
(prove:is-type (abcl/build:possible-executable-names "java")
'cons)
(prove:plan 1)
(prove:is (length (abcl/build:split-string "one.two.three." #\.))
3)
4)
(prove:finalize)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment