]> gitweb.factorcode.org Git - factor.git/commitdiff
build-from-source: add some util words, not quite sure how AppData is
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 15 Jan 2023 17:11:45 +0000 (11:11 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 15 Jan 2023 17:12:44 +0000 (11:12 -0600)
behaving on windows

It seemed to have deleted the openssl/ git checkout except for an empty
openssl/.git/ directory, which is weird

to build in parallel:
set CL=/MP
nmake

set # shows env vars in cmd

extra/build-from-source/build-from-source.factor

index 14aa1a5bc10f1f2e388f8ed85db96f7d20f1d10d..7315a9b521c4a25dda00699226f537c36f3331ab 100644 (file)
@@ -1,8 +1,9 @@
 ! Copyright (C) 2023 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: cli.git formatting http.client io.directories io.files
-io.files.temp io.launcher io.pathnames kernel layouts namespaces
-sequences splitting system ;
+USING: cli.git combinators.short-circuit formatting http.client
+io.directories io.files io.files.info io.files.temp io.launcher
+io.pathnames kernel layouts namespaces sequences splitting
+system ;
 IN: build-from-source
 
 : dll-out-directory ( -- path )
@@ -30,11 +31,19 @@ IN: build-from-source
 
 : with-build-directory ( quot -- ) [ "build" ] dip with-build-directory-as ; inline
 
+: empty-directory? ( path -- ? )
+    { [ directory? ] [ directory-files empty? ] } 1&& ;
+
+! Windows clears the Factor temp directory but leaves the directory names (?)
+! C:\Users\sheeple\AppData\Local\Temp\factorcode.org\Factor>
+: ?sync-repository-as ( url path -- )
+    dup { [ git-directory? ] [ ".git" append-path empty-directory? not ] } 1&&
+    [ dup delete-tree ] unless
+    sync-repository-as wait-for-success ;
+
 : with-updated-git-repo-as ( git-uri path quot -- )
     '[
-        _ _ [
-            sync-repository-as wait-for-success
-        ] keep
+        _ _ [ ?sync-repository-as ] keep
         prepend-current-path _ with-directory
     ] with-temp-directory ; inline