Skip to content

Commit

Permalink
use shadow-cljs
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Sokołowski <jakub@status.im>
Signed-off-by: yenda <eric@status.im>
  • Loading branch information
yenda committed Apr 30, 2020
1 parent 1150626 commit d5ef218
Show file tree
Hide file tree
Showing 252 changed files with 6,311 additions and 7,737 deletions.
7 changes: 5 additions & 2 deletions .clj-kondo/config.edn
@@ -1,6 +1,9 @@
{:lint-as {status-im.utils.views/defview clojure.core/defn
status-im.utils.views/letsubs clojure.core/let
status-im.utils.fx/defn clojure.core/defn
status-im.utils.fx/defn clj-kondo.lint-as/def-catch-all
status-im.utils.styles/def clojure.core/def
status-im.utils.styles/defn clojure.core/defn}
:linters {:invalid-arity {:skip-args [status-im.utils.fx/defn]}}}
:linters {:invalid-arity {:skip-args [status-im.utils.fx/defn]}
;;TODO remove number when this is fixed
;;https://github.com/borkdude/clj-kondo/issues/867
:unresolved-symbol {:exclude [PersistentPriorityMap.EMPTY number]}}}
8 changes: 7 additions & 1 deletion .gitignore
Expand Up @@ -86,6 +86,9 @@ figwheel_server.log
.lein-failures
.lein-repl-history

# Shadow
.shadow-cljs

## Doo
#
out
Expand All @@ -100,6 +103,7 @@ Statusgo.framework
#ios
/ios/Pods/
/ios/StatusIm.xcworkspace
/ios/react-native-xcode.log
.ruby-version
status-e2e/

Expand Down Expand Up @@ -184,4 +188,6 @@ status-modules/resources
/fiddle/target/
/fiddle/resources/public/images/

trace.edn
trace.edn

app
62 changes: 22 additions & 40 deletions Makefile
Expand Up @@ -92,11 +92,11 @@ nix-add-gcroots: ##@nix Add Nix GC roots to avoid status-react expressions being
nix-update-gradle: ##@nix Update maven nix expressions based on current gradle setup
nix/mobile/android/maven-and-npm-deps/maven/generate-nix.sh

nix-update-lein: export TARGET := lein
nix-update-lein: ##@nix Update maven nix expressions based on current lein setup
nix/tools/lein/generate-nix.sh nix/lein
nix-update-clojure: export TARGET := clojure
nix-update-clojure: ##@nix Update maven nix expressions based on current clojure setup
nix/deps/clojure/generate.sh

nix-update-gems: export TARGET := lein
nix-update-gems: export TARGET := default
nix-update-gems: ##@nix Update Ruby gems in fastlane/Gemfile.lock and fastlane/gemset.nix
fastlane/update.sh

Expand Down Expand Up @@ -131,14 +131,6 @@ watchman-clean: export TARGET := watchman
watchman-clean: ##@prepare Delete repo directory from watchman
watchman watch-del $${STATUS_REACT_HOME}

disable-githooks: SHELL := /bin/sh
disable-githooks: ##@prepare Disables lein githooks
@rm -f ${env.WORKSPACE}/.git/hooks/pre-commit && \
sed -i'~' -e 's|\[rasom/lein-githooks|;; [rasom/lein-githooks|' \
-e 's|:githooks|;; :githooks|' \
-e 's|:pre-commit|;; :pre-commit|' project.clj; \
rm project.clj~

