Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions .classpath

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
__pycache__/

## allow
!.clj-kondo/
!.git*
!.github/
!.dockerignore
Expand Down
23 changes: 0 additions & 23 deletions .project

This file was deleted.

120 changes: 21 additions & 99 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,119 +1,41 @@
# # #
.EXPORT_ALL_VARIABLES:

GROUP_ID = angara
ARTEFACT = main
MAIN = web.main
APP_NAME = angara-main
VER_MAJOR = 2
VER_MINOR = 0
MAIN_CLASS = app.main

PROD_HOST = angara
PROD_PATH = /app/main
JAR_NAME = angara-main.jar
UBER_JAR = target/${JAR_NAME}

# # #
PROD_HOST = angara
PROD_PATH = /app/main
# # #

.EXPORT_ALL_VARIABLES:
.PHONY: clean inc-major inc-minor bump shapshot release css jar uberjar
#
.PHONY: build clean dev deploy
SHELL = bash
#
VERSION = $(shell cat VERSION)

ifndef TIMESTAMP
TIMESTAMP = $(shell date -Isec)
endif

ifndef COMMIT
COMMIT = $(shell git rev-parse HEAD)
endif

#
RESOURCES = ./resources
TARGET = ./target
CLASSES = ${TARGET}/classes
JAR_FILE = ${TARGET}/${GROUP_ID}-${ARTEFACT}-${VERSION}.jar
UBER_JAR = ${TARGET}/${GROUP_ID}-${ARTEFACT}.jar
BUILD_EDN = ${RESOURCES}/build.edn
APPNAME = ${GROUP_ID}/${ARTEFACT}
#
REPO_ID = anga
SNAPSHOTS_URL = https://???/repository/maven-snapshots/
RELEASES_URL = https://???/repository/maven-releases/

build_edn: VERSION
@echo "build.edn:" ${APPNAME} ${VERSION}
@echo "{">${BUILD_EDN}
@echo ":appname \"${APPNAME}\"">>${BUILD_EDN}
@echo ":version \"${VERSION}\"">>${BUILD_EDN}
@echo ":commit \"${COMMIT}\"">>${BUILD_EDN}
@echo ":timestamp \"${TIMESTAMP}\"">>${BUILD_EDN}
@echo "}">>${BUILD_EDN}

pom: VERSION deps.edn
@echo "pom.xml: deps"
@cat tools/pom-template.xml | envsubst > pom.xml
@clojure -Spom

config: build_edn pom

compile:
mkdir -p ${CLASSES}
clojure -e "(set! *compile-path* \"${CLASSES}\") (compile '${MAIN})"
dev:
set -a && CONFIG_EDN=../conf/dev.edn && clojure -M:dev:nrepl

css:
@echo "css garden: css/main.css"
@clojure -A:css -m make-css resources/public/incs/css/main.css

css-dev:
clojure -A:css -m make-css resources/public/incs/css/main.css pretty
build: clean
@clj -T:build uberjar

jar: config
clojure -A:depstar -m hf.depstar.jar ${JAR_FILE}

uberjar: clean config css
@echo "uberjar:" ${UBER_JAR}
@clojure -A:depstar -m hf.depstar.uberjar ${UBER_JAR} --main ${MAIN} --compile \
| grep -v ":warning \"clashing jar item\", :path \"javax/mail" \
| grep -v ":warning \"clashing jar item\", :path \"about.html\""

# uberdeps: clean pom config compile css
# clojure -A:uberdeps -m uberdeps.uberjar --target ${UBER_JAR} --main-class ${MAIN} --level info

# uber: clean pom config compile css
# clojure -A:uberdeps --target ${UBER_JAR} --main-class ${MAIN} --level info \
# | grep -v com.sun.mail/javax.mail | grep -v services/com.fasterxml.jackson.core.JsonFactory

deploy:
chmod g+r ${UBER_JAR}
scp ${UBER_JAR} ${PROD_HOST}:${PROD_PATH}
# ssh ${PROD_HOST} pm2 restart main

# snapshot: export VERSION := ${VERSION}-SNAPSHOT
# snapshot: uberjar
# @mvn deploy:deploy-file \
# -DpomFile=pom.xml \
# -Dfile=${UBER_JAR} \
# -DrepositoryId=${REPO_ID} \
# -Durl=${SNAPSHOTS_URL}
rsync -v -P ${UBER_JAR} ${PROD_HOST}:${PROD_PATH}/

# release: uberjar
# @mvn deploy:deploy-file \
# -DpomFile=pom.xml \
# -Dfile=${UBER_JAR} \
# -DrepositoryId=${REPO_ID} \
# -Durl=${RELEASES_URL}

