Skip to content

Commit

Permalink
Fixed TAR compression when deploying with Aedifex.
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoejp committed Oct 28, 2023
1 parent 9f32a08 commit 6a61827
Show file tree
Hide file tree
Showing 11 changed files with 287 additions and 55 deletions.
1 change: 1 addition & 0 deletions documentation/bookmark/crime.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Reference

0. [Is This A Golden Age of Fraud?](https://www.youtube.com/watch?v=_V4-n5aTtq8)
0. [How Counterfeit Money Actually Works | How Crime Works | Insider](https://www.youtube.com/watch?v=FGAVpJfG1yQ)

6 changes: 3 additions & 3 deletions stdlib/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ cd ~/lux/stdlib/ \

```
cd ~/lux/stdlib/ \
&& lux clean \
&& lux with aedifex clean \
&& lux with aedifex auto build
cd ~/lux/stdlib/ \
&& lux clean \
&& lux with aedifex clean \
&& lux with aedifex build \
&& mv target/program.jar aedifex.jar
&& mv target/aedifex/program.jar aedifex.jar
```

## Test
Expand Down
3 changes: 2 additions & 1 deletion stdlib/project.lux
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,5 @@
... The name of the main module of the program.
"program" program/aedifex._
... The name of the main module where the tests are located.
"test" test/aedifex._]]
"test" test/aedifex._
"target" "target/aedifex"]]
6 changes: 2 additions & 4 deletions stdlib/source/library/lux/data/collection/stack.lux
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
[equivalence (.only Equivalence)]
[functor (.only Functor)]]
[control
["[0]" error]
["[0]" try (.only Try)]]
[data
[collection
["//" list]]]
[meta
["[0]" location]
[type
["[0]" nominal]]]]])

Expand All @@ -39,9 +39,7 @@
//.empty?))

(the .public is_empty
Error
(location.with (location.here)
"Empty."))
(error.error "Empty."))

