Skip to content

Commit

Permalink
Merge branch 'develop' into 17509
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrkhalil authored Oct 14, 2023
2 parents 6d07e46 + 9078c3b commit 1229145
Show file tree
Hide file tree
Showing 94 changed files with 1,525 additions and 1,598 deletions.
1 change: 1 addition & 0 deletions .clj-kondo/babashka/fs/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{:lint-as {babashka.fs/with-temp-dir clojure.core/let}}
1 change: 1 addition & 0 deletions .clj-kondo/babashka/sci/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{:hooks {:macroexpand {sci.core/copy-ns sci.core/copy-ns}}}
9 changes: 9 additions & 0 deletions .clj-kondo/babashka/sci/sci/core.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(ns sci.core)

(defmacro copy-ns
([ns-sym sci-ns]
`(copy-ns ~ns-sym ~sci-ns nil))
([ns-sym sci-ns opts]
`[(quote ~ns-sym)
~sci-ns
(quote ~opts)]))
3 changes: 2 additions & 1 deletion .clj-kondo/config.edn
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{:lint-as {status-im.utils.views/defview clojure.core/defn
{:config-paths ["status-im"]
:lint-as {status-im.utils.views/defview clojure.core/defn
status-im.utils.views/letsubs clojure.core/let
reagent.core/with-let clojure.core/let
status-im.utils.fx/defn clj-kondo.lint-as/def-catch-all
Expand Down
2 changes: 2 additions & 0 deletions .clj-kondo/status-im/config.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{:hooks {:analyze-call {utils.i18n/label hooks.core/i18n-label}}
:linters {:status-im.linter/invalid-translation-keyword {:level :error}}}
19 changes: 19 additions & 0 deletions .clj-kondo/status-im/hooks/core.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(ns hooks.core
(:require [clj-kondo.hooks-api :as api]))

(defn i18n-label
"Verify call to `i18n/label` pass the translation keyword qualified with `t`."
[{:keys [node]}]
(let [[_ translation-key-node & _] (:children node)]
(when (and (api/keyword-node? translation-key-node)
(not= "t" (-> translation-key-node api/sexpr namespace)))
(api/reg-finding! (assoc (meta translation-key-node)
:message "Translation keyword should be qualified with \"t\""
:type :status-im.linter/invalid-translation-keyword)))))

(comment
;; Valid
(i18n-label {:node (api/parse-string "(i18n/label :t/foo)")})

;; Invalid
(i18n-label {:node (api/parse-string "(i18n/label :foo)")}))
5 changes: 3 additions & 2 deletions nix/deps/clojure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ By using the following command:
```sh
shadow-cljs classpath --force-spawn
```
We both download the necessary JARs and POMs into `~/.m2` folder, but also get the classpath printed into standard output.
We download the necessary JARs into `~/.m2` folder, but also get the classpath printed into standard output.
We skip POM files since they are not necessary, and add edge cases we don't want to handle.

We then use the classpath in combination with contents of `~/.m2` folder to generate the following files:

* `deps.list` - List of JARs relative to the `~/.m2` cache folder.
* `deps.json` - Full list of JARs and POMs including their SHAs.
* `deps.json` - Full list of JARs including their SHAs.

The `deps.list` file is just intermediate and for debugging purposes.
The `deps.json` is loaded by the derivation in [`default.nix`](./default.nix) and used to produce a derivation that contains all the necessary dependencies:
Expand Down
22 changes: 3 additions & 19 deletions nix/deps/clojure/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,18 @@ let
# load dependencies
deps = importJSON ./deps.json;

# some .jar files have an `-aot` suffix that doesn't work for .pom files
getPOM = jarUrl: "${removeSuffix "-aot" jarUrl}.pom";

script = writeShellScriptBin "create-local-maven-repo" (''
mkdir -p $out
cd $out
'' +
(concatMapStrings (dep:
let
url = "${dep.host}/${dep.path}";
pom = {
sha1 = attrByPath [ "pom" "sha1" ] "" dep;
sha256 = attrByPath [ "pom" "sha256" ] "" dep;
};
pom-download = optionalString (pom.sha256 != "") (
fetchurl { url = getPOM url; inherit (pom) sha256; }
);
jar = {
sha1 = attrByPath [ "jar" "sha1" ] "" dep;
sha256 = attrByPath [ "jar" "sha256" ] "" dep;
};
jar-download = optionalString (jar.sha256 != "") (
jarFile = optionalString (jar.sha256 != "") (
fetchurl { url = "${url}.jar"; inherit (jar) sha256; }
);
fileName = last (splitString "/" dep.path);
Expand All @@ -38,14 +28,8 @@ let
''
mkdir -p ${directory}
${optionalString (pom-download != "") ''
ln -s "${pom-download}" "${getPOM dep.path}"
''}
${optionalString (pom.sha1 != "") ''
echo "${pom.sha1}" > "${getPOM dep.path}.sha1"
''}
${optionalString (jar-download != "") ''
ln -s "${jar-download}" "${dep.path}.jar"
${optionalString (jarFile != "") ''
ln -s "${jarFile}" "${dep.path}.jar"
''}
${optionalString (jar.sha1 != "") ''
echo "${jar.sha1}" > "${dep.path}.jar.sha1"
Expand Down
Loading

0 comments on commit 1229145

Please sign in to comment.