inc-major:
@(VERS=`awk -F'.' '{print $$1+1 "." 0 "." $$3}' VERSION` && echo $${VERS} > VERSION)
@echo -n "New version: " && cat VERSION

inc-minor:
@(VERS=`awk -F'.' '{print $$1 "." $$2+1 "." $$3}' VERSION` && echo $${VERS} > VERSION)
@echo -n "New version: " && cat VERSION
clean:
clj -T:build clean

bump:
@(VERS=`awk -F'.' '{print $$1 "." $$2 "." $$3+1}' VERSION` && echo $${VERS} > VERSION)
@echo -n "New version: " && cat VERSION

clean:
@echo -n "clean target: "
rm -rf ${TARGET}
# https://github.com/liquidz/antq/blob/main/CHANGELOG.adoc
outdated:
@(clojure -Sdeps '{:deps {antq/antq {:mvn/version "2.11.1264"}}}' -T antq.core/-main || exit 0)

#.
16 changes: 0 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@

# Angara.Net: main page app

'''
https://mothereff.in/js-escapes
'''

На Angara.Net запускается в тестовом режиме Календарь событий.
В него можно добавлять свои мероприятия:
Expand All @@ -14,19 +11,6 @@ https://mothereff.in/js-escapes
5. Поставить галочку "Показывать"


'''
A code point C greater than 0xFFFF corresponds to a surrogate pair <H, L> as per the following formula:

H = Math.floor((C - 0x10000) / 0x400) + 0xD800
L = (C - 0x10000) % 0x400 + 0xDC00

The reverse mapping, i.e. from a surrogate pair <H, L> to a Unicode code point C, is given by:

C = (H - 0xD800) * 0x400 + L - 0xDC00 + 0x10000

'''


```
https://rp5.ru/%D0%90%D1%80%D1%85%D0%B8%D0%B2_%D0%BF%D0%BE%D0%B3%D0%BE%D0%B4%D1%8B_%D0%B2_%D0%A5%D0%B0%D0%BC%D0%B0%D1%80-%D0%94%D0%B0%D0%B1%D0%B0%D0%BD%D0%B5

Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

86 changes: 86 additions & 0 deletions build.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
(ns build
(:import
[java.time LocalDateTime]
[java.time.format DateTimeFormatter])
(:require
[clojure.java.io :as io]
[clojure.tools.build.api :as b]
,))


(def APP_NAME (System/getenv "APP_NAME"))
(def VER_MAJOR (System/getenv "VER_MAJOR"))
(def VER_MINOR (System/getenv "VER_MINOR"))
(def MAIN_CLASS (System/getenv "MAIN_CLASS"))

(def JAR_NAME (System/getenv "JAR_NAME"))

(def CLJ_SRC "src")
(def JAVA_SRC "java")
(def TARGET "target")
(def CLASSES "target/classes")
(def RESOURCES "resources")
(def BUILD_INFO "build-info.edn")


(defn iso-now ^String []
(.format (LocalDateTime/now) DateTimeFormatter/ISO_LOCAL_DATE_TIME))


(defn clean [_]
(b/delete {:path TARGET}))


(defn version [_]
(format "%s.%s.%s" VER_MAJOR VER_MINOR (b/git-count-revs nil)))


(defn build-info [_]
{:appname APP_NAME
:version (version nil)
:branch (b/git-process {:git-args "branch --show-current"})
:commit (b/git-process {:git-args "rev-parse --short HEAD"})
:timestamp (iso-now)}
,)


(defn write-build-info [build-info]
(let [out-file (io/file CLASSES BUILD_INFO)]
(io/make-parents out-file)
(spit out-file (pr-str build-info))))


;; https://clojure.org/guides/tools_build

(defn javac [{basis :basis}]
(b/javac {:src-dirs [JAVA_SRC]
:class-dir CLASSES
:basis (or basis (b/create-basis {:project "deps.edn"}))
:javac-opts ["-Xlint:-options"]
}))


(defn uberjar [_]
(let [build-info (build-info nil)
uber-file (io/file TARGET JAR_NAME)
basis (b/create-basis {:project "deps.edn"})]

(println "build:" build-info)
(write-build-info build-info)

;; (javac {:basis basis})

(b/copy-dir {:src-dirs [CLJ_SRC RESOURCES]
:target-dir CLASSES})

(b/compile-clj {:basis basis
:src-dirs [CLJ_SRC]
:class-dir CLASSES})

(b/uber {:basis basis
:class-dir CLASSES
:uber-file (str uber-file)
:main MAIN_CLASS})

(println "complete:" (str uber-file))
,))
Loading