(the .public (value stack)
(for_any (_ of)
Expand Down
61 changes: 41 additions & 20 deletions stdlib/source/library/lux/meta/compiler/meta/export.lux
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@
[abstract
["[0]" monad (.only do)]]
[control
["[0]" try (.only Try) (.use "[1]#[0]" monad)]
["[0]" exception (.only Exception)]
["[0]" try (.only Try)]
[concurrency
["[0]" async (.only Async) (.use "[1]#[0]" functor)]]]
[data
["[0]" text (.only)
["%" \\injection]]
["[0]" binary
["[1]" \\injection]]
["[0]" binary (.only)
["![1]" \\injection]]
[collection
["[0]" dictionary]
["[0]" sequence]]
["[0]" sequence]
["[0]" list (.use "[1]#[0]" mix)]]
[format
["[0]" tar]]]
[meta
Expand Down Expand Up @@ -48,31 +50,50 @@
[tar.#user commons
tar.#group commons]))

(exception.the .public (cannot_export [file])
(Exception file.Path)
(exception.report
(list ["File" (%.text file)])))

(the .public (library fs sources)
(-> (file.System Async) (List Source) (Async (Try tar.Tar)))
(|> sources
(io.listing fs)
(async#each (|>> (try#each (|>> dictionary.entries
(monad.each try.monad
(function (_ [path source_code])
(do try.monad
[path (|> path
(text.replaced (of fs separator) .module_separator)
tar.path)]
(try#each (|>> [path
(instant.of_millis +0)
..mode
..ownership]
{tar.#Normal})
(tar.content source_code)))))
(try#each sequence.of_list)))
try#conjoint))))
(async#each (function (_ listing)
(when listing
{try.#Success listing}
(loop (next [listing (dictionary.entries listing)
tar (is tar.Tar
(sequence.sequence))])
(when listing
(list)
{try.#Success tar}

(list.partial [path source_code] listing)
(when [(|> path
(text.replaced (of fs separator) .module_separator)
tar.path)
(tar.content source_code)]
[{try.#Success path} {try.#Success content}]
(|> tar
(sequence.suffix {tar.#Normal [path
(instant.of_millis +0)
..mode
..ownership
content]})
(next listing))

else
(exception.except ..cannot_export [path]))))

{try.#Failure error}
{try.#Failure error})))))

(the .public (export fs [sources target])
(-> (file.System Async) Export (Async (Try Any)))
(do [! (try.with async.monad)]
[tar (|> sources
(..library fs)
(of ! each (binary.value tar.injection)))
(of ! each (!binary.value tar.injection)))
.let [/ (of fs separator)]]
(of fs write (%.message target / ..file) tar)))
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
Natural

(the .public value
(-> (Unsigned Any) Natural)
(-> (Unsigned Any)
Natural)
(|>> nominal.representation))

(the .public equivalence
Expand All @@ -57,7 +58,8 @@
..equivalence)

(the .public order
(for_any (_ brand) (Order (Unsigned brand)))
(for_any (_ brand)
(Order (Unsigned brand)))
(implementation
(the equivalence ..equivalence)
(the (< reference it)
Expand All @@ -81,7 +83,7 @@

(template.with [<bytes> <name> <size> <constructor> <maximum> <+> <-> <max>]
[(expansion.let [<raw> (template.symbol [<name> "'"])]
(these (nominal.every .public <raw> Any)
(these (nominal.every <raw> Any)
(every .public <name> (Unsigned <raw>))))

(the .public <size> <bytes>)
Expand All @@ -94,27 +96,31 @@
nominal.abstraction))

(the .public (<constructor> value)
(-> Natural (Try <name>))
(-> Natural
(Try <name>))
(if (n.> (nominal.representation <maximum>) value)
(exception.except ..value_exceeds_the_maximum [(symbol <name>) value <maximum>])
{try.#Success (nominal.abstraction value)}))

(the .public (<+> parameter subject)
(-> <name> <name> (Try <name>))
(-> <name> <name>
(Try <name>))
(<constructor>
(n.+ (nominal.representation parameter)
(nominal.representation subject))))

(the .public (<-> parameter subject)
(-> <name> <name> (Try <name>))
(-> <name> <name>
(Try <name>))
(let [parameter' (nominal.representation parameter)
subject' (nominal.representation subject)]
(if (n.> subject' parameter')
(exception.except ..subtraction_cannot_yield_negative_value [(symbol <name>) parameter subject])
{try.#Success (nominal.abstraction (n.- parameter' subject'))})))

(the .public (<max> left right)
(-> <name> <name> <name>)
(-> <name> <name>
<name>)
(nominal.abstraction
(n.max (nominal.representation left)
(nominal.representation right))))]
Expand Down
3 changes: 3 additions & 0 deletions stdlib/source/test/lux/data/collection/stack.lux
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
(of (/.equivalence n.equivalence) =
sample
(/.top top remaining))))
(_.coverage [/.is_empty]
(and (try.is? /.is_empty (/.value /.empty))
(try.is? /.is_empty (/.next /.empty))))
(_.coverage [/.top]
(when (/.next (/.top expected_top sample))
{try.#Success [actual_top actual_sample]}
Expand Down
41 changes: 25 additions & 16 deletions stdlib/source/test/lux/meta/compiler/target/jvm.lux
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
["[1][0]" type]
[encoding
["[1][0]" name]
["[1][0]" signed]]])
["[1][0]" signed]
["[1][0]" unsigned]]])

(the method_modifier
(all /modifier#composite
Expand Down Expand Up @@ -1259,22 +1260,29 @@

{try.#Failure error}
false)
))))]
))))
]
(all _.and
(_.lifted "IRETURN" (primitive_return ..$Integer::primitive /.ireturn {.#None} (!::= java/lang/Integer .jvm_int_=#)))
(_.lifted "LRETURN" (primitive_return ..$Long::primitive /.lreturn {.#None} (!::= java/lang/Long .jvm_long_=#)))
(_.lifted "FRETURN" (primitive_return ..$Float::primitive /.freturn {.#None} (!::= java/lang/Float .jvm_float_=#)))
(_.lifted "DRETURN" (primitive_return ..$Double::primitive /.dreturn {.#None} (!::= java/lang/Double .jvm_double_=#)))
(_.lifted "ARETURN" (primitive_return ..$String::primitive /.areturn {.#None} (function (_ expected actual) (text.= (as Text expected) (as Text actual)))))
(_.lifted "RETURN" (primitive_return (is (Primitive java/lang/String)
[#unboxed type.void
#boxed ..$String
#wrap /.nop
#random ..$String::random
#literal (function.constant /.nop)])
/.return
{.#Some ..$String::literal}
(function (_ expected actual) (text.= (as Text expected) (as Text actual)))))
(_.coverage' [/.ireturn]
(primitive_return ..$Integer::primitive /.ireturn {.#None} (!::= java/lang/Integer .jvm_int_=#)))
(_.coverage' [/.lreturn]
(primitive_return ..$Long::primitive /.lreturn {.#None} (!::= java/lang/Long .jvm_long_=#)))
(_.coverage' [/.freturn]
(primitive_return ..$Float::primitive /.freturn {.#None} (!::= java/lang/Float .jvm_float_=#)))
(_.coverage' [/.dreturn]
(primitive_return ..$Double::primitive /.dreturn {.#None} (!::= java/lang/Double .jvm_double_=#)))
(_.coverage' [/.areturn]
(primitive_return ..$String::primitive /.areturn {.#None} (function (_ expected actual) (text.= (as Text expected) (as Text actual)))))
(_.coverage' [/.return]
(primitive_return (is (Primitive java/lang/String)
[#unboxed type.void
#boxed ..$String
#wrap /.nop
#random ..$String::random
#literal (function.constant /.nop)])
/.return
{.#Some ..$String::literal}
(function (_ expected actual) (text.= (as Text expected) (as Text actual)))))
)))

(the branching
Expand Down Expand Up @@ -1617,4 +1625,5 @@

/name.test
/signed.test
/unsigned.test
)))
Loading

0 comments on commit 6a61827

Please sign in to comment.