universa 3.14.3 → 3.14.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8001c7a06a597283b164fde6c41537c16d2020d3d863c3a33530aa81740149c
4
- data.tar.gz: 564bb025eddda58e6b567439a6c1020b32220d1974b612043fa5a12056d1fb95
3
+ metadata.gz: 690d9b0d12c13cef08e33c05a58191e00cccad6240849b243a4bbdd506b1e363
4
+ data.tar.gz: 812c123b24f4c18835072bb09a6441755b0c15091c828079c37cb30ab0c856e2
5
5
  SHA512:
6
- metadata.gz: 84b096a5d6afc4ff68750e33b43e11d63d08d8dcc3b11b451c00c9efe5ffa37c9d873964fec368af0a9a14db57448de5821b1e7c88c4042c3d43a09ebf20e338
7
- data.tar.gz: 9cc6e447a99fdcd91ea865e5cc70c653cf82765beeea765170b8e5feda49a27a238d46b00fc9626e5fdff0e4bc83d051694d43dc21aabce95bed8be2dd9eefaf
6
+ metadata.gz: c1d07d03e1bcdb0e857955ee8bf0a95916adaa8d6e74ca8e11f81d2ef447c4ff158ac7fb1e3fd4ef7268137185cbf36b3778c20c19b6fd36bf0347da5b3f1bc0
7
+ data.tar.gz: e42f11f368ba643c43ff8c39bb1681b92f2b423447ea01e7779832e12ed3d679290b509d8cb34274d54449a22b6a1b631fa6d1f8173f06812fd222b049af5ac6
@@ -10,7 +10,6 @@ module Universa
10
10
  remote_class "com.icodici.universa.node2.network.Client"
11
11
  end
12
12
 
13
-
14
13
  # The universa network client. Discover and connects to the universa network, provides consensus operations
15
14
  # and all other whole-network related functions.
16
15
  class Client
@@ -42,9 +41,9 @@ module Universa
42
41
  # @raise if network topology could not be checked/obtained.
43
42
  def initialize topology: "mainnet", private_key: PrivateKey.new(2048), cache_dir: nil
44
43
  @client = UmiClient.new topology, cache_dir, private_key
45
- @private_key = PrivateKey
44
+ @private_key = private_key
46
45
  @size = @client.size
47
- @connections = (0...@size).map {nil}
46
+ @connections = (0...@size).map { nil }
48
47
  end
49
48
 
50
49
  # Get the node connection by its index (0...size).
@@ -64,7 +63,7 @@ module Universa
64
63
  # @param [Numeric] number of connections to get
65
64
  # @return [Array(Connection)] array of connections to random (non repeating) nodes
66
65
  def random_connections number
67
- (0...size).to_a.sample(number).map {|n| self[n]}
66
+ (0...size).to_a.sample(number).map { |n| self[n] }
68
67
  end
69
68
 
70
69
  # Perform fast consensus state check with a given trust level, determining whether the item is approved or not.
@@ -90,33 +89,42 @@ module Universa
90
89
  end
91
90
  @client.isApprovedByNetwork(hash_id, trust.to_f, 60000)
92
91
  end
93
- # Perform fast consensus state check with a given trust level, as the fraction of the whole network size.
94
- # It checks the network nodes randomly until get enough positive or negative states. The lover the required
95
- # trust level is, the faster the answer will be found.
96
- #
97
- # @param [Contract | HashId] obj contract to check
98
- # @param [Object] trust level, should be between 0.1 (10% of network) and 0.9 (90% of the network)
99
- # @return [ContractState] of some final node check It does not calculates average time (yet)
100
- def get_state obj, trust: 0.3
92
+
93
+ # Perform fast consensus state check with a given trust level, as the fraction of the whole network size.
94
+ # It checks the network nodes randomly until get enough positive or negative states. The lover the required
95
+ # trust level is, the faster the answer will be found.
96
+ #
97
+ # @param [Contract | HashId] obj contract to check
98
+ # @param [Object] trust level, should be between 0.1 (10% of network) and 0.9 (90% of the network)
99
+ # @return [ContractState] of some final node check It does not calculates average time (yet)
100
+ def get_state obj, trust: 0.3
101
101
  raise ArgumentError, "trusst must be in 0.1..0.9 range" if trust < 0.1 || trust > 0.9
