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 @@ ...@@ -3,13 +3,22 @@
(defun make-dist (version-string) (defun make-dist (version-string)
(warn "Unimplemented")) (warn "Unimplemented"))
(defun build-abcl (&key force (defun build-abcl (&key
(batch t) force ;; DEPRECATED: not sure of meaning in new underlying API
compile-system (batch t) ;; DEPRECATED: lack of meaning
jar compile-system ;; DEPRECATED: COMPILE-SYSTEM is always invoked
clean jar ;; DEPRECATED: a jar archive is always built
full) clean
(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 @@ ...@@ -10,18 +10,29 @@
#+(or) ;; need apache-ant-1.9 for JVM version 49.0 #+(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") #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 () (defun xdg/ant-executable ()
(let* ((uri (ant-zip-uri)) (let* ((uri (ant-zip-uri))
(directory (xdg/abcl-install-root uri)) (directory (xdg/abcl-install-root uri))
(ant-root-name (let ((name (pathname-name uri))) (ant-root-name (let ((name (pathname-name uri)))
(subseq name 0 (- (length name) (length "-bin"))))) (subseq name 0 (- (length name) (length "-bin")))))
(ant-home (merge-pathnames (make-pathname :directory `(:relative ,ant-root-name)) (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 (values
(probe-file nil
(localize-executable-name ant)))
(merge-pathnames #p"bin/ant" ant-home)))
ant-home)))
(defun ant/install () (defun ant/install ()
(unless (xdg/ant-executable) (unless (xdg/ant-executable)
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
(let ((archive (let ((archive
(download uri)) (download uri))
(root (root
(xdg/abcl-download-root :for-uri uri))) (xdg/abcl-install-root uri)))
(ensure-directories-exist root) (ensure-directories-exist root)
(sys:unzip archive root) (sys:unzip archive root)
(values (values
...@@ -51,6 +51,27 @@ Returns the local pathname of the download artifact." ...@@ -51,6 +51,27 @@ Returns the local pathname of the download artifact."
destination) destination)
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 @@ ...@@ -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") #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 () (defun xdg/mvn-executable ()
(probe-file (xdg/executable (maven-zip-uri) "bin/mvn"))
(localize-executable-name
(merge-pathnames "bin/mvn"
(xdg/abcl-install-root (maven-zip-uri))))))
(defparameter *maven-install-root* nil) (defparameter *maven-install-root* nil)
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
(prove:ok (prove:ok
(abcl-build:build-abcl) (abcl-build:build-abcl)
"Testing BUILD-ABCL…") "Testing BUILD-ABCL…")
(prove:diag )
(prove:ok (prove:ok
(abcl-build:make-dist (format nil "test-" (random (expt 2 32)))) (abcl-build:make-dist (format nil "test-" (random (expt 2 32))))
"Testing MAKE-DIST…") "Testing MAKE-DIST…")
......
(in-package :abcl/build/t) (in-package :abcl/build/t)
(prove:plan 1) (prove:plan 1)
(prove:diag "Testing private installation of Ant…") (prove:ok
(prove:ok (build-abcl:ant/install)) (build-abcl:ant/install)
"Testing ABCL-specific Ant installation of Ant into XDG hierarchy…")
(if (not (ignore-errors (asdf:find-system :abcl))) (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.") (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) (in-package :abcl/build/t)
(prove:plan 1) (prove:plan 1)
(prove:diag "Testing private installation of Maven…")
(prove:ok (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))) (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.") (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) (in-package :abcl/build/t)
(let ((possible-executables (prove:plan 1)
(abcl/build:possible-executable-names "java"))) (prove:is-type (abcl/build:possible-executable-names "java")
(prove:plan 1) 'cons)
(prove:is-type possible-executables
'cons))
(prove:plan 1) (prove:plan 1)
(prove:is (length (abcl/build:split-string "one.two.three." #\.)) (prove:is (length (abcl/build:split-string "one.two.three." #\.))
3) 4)
(prove:finalize) (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