pod-install: export TARGET := ios
pod-install: ##@prepare Run 'pod install' to install podfiles and update Podfile.lock
cd ios && pod install; cd --
Expand Down Expand Up @@ -196,31 +188,18 @@ prod-build-android: jsbundle-android ##@legacy temporary legacy alias for jsbund
jsbundle-android: SHELL := /bin/sh
jsbundle-android: export TARGET ?= android
jsbundle-android: export BUILD_ENV ?= prod
jsbundle-android: ##@jsbundle Compile JavaScript and Clojure into index.android.js
# Call nix-build to build the 'targets.mobile.android.jsbundle' attribute and copy the index.android.js file to the project root
@git clean -dxf ./index.$(TARGET).js
jsbundle-android: ##@jsbundle Compile JavaScript and Clojurescript into app directory
# Call nix-build to build the 'targets.mobile.android.jsbundle' attribute and copy the.js files to the project root
nix/scripts/build.sh targets.mobile.android.jsbundle && \
mv result/index.$(TARGET).js ./
mv result/* ./

prod-build-ios: jsbundle-ios ##@legacy temporary legacy alias for jsbundle-ios
@echo "${YELLOW}This a deprecated target name, use jsbundle-ios.$(RESET)"

jsbundle-ios: export TARGET ?= ios
jsbundle-ios: export BUILD_ENV ?= prod
jsbundle-ios: ##@jsbundle Compile JavaScript and Clojure into index.ios.js
@git clean -dxf -f ./index.$(TARGET).js && \
lein jsbundle-ios && \
node prepare-modules.js

prod-build-desktop: jsbundle-desktop ##@legacy temporary legacy alias for jsbundle-desktop
@echo "${YELLOW}This a deprecated target name, use jsbundle-desktop.$(RESET)"

jsbundle-desktop: export TARGET ?= $(HOST_OS)
jsbundle-desktop: export BUILD_ENV ?= prod
jsbundle-desktop: ##@jsbundle Compile JavaScript and Clojure into index.desktop.js
git clean -qdxf -f ./index.desktop.js desktop/ && \
lein jsbundle-desktop && \
node prepare-modules.js
yarn shadow-cljs release ios

#--------------
# Clojure REPL
Expand All @@ -229,7 +208,7 @@ jsbundle-desktop: ##@jsbundle Compile JavaScript and Clojure into index.desktop.
_watch-%: ##@watch Start development for device
$(eval SYSTEM := $(word 2, $(subst -, , $@)))
$(eval DEVICE := $(word 3, $(subst -, , $@)))
clj -R:dev build.clj watch --platform $(SYSTEM) --$(SYSTEM)-device $(DEVICE)
yarn shadow-cljs watch $(SYSTEM)

watch-ios-real: export TARGET := ios
watch-ios-real: _watch-ios-real
Expand Down Expand Up @@ -278,21 +257,24 @@ endif
# Tests
#--------------

lint: export TARGET := lein
lint: export TARGET := clojure
lint: ##@test Run code style checks
lein cljfmt check
# yarn clj-kondo --confg .clj-kondo/config.edn --lint src
clojure -Sdeps '{:deps {cljfmt {:mvn/version "0.6.7"}}}' \
-m cljfmt.main check src \
--indents indentation.edn

lint-fix: export TARGET := lein
lint-fix: export TARGET := clojure
lint-fix: ##@test Run code style checks and fix issues
lein cljfmt fix
clojure -Sdeps '{:deps {cljfmt {:mvn/version "0.6.7"}}}' \
-m cljfmt.main fix src \
--indents indentation.edn

test: export TARGET := lein
test: export TARGET := clojure
test: ##@test Run tests once in NodeJS
lein with-profile test doo node test once

test-auto: export TARGET := lein
test-auto: ##@test Run tests in interactive (auto) mode in NodeJS
lein with-profile test doo node test
yarn shadow-cljs compile mocks && \
yarn shadow-cljs compile test && \
node --require ./test-resources/override.js target/test/test.js

coverage: ##@test Run tests once in NodeJS generating coverage
@scripts/run-coverage.sh
Expand Down
6 changes: 3 additions & 3 deletions android/app/build.gradle
Expand Up @@ -21,7 +21,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.Copy
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation
* entryFile: "index.android.js",
* entryFile: "index.js",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
Expand Down Expand Up @@ -70,15 +70,15 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.Copy
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"],
* nodeExecutableAndArgs: ["node", "--max-old-space-size=8192"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/
project.ext.react = [
nodeExecutableAndArgs: ["node", "--max-old-space-size=16384"],
entryFile: "index.android.js",
entryFile: "index.js",
enableHermes: true, // clean and rebuild if changing. NOTE: Hermes engine is required for Android 64-bit builds running on 64 devices, to guard against a hang in the UI thread after invoking status-go
bundleInPr: true,
inputExcludes: ["android/**", "ios/**", "react-native/**", "src/**", "test/**"]
Expand Down
Expand Up @@ -37,7 +37,7 @@ protected List<ReactPackage> getPackages() {

@Override
protected String getJSMainModuleName() {
return "index.android";
return "index";
}
};

Expand Down

0 comments on commit d5ef218

Please sign in to comment.