102
102
  result = Concurrent::IVar.new
103
+ found_error = nil
103
104
  negative_votes = Concurrent::AtomicFixnum.new((size * 0.1).round + 1)
104
105
  positive_votes = Concurrent::AtomicFixnum.new((size * trust).round)
105
106
 
106
107
  # consensus-finding conveyor: we chek connections in batches in parallel until get
107
108
  # some consensus. We do not wait until all of them will answer
108
- (0...size).to_a.shuffle.each {|index|
109
+ (0...size).to_a.shuffle.each { |index|
109
110
  Thread.start {
110
111
  if result.incomplete?
111
- if (state = self[index].get_state(obj)).approved?
112
- result.try_set(state) if positive_votes.decrement < 0
113
- else
114
- result.try_set(state) if negative_votes.decrement < 0
112
+ begin
113
+ if (state = self[index].get_state(obj)).approved?
114
+ result.try_set(state) if positive_votes.decrement < 0
115
+ else
116
+ result.try_set(state) if negative_votes.decrement < 0
117
+ end
118
+ rescue
119
+ found_error = $!
120
+ result.try_set(nil)
115
121
  end
116
122
  end
117
123
  }
118
124
  }
119
- result.value
125
+ r = result.value
126
+ found_error != nil and raise found_error
127
+ r
120
128
  end
121
129
 
122
130
  # Register a single contract (on private network or if you have white key allowing free operations)
@@ -139,7 +147,7 @@ module Universa
139
147
  # The connection to a single Universa node.
140
148
  class Connection
141
149
 
142
- # Do not create it direcly, use {Client#random_connection}, {Client#random_connections} or {Client#[]} instead
150
+ # Do not create it directly, use {Client#random_connection}, {Client#random_connections} or {Client#[]} instead
143
151
  def initialize umi_client
144
152
  @client = umi_client
145
153
  end
@@ -1,4 +1,4 @@
1
1
  module Universa
2
2
  # Current gem version
3
- VERSION = "3.14.3"
3
+ VERSION = "3.14.4"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: universa
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.14.3
4
+ version: 3.14.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - sergeych
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-03 00:00:00.000000000 Z
11
+ date: 2022-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: farcall
@@ -141,23 +141,6 @@ files:
141
141
  - bin/console
142
142
  - bin/refresh_umi
143
143
  - bin/setup
144
- - bin/umi/bin/umi
145
- - bin/umi/bin/umi.bat
146
- - bin/umi/lib/com.eclipsesource.minimal-json.minimal-json-0.9.4.jar
147
- - bin/umi/lib/com.icodici.common_tools-3.14.4.jar
148
- - bin/umi/lib/com.icodici.crypto-3.14.4.jar
149
- - bin/umi/lib/com.icodici.nanohttpd-2.1.0-20201129b.jar
150
- - bin/umi/lib/com.icodici.umi-0.8.77.jar
151
- - bin/umi/lib/com.icodici.universa_core-3.14.4.jar
152
- - bin/umi/lib/com.squareup.jnagmp.jnagmp-2.0.0.jar
153
- - bin/umi/lib/net.java.dev.jna.jna-4.5.1.jar
154
- - bin/umi/lib/net.java.dev.jna.jna-platform-4.5.0.jar
155
- - bin/umi/lib/net.sf.jopt-simple.jopt-simple-4.9.jar
156
- - bin/umi/lib/org.bouncycastle.bcprov-jdk15on-1.62.jar
157
- - bin/umi/lib/org.checkerframework.checker-qual-2.3.2.jar
158
- - bin/umi/lib/org.scala-lang.scala-library-2.12.7.jar
159
- - bin/umi/lib/org.scala-sbt.ipcsocket.ipcsocket-1.0.0.jar
160
- - bin/umi/lib/org.yaml.snakeyaml-1.18.jar
161
144
  - exe/unikeys
162
145
  - lib/universa.rb
163
146
  - lib/universa/binder.rb
@@ -205,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
188
  - !ruby/object:Gem::Version
206
189
  version: '0'
207
190
  requirements: []
208
- rubygems_version: 3.2.22
191
+ rubygems_version: 3.2.15
209
192
  signing_key:
210
193
  specification_version: 4
211
194
  summary: Expose Universa Java API to ruby
data/bin/umi/bin/umi DELETED
@@ -1,355 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- ### ------------------------------- ###
4
- ### Helper methods for BASH scripts ###
5
- ### ------------------------------- ###
6
-
7
- die() {
8
- echo "$@" 1>&2
9
- exit 1
10
- }
11
-
12
- realpath () {
13
- (
14
- TARGET_FILE="$1"
15
- CHECK_CYGWIN="$2"
16
-
17
- cd "$(dirname "$TARGET_FILE")"
18
- TARGET_FILE=$(basename "$TARGET_FILE")
19
-
20
- COUNT=0
21
- while [ -L "$TARGET_FILE" -a $COUNT -lt 100 ]
22
- do
23
- TARGET_FILE=$(readlink "$TARGET_FILE")
24
- cd "$(dirname "$TARGET_FILE")"
25
- TARGET_FILE=$(basename "$TARGET_FILE")
26
- COUNT=$(($COUNT + 1))
27
- done
28
-
29
- if [ "$TARGET_FILE" == "." -o "$TARGET_FILE" == ".." ]; then
30
- cd "$TARGET_FILE"
31
- TARGET_FILEPATH=
32
- else
33
- TARGET_FILEPATH=/$TARGET_FILE
34
- fi
35
-
36
- # make sure we grab the actual windows path, instead of cygwin's path.
37
- if [[ "x$CHECK_CYGWIN" == "x" ]]; then
38
- echo "$(pwd -P)/$TARGET_FILE"
39
- else
40
- echo $(cygwinpath "$(pwd -P)/$TARGET_FILE")
41
- fi
42
- )
43
- }
44
-
45
- # TODO - Do we need to detect msys?
46
-
47
- # Uses uname to detect if we're in the odd cygwin environment.
48
- is_cygwin() {
49
- local os=$(uname -s)
50
- case "$os" in
51
- CYGWIN*) return 0 ;;
52
- *) return 1 ;;
53
- esac
54
- }
55
-
56
- # This can fix cygwin style /cygdrive paths so we get the
57
- # windows style paths.
58
- cygwinpath() {
59
- local file="$1"
60
- if is_cygwin; then
61
- echo $(cygpath -w $file)
62
- else
63
- echo $file
64
- fi
65
- }
66
-
67
- # Make something URI friendly
68
- make_url() {
69
- url="$1"
70
- local nospaces=${url// /%20}
71
- if is_cygwin; then
72
- echo "/${nospaces//\\//}"
73
- else
74
- echo "$nospaces"
75
- fi
76
- }
77
-
78
- # This crazy function reads in a vanilla "linux" classpath string (only : are separators, and all /),
79
- # and returns a classpath with windows style paths, and ; separators.
80
- fixCygwinClasspath() {
81
- OLDIFS=$IFS
82
- IFS=":"
83
- read -a classpath_members <<< "$1"
84
- declare -a fixed_members
85
- IFS=$OLDIFS
86
- for i in "${!classpath_members[@]}"
87
- do
88
- fixed_members[i]=$(realpath "${classpath_members[i]}" "fix")
89
- done
90
- IFS=";"
91
- echo "${fixed_members[*]}"
92
- IFS=$OLDIFS
93
- }
94
-
95
- # Fix the classpath we use for cygwin.
96
- fix_classpath() {
97
- cp="$1"
98
- if is_cygwin; then
99
- echo "$(fixCygwinClasspath "$cp")"
100
- else
101
- echo "$cp"
102
- fi
103
- }
104
- # Detect if we should use JAVA_HOME or just try PATH.
105
- get_java_cmd() {
106
- if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
107
- echo "$JAVA_HOME/bin/java"
108
- else
109
- echo "java"
110
- fi
111
- }
112
-
113
- echoerr () {
114
- echo 1>&2 "$@"
115
- }
116
- vlog () {
117
- [[ $verbose || $debug ]] && echoerr "$@"
118
- }
119
- dlog () {
120
- [[ $debug ]] && echoerr "$@"
121
- }
122
- execRunner () {
123
- # print the arguments one to a line, quoting any containing spaces
124
- [[ $verbose || $debug ]] && echo "# Executing command line:" && {
125
- for arg; do
126
- if printf "%s\n" "$arg" | grep -q ' '; then
127
- printf "\"%s\"\n" "$arg"
128
- else
129
- printf "%s\n" "$arg"
130
- fi
131
- done
132
- echo ""
133
- }
134
-
135
- # we use "exec" here for our pids to be accurate.
136
- exec "$@"
137
- }
138
- addJava () {
139
- dlog "[addJava] arg = '$1'"
140
- java_args+=( "$1" )
141
- }
142
- addApp () {
143
- dlog "[addApp] arg = '$1'"
144
- app_commands+=( "$1" )
145
- }
146
- addResidual () {
147
- dlog "[residual] arg = '$1'"
148
- residual_args+=( "$1" )
149
- }
150
- addDebugger () {
151
- addJava "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=$1"
152
- }
153
-
154
- require_arg () {
155
- local type="$1"
156
- local opt="$2"
157
- local arg="$3"
158
- if [[ -z "$arg" ]] || [[ "${arg:0:1}" == "-" ]]; then
159
- die "$opt requires <$type> argument"
160
- fi
161
- }
162
- is_function_defined() {
163
- declare -f "$1" > /dev/null
164
- }
165
-
166
- # Attempt to detect if the script is running via a GUI or not
167
- # TODO - Determine where/how we use this generically
168
- detect_terminal_for_ui() {
169
- [[ ! -t 0 ]] && [[ "${#residual_args}" == "0" ]] && {
170
- echo "true"
171
- }
172
- # SPECIAL TEST FOR MAC
173
- [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]] && [[ "${#residual_args}" == "0" ]] && {
174
- echo "true"
175
- }
176
- }
177
-
178
- # Processes incoming arguments and places them in appropriate global variables. called by the run method.
179
- process_args () {
180
- local no_more_snp_opts=0
181
- while [[ $# -gt 0 ]]; do
182
- case "$1" in
183
- --) shift && no_more_snp_opts=1 && break ;;
184
- -h|-help) usage; exit 1 ;;
185
- -v|-verbose) verbose=1 && shift ;;
186
- -d|-debug) debug=1 && shift ;;
187
-
188
- -no-version-check) no_version_check=1 && shift ;;
189
-
190
- -mem) echo "!! WARNING !! -mem option is ignored. Please use -J-Xmx and -J-Xms" && shift 2 ;;
191
- -jvm-debug) require_arg port "$1" "$2" && addDebugger $2 && shift 2 ;;
192
-
193
- -main) custom_mainclass="$2" && shift 2 ;;
194
-
195
- -java-home) require_arg path "$1" "$2" && jre=`eval echo $2` && java_cmd="$jre/bin/java" && shift 2 ;;
196
-
197
- -D*|-agentlib*|-XX*) addJava "$1" && shift ;;
198
- -J*) addJava "${1:2}" && shift ;;
199
- *) addResidual "$1" && shift ;;
200
- esac
201
- done
202
-
203
- if [[ no_more_snp_opts ]]; then
204
- while [[ $# -gt 0 ]]; do
205
- addResidual "$1" && shift
206
- done
207
- fi
208
-
209
- is_function_defined process_my_args && {
210
- myargs=("${residual_args[@]}")
211
- residual_args=()
212
- process_my_args "${myargs[@]}"
213
- }
214
- }
215
-
216
- # Actually runs the script.
217
- run() {
218
- # TODO - check for sane environment
219
-
220
- # process the combined args, then reset "$@" to the residuals
221
- process_args "$@"
222
- set -- "${residual_args[@]}"
223
- argumentCount=$#
224
-
225
- #check for jline terminal fixes on cygwin
226
- if is_cygwin; then
227
- stty -icanon min 1 -echo > /dev/null 2>&1
228
- addJava "-Djline.terminal=jline.UnixTerminal"
229
- addJava "-Dsbt.cygwin=true"
230
- fi
231
-
232
- # check java version
233
- if [[ ! $no_version_check ]]; then
234
- java_version_check
235
- fi
236
-
237
- if [ -n "$custom_mainclass" ]; then
238
- mainclass=("$custom_mainclass")
239
- else
240
- mainclass=("${app_mainclass[@]}")
241
- fi
242
-
243
- # Now we check to see if there are any java opts on the environment. These get listed first, with the script able to override them.
244
- if [[ "$JAVA_OPTS" != "" ]]; then
245
- java_opts="${JAVA_OPTS}"
246
- fi
247
-
248
- # run sbt
249
- execRunner "$java_cmd" \
250
- ${java_opts[@]} \
251
- "${java_args[@]}" \
252
- -cp "$(fix_classpath "$app_classpath")" \
253
- "${mainclass[@]}" \
254
- "${app_commands[@]}" \
255
- "${residual_args[@]}"
256
-
257
- local exit_code=$?
258
- if is_cygwin; then
259
- stty icanon echo > /dev/null 2>&1
260
- fi
261
- exit $exit_code
262
- }
263
-
264
- # Loads a configuration file full of default command line options for this script.
265
- loadConfigFile() {
266
- cat "$1" | sed $'/^\#/d;s/\r$//'
267
- }
268
-
269
- # Now check to see if it's a good enough version
270
- # TODO - Check to see if we have a configured default java version, otherwise use 1.6
271
- java_version_check() {
272
- readonly java_version=$("$java_cmd" -version 2>&1 | awk -F '"' '/version/ {print $2}')
273
- if [[ "$java_version" == "" ]]; then
274
- echo
275
- echo No java installations was detected.
276
- echo Please go to http://www.java.com/getjava/ and download
277
- echo
278
- exit 1
279
- else
280
- local major=$(echo "$java_version" | cut -d'.' -f1)
281
- if [[ "$major" -eq "1" ]]; then
282
- local major=$(echo "$java_version" | cut -d'.' -f2)
283
- fi
284
- if [[ "$major" -lt "8" ]]; then
285
- echo
286
- echo The java installation you have is not up to date
287
- echo $app_name requires at least version 1.8+, you have
288
- echo version $java_version
289
- echo
290
- echo Please go to http://www.java.com/getjava/ and download
291
- echo a valid Java Runtime and install before running $app_name.
292
- echo
293
- exit 1
294
- fi
295
- fi
296
- }
297
-
298
- ### ------------------------------- ###
299
- ### Start of customized settings ###
300
- ### ------------------------------- ###
301
- usage() {
302
- cat <<EOM
303
- Usage: $script_name [options]
304
-
305
- -h | -help print this message
306
- -v | -verbose this runner is chattier
307
- -d | -debug set sbt log level to debug
308
- -no-version-check Don't run the java version check.
309
- -main <classname> Define a custom main class
310
- -jvm-debug <port> Turn on JVM debugging, open at the given port.
311
-
312
- # java version (default: java from PATH, currently $(java -version 2>&1 | grep version))
313
- -java-home <path> alternate JAVA_HOME
314
-
315
- # jvm options and output control
316
- JAVA_OPTS environment variable, if unset uses "$java_opts"
317
- -Dkey=val pass -Dkey=val directly to the java runtime
318
- -J-X pass option -X directly to the java runtime
319
- (-J is stripped)
320
-
321
- # special option
322
- -- To stop parsing built-in commands from the rest of the command-line.
323
- e.g.) enabling debug and sending -d as app argument
324
- \$ ./start-script -d -- -d
325
-
326
- In the case of duplicated or conflicting options, basically the order above
327
- shows precedence: JAVA_OPTS lowest, command line options highest except "--".
328
- Available main classes:
329
- com.icodici.farcallscala.Main
330
- EOM
331
- }
332
-
333
- ### ------------------------------- ###
334
- ### Main script ###
335
- ### ------------------------------- ###
336
-
337
- declare -a residual_args
338
- declare -a java_args
339
- declare -a app_commands
340
- declare -r real_script_path="$(realpath "$0")"
341
- declare -r app_home="$(realpath "$(dirname "$real_script_path")")"
342
- # TODO - Check whether this is ok in cygwin...
343
- declare -r lib_dir="$(realpath "${app_home}/../lib")"
344
- declare -a app_mainclass=(com.icodici.farcallscala.Main)
345
-
346
- declare -r script_conf_file="${app_home}/../conf/application.ini"
347
- declare -r app_classpath="$lib_dir/com.icodici.umi-0.8.77.jar:$lib_dir/org.scala-lang.scala-library-2.12.7.jar:$lib_dir/com.icodici.universa_core-3.14.4.jar:$lib_dir/org.scala-sbt.ipcsocket.ipcsocket-1.0.0.jar:$lib_dir/net.sf.jopt-simple.jopt-simple-4.9.jar:$lib_dir/org.yaml.snakeyaml-1.18.jar:$lib_dir/com.icodici.nanohttpd-2.1.0-20201129b.jar:$lib_dir/com.icodici.common_tools-3.14.4.jar:$lib_dir/com.icodici.crypto-3.14.4.jar:$lib_dir/net.java.dev.jna.jna-4.5.1.jar:$lib_dir/net.java.dev.jna.jna-platform-4.5.0.jar:$lib_dir/com.eclipsesource.minimal-json.minimal-json-0.9.4.jar:$lib_dir/org.checkerframework.checker-qual-2.3.2.jar:$lib_dir/org.bouncycastle.bcprov-jdk15on-1.62.jar:$lib_dir/com.squareup.jnagmp.jnagmp-2.0.0.jar"
348
-
349
- # java_cmd is overrode in process_args when -java-home is used
350
- declare java_cmd=$(get_java_cmd)
351
-
352
- # if configuration files exist, prepend their contents to $@ so it can be processed by this runner
353
- [[ -f "$script_conf_file" ]] && set -- $(loadConfigFile "$script_conf_file") "$@"
354
-
355
- run "$@"
data/bin/umi/bin/umi.bat DELETED
@@ -1,180 +0,0 @@
1
- @REM umi launcher script
2
- @REM
3
- @REM Environment:
4
- @REM JAVA_HOME - location of a JDK home dir (optional if java on path)
5
- @REM CFG_OPTS - JVM options (optional)
6
- @REM Configuration:
7
- @REM UMI_config.txt found in the UMI_HOME.
8
- @setlocal enabledelayedexpansion
9
-
10
- @echo off
11
-
12
-
13
- if "%UMI_HOME%"=="" (
14
- set "APP_HOME=%~dp0\\.."
15
-
16
- rem Also set the old env name for backwards compatibility
17
- set "UMI_HOME=%~dp0\\.."
18
- ) else (
19
- set "APP_HOME=%UMI_HOME%"
20
- )
21
-
22
- set "APP_LIB_DIR=%APP_HOME%\lib\"
23
-
24
- rem Detect if we were double clicked, although theoretically A user could
25
- rem manually run cmd /c
26
- for %%x in (!cmdcmdline!) do if %%~x==/c set DOUBLECLICKED=1
27
-
28
- rem FIRST we load the config file of extra options.
29
- set "CFG_FILE=%APP_HOME%\UMI_config.txt"
30
- set CFG_OPTS=
31
- call :parse_config "%CFG_FILE%" CFG_OPTS
32
-
33
- rem We use the value of the JAVACMD environment variable if defined
34
- set _JAVACMD=%JAVACMD%
35
-
36
- if "%_JAVACMD%"=="" (
37
- if not "%JAVA_HOME%"=="" (
38
- if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"
39
- )
40
- )
41
-
42
- if "%_JAVACMD%"=="" set _JAVACMD=java
43
-
44
- rem Detect if this java is ok to use.
45
- for /F %%j in ('"%_JAVACMD%" -version 2^>^&1') do (
46
- if %%~j==java set JAVAINSTALLED=1
47
- if %%~j==openjdk set JAVAINSTALLED=1
48
- )
49
-
50
- rem BAT has no logical or, so we do it OLD SCHOOL! Oppan Redmond Style
51
- set JAVAOK=true
52
- if not defined JAVAINSTALLED set JAVAOK=false
53
-
54
- if "%JAVAOK%"=="false" (
55
- echo.
56
- echo A Java JDK is not installed or can't be found.
57
- if not "%JAVA_HOME%"=="" (
58
- echo JAVA_HOME = "%JAVA_HOME%"
59
- )
60
- echo.
61
- echo Please go to
62
- echo http://www.oracle.com/technetwork/java/javase/downloads/index.html
63
- echo and download a valid Java JDK and install before running umi.
64
- echo.
65
- echo If you think this message is in error, please check
66
- echo your environment variables to see if "java.exe" and "javac.exe" are
67
- echo available via JAVA_HOME or PATH.
68
- echo.
69
- if defined DOUBLECLICKED pause
70
- exit /B 1
71
- )
72
-
73
-
74
- rem We use the value of the JAVA_OPTS environment variable if defined, rather than the config.
75
- set _JAVA_OPTS=%JAVA_OPTS%
76
- if "!_JAVA_OPTS!"=="" set _JAVA_OPTS=!CFG_OPTS!
77
-
78
- rem We keep in _JAVA_PARAMS all -J-prefixed and -D-prefixed arguments
79
- rem "-J" is stripped, "-D" is left as is, and everything is appended to JAVA_OPTS
80
- set _JAVA_PARAMS=
81
- set _APP_ARGS=
82
-
83
- set "APP_CLASSPATH=%APP_LIB_DIR%\com.icodici.umi-0.8.77.jar;%APP_LIB_DIR%\org.scala-lang.scala-library-2.12.7.jar;%APP_LIB_DIR%\com.icodici.universa_core-3.14.4.jar;%APP_LIB_DIR%\org.scala-sbt.ipcsocket.ipcsocket-1.0.0.jar;%APP_LIB_DIR%\net.sf.jopt-simple.jopt-simple-4.9.jar;%APP_LIB_DIR%\org.yaml.snakeyaml-1.18.jar;%APP_LIB_DIR%\com.icodici.nanohttpd-2.1.0-20201129b.jar;%APP_LIB_DIR%\com.icodici.common_tools-3.14.4.jar;%APP_LIB_DIR%\com.icodici.crypto-3.14.4.jar;%APP_LIB_DIR%\net.java.dev.jna.jna-4.5.1.jar;%APP_LIB_DIR%\net.java.dev.jna.jna-platform-4.5.0.jar;%APP_LIB_DIR%\com.eclipsesource.minimal-json.minimal-json-0.9.4.jar;%APP_LIB_DIR%\org.checkerframework.checker-qual-2.3.2.jar;%APP_LIB_DIR%\org.bouncycastle.bcprov-jdk15on-1.62.jar;%APP_LIB_DIR%\com.squareup.jnagmp.jnagmp-2.0.0.jar"
84
- set "APP_MAIN_CLASS=com.icodici.farcallscala.Main"
85
- set "SCRIPT_CONF_FILE=%APP_HOME%\conf\application.ini"
86
-
87
- rem if configuration files exist, prepend their contents to the script arguments so it can be processed by this runner
88
- call :parse_config "%SCRIPT_CONF_FILE%" SCRIPT_CONF_ARGS
89
-
90
- call :process_args %SCRIPT_CONF_ARGS% %%*
91
-
92
- set _JAVA_OPTS=!_JAVA_OPTS! !_JAVA_PARAMS!
93
-
94
- if defined CUSTOM_MAIN_CLASS (
95
- set MAIN_CLASS=!CUSTOM_MAIN_CLASS!
96
- ) else (
97
- set MAIN_CLASS=!APP_MAIN_CLASS!
98
- )
99
-
100
- rem Call the application and pass all arguments unchanged.
101
- "%_JAVACMD%" !_JAVA_OPTS! !UMI_OPTS! -cp "%APP_CLASSPATH%" %MAIN_CLASS% !_APP_ARGS!
102
-
103
- @endlocal
104
-
105
- exit /B %ERRORLEVEL%
106
-
107
-
108
- rem Loads a configuration file full of default command line options for this script.
109
- rem First argument is the path to the config file.
110
- rem Second argument is the name of the environment variable to write to.
111
- :parse_config
112
- set _PARSE_FILE=%~1
113
- set _PARSE_OUT=
114
- if exist "%_PARSE_FILE%" (
115
- FOR /F "tokens=* eol=# usebackq delims=" %%i IN ("%_PARSE_FILE%") DO (
116
- set _PARSE_OUT=!_PARSE_OUT! %%i
117
- )
118
- )
119
- set %2=!_PARSE_OUT!
120
- exit /B 0
121
-
122
-
123
- :add_java
124
- set _JAVA_PARAMS=!_JAVA_PARAMS! %*
125
- exit /B 0
126
-
127
-
128
- :add_app
129
- set _APP_ARGS=!_APP_ARGS! %*
130
- exit /B 0
131
-
132
-
133
- rem Processes incoming arguments and places them in appropriate global variables
134
- :process_args
135
- :param_loop
136
- call set _PARAM1=%%1
137
- set "_TEST_PARAM=%~1"
138
-
139
- if ["!_PARAM1!"]==[""] goto param_afterloop
140
-
141
-
142
- rem ignore arguments that do not start with '-'
143
- if "%_TEST_PARAM:~0,1%"=="-" goto param_java_check
144
- set _APP_ARGS=!_APP_ARGS! !_PARAM1!
145
- shift
146
- goto param_loop
147
-
148
- :param_java_check
149
- if "!_TEST_PARAM:~0,2!"=="-J" (
150
- rem strip -J prefix
151
- set _JAVA_PARAMS=!_JAVA_PARAMS! !_TEST_PARAM:~2!
152
- shift
153
- goto param_loop
154
- )
155
-
156
- if "!_TEST_PARAM:~0,2!"=="-D" (
157
- rem test if this was double-quoted property "-Dprop=42"
158
- for /F "delims== tokens=1,*" %%G in ("!_TEST_PARAM!") DO (
159
- if not ["%%H"] == [""] (
160
- set _JAVA_PARAMS=!_JAVA_PARAMS! !_PARAM1!
161
- ) else if [%2] neq [] (
162
- rem it was a normal property: -Dprop=42 or -Drop="42"
163
- call set _PARAM1=%%1=%%2
164
- set _JAVA_PARAMS=!_JAVA_PARAMS! !_PARAM1!
165
- shift
166
- )
167
- )
168
- ) else (
169
- if "!_TEST_PARAM!"=="-main" (
170
- call set CUSTOM_MAIN_CLASS=%%2
171
- shift
172
- ) else (
173
- set _APP_ARGS=!_APP_ARGS! !_PARAM1!
174
- )
175
- )
176
- shift
177
- goto param_loop
178
- :param_afterloop
179
-
180
- exit /B 0
Binary file