eolang 0.0.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,37 +2,50 @@
2
2
 
3
3
  [![grunt](https://github.com/objectionary/eoc/actions/workflows/grunt.yml/badge.svg)](https://github.com/objectionary/eoc/actions/workflows/grunt.yml)
4
4
 
5
- First, you install [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm).
5
+ First, you install [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
6
+ and [Java SE](https://www.oracle.com/java/technologies/downloads/).
6
7
 
7
- Then, you install [eolang](...) package:
8
+ Then, you install [eolang](https://www.npmjs.com/package/eolang) package:
8
9
 
9
10
  ```
10
11
  $ npm install eolang
11
12
  ```
12
13
 
13
- Then, you write a [EO](https://www.eolang.org) program in a few `.eo` files
14
- in the current directory.
14
+ Then, you write a simple [EO](https://www.eolang.org) program in `hello.eo` file
15
+ in the current directory:
15
16
 
16
- Then, for example, you compile it to Java and run:
17
+ ```
18
+ [args...] > hello
19
+ Q.org.eolang.io.stdout > @
20
+ "Hello, world!\n"
21
+ ```
22
+
23
+ Then, you run it:
17
24
 
18
25
  ```
19
- $ eoc run
26
+ $ eoc run hello
20
27
  ```
21
28
 
22
29
  That's it.
23
30
 
24
- You can also do many other things with `eoc` commands:
31
+ You can also do many other things with `eoc` commands
32
+ (the flow is explained in [this blog post](https://www.yegor256.com/2021/10/21/objectionary.html)):
25
33
 
26
- * `parse` converts EO program to XMIR files
27
- * `optimize` reorganizes XMIR files and prepares them for transpilation
34
+ * `register` finds necessary EO files and registers the in a CSV
35
+ * `assemble` parses EO files into XMIR, optimizes them, pulls foreign EO objects
36
+ * `transpile` converts XMIR to target programming language
37
+ * `compile` converts target language to binaries
38
+ * `link` puts all binaries together into a single executable binary
39
+ * `dataize` executes the binary and dataize a single object
40
+
41
+ There are also commands that help manipulate with XMIR and EO sources:
42
+
43
+ * `audit` inspects all packages and report their status
28
44
  * `translate` converts Java/C++/Python/etc. program to EO program
29
45
  * `demu` removes `cage` and `memory` objects
30
46
  * `dejump` removes `goto` objects
31
47
  * `infer` suggests object names where it's possible to infer them
32
48
  * `flatten` moves inner objects to upper level
33
- * `transpile` converts XMIR to target programming language
34
- * `compile` converts target language to binaries
35
- * `run` executes the binaries
36
49
 
37
50
  This command line toolkit simply integrates other tools available in
38
- [@objectionary](https://github.com/objectionary) GitHub organization.
51
+ [@objectionary](https://github.com/objectionary) GitHub organization.
@@ -0,0 +1,18 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The ASF licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+ distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
18
+ wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
package/mvnw/mvnw ADDED
@@ -0,0 +1,287 @@
1
+ #!/bin/sh
2
+ # ----------------------------------------------------------------------------
3
+ # Licensed to the Apache Software Foundation (ASF) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The ASF licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+ # ----------------------------------------------------------------------------
20
+
21
+ # ----------------------------------------------------------------------------
22
+ # Apache Maven Wrapper startup batch script, version 3.1.1
23
+ #
24
+ # Required ENV vars:
25
+ # ------------------
26
+ # JAVA_HOME - location of a JDK home dir
27
+ #
28
+ # Optional ENV vars
29
+ # -----------------
30
+ # MAVEN_OPTS - parameters passed to the Java VM when running Maven
31
+ # e.g. to debug Maven itself, use
32
+ # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
33
+ # MAVEN_SKIP_RC - flag to disable loading of mavenrc files
34
+ # ----------------------------------------------------------------------------
35
+
36
+ if [ -z "$MAVEN_SKIP_RC" ] ; then
37
+
38
+ if [ -f /usr/local/etc/mavenrc ] ; then
39
+ . /usr/local/etc/mavenrc
40
+ fi
41
+
42
+ if [ -f /etc/mavenrc ] ; then
43
+ . /etc/mavenrc
44
+ fi
45
+
46
+ if [ -f "$HOME/.mavenrc" ] ; then
47
+ . "$HOME/.mavenrc"
48
+ fi
49
+
50
+ fi
51
+
52
+ # OS specific support. $var _must_ be set to either true or false.
53
+ cygwin=false;
54
+ darwin=false;
55
+ mingw=false
56
+ case "`uname`" in
57
+ CYGWIN*) cygwin=true ;;
58
+ MINGW*) mingw=true;;
59
+ Darwin*) darwin=true
60
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
61
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
62
+ if [ -z "$JAVA_HOME" ]; then
63
+ if [ -x "/usr/libexec/java_home" ]; then
64
+ JAVA_HOME="`/usr/libexec/java_home`"; export JAVA_HOME
65
+ else
66
+ JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
67
+ fi
68
+ fi
69
+ ;;
70
+ esac
71
+
72
+ if [ -z "$JAVA_HOME" ] ; then
73
+ if [ -r /etc/gentoo-release ] ; then
74
+ JAVA_HOME=`java-config --jre-home`
75
+ fi
76
+ fi
77
+
78
+ # For Cygwin, ensure paths are in UNIX format before anything is touched
79
+ if $cygwin ; then
80
+ [ -n "$JAVA_HOME" ] &&
81
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
82
+ [ -n "$CLASSPATH" ] &&
83
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
84
+ fi
85
+
86
+ # For Mingw, ensure paths are in UNIX format before anything is touched
87
+ if $mingw ; then
88
+ [ -n "$JAVA_HOME" ] &&
89
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
90
+ fi
91
+
92
+ if [ -z "$JAVA_HOME" ]; then
93
+ javaExecutable="`which javac`"
94
+ if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
95
+ # readlink(1) is not available as standard on Solaris 10.
96
+ readLink=`which readlink`
97
+ if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
98
+ if $darwin ; then
99
+ javaHome="`dirname \"$javaExecutable\"`"
100
+ javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
101
+ else
102
+ javaExecutable="`readlink -f \"$javaExecutable\"`"
103
+ fi
104
+ javaHome="`dirname \"$javaExecutable\"`"
105
+ javaHome=`expr "$javaHome" : '\(.*\)/bin'`
106
+ JAVA_HOME="$javaHome"
107
+ export JAVA_HOME
108
+ fi
109
+ fi
110
+ fi
111
+
112
+ if [ -z "$JAVACMD" ] ; then
113
+ if [ -n "$JAVA_HOME" ] ; then
114
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
115
+ # IBM's JDK on AIX uses strange locations for the executables
116
+ JAVACMD="$JAVA_HOME/jre/sh/java"
117
+ else
118
+ JAVACMD="$JAVA_HOME/bin/java"
119
+ fi
120
+ else
121
+ JAVACMD="`\\unset -f command; \\command -v java`"
122
+ fi
123
+ fi
124
+
125
+ if [ ! -x "$JAVACMD" ] ; then
126
+ echo "Error: JAVA_HOME is not defined correctly." >&2
127
+ echo " We cannot execute $JAVACMD" >&2
128
+ exit 1
129
+ fi
130
+
131
+ if [ -z "$JAVA_HOME" ] ; then
132
+ echo "Warning: JAVA_HOME environment variable is not set."
133
+ fi
134
+
135
+ # traverses directory structure from process work directory to filesystem root
136
+ # first directory with .mvn subdirectory is considered project base directory
137
+ find_maven_basedir() {
138
+ if [ -z "$1" ]
139
+ then
140
+ echo "Path not specified to find_maven_basedir"
141
+ return 1
142
+ fi
143
+
144
+ basedir="$1"
145
+ wdir="$1"
146
+ while [ "$wdir" != '/' ] ; do
147
+ if [ -d "$wdir"/.mvn ] ; then
148
+ basedir=$wdir
149
+ break
150
+ fi
151
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
152
+ if [ -d "${wdir}" ]; then
153
+ wdir=`cd "$wdir/.."; pwd`
154
+ fi
155
+ # end of workaround
156
+ done
157
+ printf '%s' "$(cd "$basedir"; pwd)"
158
+ }
159
+
160
+ # concatenates all lines of a file
161
+ concat_lines() {
162
+ if [ -f "$1" ]; then
163
+ echo "$(tr -s '\n' ' ' < "$1")"
164
+ fi
165
+ }
166
+
167
+ BASE_DIR=$(find_maven_basedir "$(dirname $0)")
168
+ if [ -z "$BASE_DIR" ]; then
169
+ exit 1;
170
+ fi
171
+
172
+ MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
173
+ if [ "$MVNW_VERBOSE" = true ]; then
174
+ echo $MAVEN_PROJECTBASEDIR
175
+ fi
176
+
177
+ ##########################################################################################
178
+ # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
179
+ # This allows using the maven wrapper in projects that prohibit checking in binary data.
180
+ ##########################################################################################
181
+ if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
182
+ if [ "$MVNW_VERBOSE" = true ]; then
183
+ echo "Found .mvn/wrapper/maven-wrapper.jar"
184
+ fi
185
+ else
186
+ if [ "$MVNW_VERBOSE" = true ]; then
187
+ echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
188
+ fi
189
+ if [ -n "$MVNW_REPOURL" ]; then
190
+ wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
191
+ else
192
+ wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
193
+ fi
194
+ while IFS="=" read key value; do
195
+ case "$key" in (wrapperUrl) wrapperUrl="$value"; break ;;
196
+ esac
197
+ done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
198
+ if [ "$MVNW_VERBOSE" = true ]; then
199
+ echo "Downloading from: $wrapperUrl"
200
+ fi
201
+ wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
202
+ if $cygwin; then
203
+ wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
204
+ fi
205
+
206
+ if command -v wget > /dev/null; then
207
+ QUIET="--quiet"
208
+ if [ "$MVNW_VERBOSE" = true ]; then
209
+ echo "Found wget ... using wget"
210
+ QUIET=""
211
+ fi
212
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
213
+ wget $QUIET "$wrapperUrl" -O "$wrapperJarPath"
214
+ else
215
+ wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath"
216
+ fi
217
+ [ $? -eq 0 ] || rm -f "$wrapperJarPath"
218
+ elif command -v curl > /dev/null; then
219
+ QUIET="--silent"
220
+ if [ "$MVNW_VERBOSE" = true ]; then
221
+ echo "Found curl ... using curl"
222
+ QUIET=""
223
+ fi
224
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
225
+ curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L
226
+ else
227
+ curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L
228
+ fi
229
+ [ $? -eq 0 ] || rm -f "$wrapperJarPath"
230
+ else
231
+ if [ "$MVNW_VERBOSE" = true ]; then
232
+ echo "Falling back to using Java to download"
233
+ fi
234
+ javaSource="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
235
+ javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class"
236
+ # For Cygwin, switch paths to Windows format before running javac
237
+ if $cygwin; then
238
+ javaSource=`cygpath --path --windows "$javaSource"`
239
+ javaClass=`cygpath --path --windows "$javaClass"`
240
+ fi
241
+ if [ -e "$javaSource" ]; then
242
+ if [ ! -e "$javaClass" ]; then
243
+ if [ "$MVNW_VERBOSE" = true ]; then
244
+ echo " - Compiling MavenWrapperDownloader.java ..."
245
+ fi
246
+ # Compiling the Java class
247
+ ("$JAVA_HOME/bin/javac" "$javaSource")
248
+ fi
249
+ if [ -e "$javaClass" ]; then
250
+ # Running the downloader
251
+ if [ "$MVNW_VERBOSE" = true ]; then
252
+ echo " - Running MavenWrapperDownloader.java ..."
253
+ fi
254
+ ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
255
+ fi
256
+ fi
257
+ fi
258
+ fi
259
+ ##########################################################################################
260
+ # End of extension
261
+ ##########################################################################################
262
+
263
+ MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
264
+
265
+ # For Cygwin, switch paths to Windows format before running java
266
+ if $cygwin; then
267
+ [ -n "$JAVA_HOME" ] &&
268
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
269
+ [ -n "$CLASSPATH" ] &&
270
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
271
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
272
+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
273
+ fi
274
+
275
+ # Provide a "standardized" way to retrieve the CLI args that will
276
+ # work with both Windows and non-Windows executions.
277
+ MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
278
+ export MAVEN_CMD_LINE_ARGS
279
+
280
+ WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
281
+
282
+ exec "$JAVACMD" \
283
+ $MAVEN_OPTS \
284
+ $MAVEN_DEBUG_OPTS \
285
+ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
286
+ "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
287
+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
package/mvnw/mvnw.cmd ADDED
@@ -0,0 +1,187 @@
1
+ @REM ----------------------------------------------------------------------------
2
+ @REM Licensed to the Apache Software Foundation (ASF) under one
3
+ @REM or more contributor license agreements. See the NOTICE file
4
+ @REM distributed with this work for additional information
5
+ @REM regarding copyright ownership. The ASF licenses this file
6
+ @REM to you under the Apache License, Version 2.0 (the
7
+ @REM "License"); you may not use this file except in compliance
8
+ @REM with the License. You may obtain a copy of the License at
9
+ @REM
10
+ @REM http://www.apache.org/licenses/LICENSE-2.0
11
+ @REM
12
+ @REM Unless required by applicable law or agreed to in writing,
13
+ @REM software distributed under the License is distributed on an
14
+ @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ @REM KIND, either express or implied. See the License for the
16
+ @REM specific language governing permissions and limitations
17
+ @REM under the License.
18
+ @REM ----------------------------------------------------------------------------
19
+
20
+ @REM ----------------------------------------------------------------------------
21
+ @REM Apache Maven Wrapper startup batch script, version 3.1.1
22
+ @REM
23
+ @REM Required ENV vars:
24
+ @REM JAVA_HOME - location of a JDK home dir
25
+ @REM
26
+ @REM Optional ENV vars
27
+ @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
28
+ @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
29
+ @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
30
+ @REM e.g. to debug Maven itself, use
31
+ @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
32
+ @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
33
+ @REM ----------------------------------------------------------------------------
34
+
35
+ @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
36
+ @echo off
37
+ @REM set title of command window
38
+ title %0
39
+ @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
40
+ @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
41
+
42
+ @REM set %HOME% to equivalent of $HOME
43
+ if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
44
+
45
+ @REM Execute a user defined script before this one
46
+ if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
47
+ @REM check for pre script, once with legacy .bat ending and once with .cmd ending
48
+ if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
49
+ if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
50
+ :skipRcPre
51
+
52
+ @setlocal
53
+
54
+ set ERROR_CODE=0
55
+
56
+ @REM To isolate internal variables from possible post scripts, we use another setlocal
57
+ @setlocal
58
+
59
+ @REM ==== START VALIDATION ====
60
+ if not "%JAVA_HOME%" == "" goto OkJHome
61
+
62
+ echo.
63
+ echo Error: JAVA_HOME not found in your environment. >&2
64
+ echo Please set the JAVA_HOME variable in your environment to match the >&2
65
+ echo location of your Java installation. >&2
66
+ echo.
67
+ goto error
68
+
69
+ :OkJHome
70
+ if exist "%JAVA_HOME%\bin\java.exe" goto init
71
+
72
+ echo.
73
+ echo Error: JAVA_HOME is set to an invalid directory. >&2
74
+ echo JAVA_HOME = "%JAVA_HOME%" >&2
75
+ echo Please set the JAVA_HOME variable in your environment to match the >&2
76
+ echo location of your Java installation. >&2
77
+ echo.
78
+ goto error
79
+
80
+ @REM ==== END VALIDATION ====
81
+
82
+ :init
83
+
84
+ @REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
85
+ @REM Fallback to current working directory if not found.
86
+
87
+ set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
88
+ IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
89
+
90
+ set EXEC_DIR=%CD%
91
+ set WDIR=%EXEC_DIR%
92
+ :findBaseDir
93
+ IF EXIST "%WDIR%"\.mvn goto baseDirFound
94
+ cd ..
95
+ IF "%WDIR%"=="%CD%" goto baseDirNotFound
96
+ set WDIR=%CD%
97
+ goto findBaseDir
98
+
99
+ :baseDirFound
100
+ set MAVEN_PROJECTBASEDIR=%WDIR%
101
+ cd "%EXEC_DIR%"
102
+ goto endDetectBaseDir
103
+
104
+ :baseDirNotFound
105
+ set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
106
+ cd "%EXEC_DIR%"
107
+
108
+ :endDetectBaseDir
109
+
110
+ IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
111
+
112
+ @setlocal EnableExtensions EnableDelayedExpansion
113
+ for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
114
+ @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
115
+
116
+ :endReadAdditionalConfig
117
+
118
+ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
119
+ set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
120
+ set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
121
+
122
+ set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
123
+
124
+ FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
125
+ IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
126
+ )
127
+
128
+ @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
129
+ @REM This allows using the maven wrapper in projects that prohibit checking in binary data.
130
+ if exist %WRAPPER_JAR% (
131
+ if "%MVNW_VERBOSE%" == "true" (
132
+ echo Found %WRAPPER_JAR%
133
+ )
134
+ ) else (
135
+ if not "%MVNW_REPOURL%" == "" (
136
+ SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar"
137
+ )
138
+ if "%MVNW_VERBOSE%" == "true" (
139
+ echo Couldn't find %WRAPPER_JAR%, downloading it ...
140
+ echo Downloading from: %WRAPPER_URL%
141
+ )
142
+
143
+ powershell -Command "&{"^
144
+ "$webclient = new-object System.Net.WebClient;"^
145
+ "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
146
+ "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
147
+ "}"^
148
+ "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
149
+ "}"
150
+ if "%MVNW_VERBOSE%" == "true" (
151
+ echo Finished downloading %WRAPPER_JAR%
152
+ )
153
+ )
154
+ @REM End of extension
155
+
156
+ @REM Provide a "standardized" way to retrieve the CLI args that will
157
+ @REM work with both Windows and non-Windows executions.
158
+ set MAVEN_CMD_LINE_ARGS=%*
159
+
160
+ %MAVEN_JAVA_EXE% ^
161
+ %JVM_CONFIG_MAVEN_PROPS% ^
162
+ %MAVEN_OPTS% ^
163
+ %MAVEN_DEBUG_OPTS% ^
164
+ -classpath %WRAPPER_JAR% ^
165
+ "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
166
+ %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
167
+ if ERRORLEVEL 1 goto error
168
+ goto end
169
+
170
+ :error
171
+ set ERROR_CODE=1
172
+
173
+ :end
174
+ @endlocal & set ERROR_CODE=%ERROR_CODE%
175
+
176
+ if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
177
+ @REM check for post script, once with legacy .bat ending and once with .cmd ending
178
+ if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
179
+ if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
180
+ :skipRcPost
181
+
182
+ @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
183
+ if "%MAVEN_BATCH_PAUSE%"=="on" pause
184
+
185
+ if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
186
+
187
+ cmd /C exit /B %ERROR_CODE%
package/mvnw/pom.xml ADDED
@@ -0,0 +1,62 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ The MIT License (MIT)
4
+
5
+ Copyright (c) 2022 Yegor Bugayenko
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included
15
+ in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+ -->
25
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
26
+ <modelVersion>4.0.0</modelVersion>
27
+ <groupId>org.eolang</groupId>
28
+ <artifactId>eoc</artifactId>
29
+ <version>1.0-SNAPSHOT</version>
30
+ <build>
31
+ <finalName>eoc</finalName>
32
+ <sourceDirectory>${eo.generatedDir}</sourceDirectory>
33
+ <directory>${eo.targetDir}</directory>
34
+ <outputDirectory>${eo.targetDir}/classes</outputDirectory>
35
+ <plugins>
36
+ <plugin>
37
+ <groupId>org.eolang</groupId>
38
+ <artifactId>eo-maven-plugin</artifactId>
39
+ <version>0.23.1</version>
40
+ </plugin>
41
+ <plugin>
42
+ <artifactId>maven-compiler-plugin</artifactId>
43
+ <version>3.10.1</version>
44
+ <configuration>
45
+ <source>1.8</source>
46
+ <target>1.8</target>
47
+ </configuration>
48
+ </plugin>
49
+ <plugin>
50
+ <artifactId>maven-jar-plugin</artifactId>
51
+ <version>3.2.2</version>
52
+ <configuration>
53
+ <archive>
54
+ <manifest>
55
+ <mainClass>org.eolang.Main</mainClass>
56
+ </manifest>
57
+ </archive>
58
+ </configuration>
59
+ </plugin>
60
+ </plugins>
61
+ </build>
62
+ </project>
package/package.json CHANGED
@@ -1,25 +1,35 @@
1
1
  {
2
2
  "name": "eolang",
3
- "version": "0.0.2",
4
- "author": "Yegor Bugayenko",
3
+ "version": "0.2.0",
4
+ "author": "Yegor Bugayenko <yegor256@gmail.com> (https://www.yegor256.com/)",
5
5
  "license": "MIT",
6
6
  "repository": "objectionary/eoc",
7
+ "description": "A collection of command line tools for EOLANG: compiling, parsing, transpiling to other languages, optimizing, and analyzing",
8
+ "homepage": "https://github.com/objectionary/eoc",
9
+ "keywords": [
10
+ "cli",
11
+ "command",
12
+ "compiler",
13
+ "console",
14
+ "terminal",
15
+ "eoc",
16
+ "objectionary",
17
+ "oop"
18
+ ],
19
+ "main": "eoc",
7
20
  "bin": {
8
21
  "eoc": "./src/eoc.js"
9
22
  },
23
+ "dependencies": {
24
+ "commander": "9.2.0"
25
+ },
10
26
  "devDependencies": {
11
- "blanket": "1.2.3",
12
- "commander": "9.2.0",
13
27
  "eslint": "5.15.3",
14
28
  "eslint-config-google": "0.12.0",
15
29
  "grunt": "^1.5.3",
16
30
  "grunt-contrib-clean": "2.0.0",
17
31
  "grunt-eslint": "21.0.0",
18
- "grunt-mocha-test": "0.13.3",
19
- "mocha": "^10.0.0",
20
- "mochawesome": "7.1.3"
21
- },
22
- "dependencies": {
23
- "dev": "^0.1.3"
32
+ "grunt-mocha-cli": "7.0.0",
33
+ "mocha": "^10.0.0"
24
34
  }
25
35
  }
@@ -1,3 +1,4 @@
1
+ #! /usr/bin/env node
1
2
  /*
2
3
  * The MIT License (MIT)
3
4
  *
@@ -22,36 +23,21 @@
22
23
  * SOFTWARE.
23
24
  */
24
25
 
25
- module.exports = function(grunt) {
26
- grunt.initConfig({
27
- pkg: grunt.file.readJSON('package.json'),
28
- clean: ['coverage'],
29
- mochaTest: {
30
- test: {
31
- options: {
32
- reporter: 'spec',
33
- require: 'blanket',
34
- },
35
- src: ['test/**/*.js'],
36
- },
37
- coverage: {
38
- options: {
39
- reporter: 'mochawesome',
40
- // quiet: true,
41
- captureFile: 'coverage.html',
42
- },
43
- src: ['test/**/*.js'],
44
- },
45
- },
46
- eslint: {
47
- options: {
48
- configFile: '.eslintrc.json',
49
- },
50
- target: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'],
51
- },
52
- });
53
- grunt.loadNpmTasks('grunt-eslint');
54
- grunt.loadNpmTasks('grunt-mocha-test');
55
- grunt.loadNpmTasks('grunt-contrib-clean');
56
- grunt.registerTask('default', ['mochaTest', 'eslint']);
26
+ const path = require('path');
27
+ const mvnw = require('../mvnw');
28
+
29
+ /**
30
+ * Command to assemble .XMIR files.
31
+ * @param {Hash} opts - All options
32
+ */
33
+ module.exports = function assemble(opts) {
34
+ mvnw([
35
+ 'eo:assemble',
36
+ `-Deo.targetDir=${path.resolve(opts.target)}`,
37
+ `-Deo.outputDir=${path.resolve(opts.target, 'classes')}`,
38
+ `-Deo.foreign=${path.resolve(opts.target, 'eo-foreign.csv')}`,
39
+ `-Deo.foreignFormat=csv`,
40
+ `-Deo.placed=${path.resolve(opts.target, 'eo-placed.csv')}`,
41
+ `-Deo.placedFormat=csv`,
42
+ ]);
57
43
  };
@@ -0,0 +1,34 @@
1
+ #! /usr/bin/env node
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2022 Yegor Bugayenko
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included
15
+ * in all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ const mvnw = require('../mvnw');
27
+
28
+ /**
29
+ * Command to audit all packages.
30
+ * @param {Hash} opts - All options
31
+ */
32
+ module.exports = function audit(opts) {
33
+ mvnw(['--version']);
34
+ };
@@ -0,0 +1,36 @@
1
+ #! /usr/bin/env node
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2022 Yegor Bugayenko
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included
15
+ * in all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ const fs = require('fs');
27
+ const path = require('path');
28
+
29
+ /**
30
+ * Deletes all temporary files.
31
+ * @param {Hash} opts - All options
32
+ */
33
+ module.exports = function clean(opts) {
34
+ const home = path.resolve(opts.target);
35
+ fs.rmSync(home, {recursive: true, force: true});
36
+ };
@@ -0,0 +1,41 @@
1
+ #! /usr/bin/env node
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2022 Yegor Bugayenko
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included
15
+ * in all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ const mvnw = require('../mvnw');
27
+ const path = require('path');
28
+
29
+ /**
30
+ * Command to compile target language into binaries.
31
+ * @param {Hash} opts - All options
32
+ */
33
+ module.exports = function compile(opts) {
34
+ mvnw([
35
+ 'compiler:compile',
36
+ `-Dmaven.compiler.source=1.8`,
37
+ `-Dmaven.compiler.target=1.8`,
38
+ `-Deo.targetDir=${path.resolve(opts.target)}`,
39
+ `-Deo.generatedDir=${path.resolve(opts.target, 'generated-sources')}`,
40
+ ]);
41
+ };
@@ -1,3 +1,4 @@
1
+ #! /usr/bin/env node
1
2
  /*
2
3
  * The MIT License (MIT)
3
4
  *
@@ -22,40 +23,18 @@
22
23
  * SOFTWARE.
23
24
  */
24
25
 
26
+ const {spawn} = require('node:child_process');
27
+ const path = require('path');
28
+
25
29
  /**
26
- * Helper to run EOC command line tool.
27
- *
28
- * @param {Array} args - Array of args
29
- * @param {Function} fn - Callback
30
- * @return {Mixed} The result of exec()
30
+ * Runs the single executable binary.
31
+ * @param {String} obj - Name of object to dataize
32
+ * @param {Hash} opts - All options
31
33
  */
32
- function eoc(args, fn) {
33
- const path = require('path');
34
- const exec = require('child_process').exec;
35
- return exec(
36
- `node ${path.resolve('./src/eoc.js')} ${args.join(' ')}`,
37
- (error, stdout, stderr) => {
38
- assert.equal(null, error);
39
- assert.equal('', stderr);
40
- return fn(stdout);
41
- }
34
+ module.exports = function dataize(obj, opts) {
35
+ spawn(
36
+ `java`,
37
+ ['-jar', path.resolve(opts.target, 'eoc.jar'), obj],
38
+ {stdio: 'inherit'}
42
39
  );
43
- }
44
-
45
- const assert = require('assert');
46
-
47
- describe('eoc', function() {
48
- it('prints its own version', function(done) {
49
- eoc(['--version'], function(stdout) {
50
- assert.equal(require('../src/version.js') + '\n', stdout);
51
- done();
52
- });
53
- });
54
-
55
- it('prints help screen', function(done) {
56
- eoc(['--help'], function(stdout) {
57
- assert(stdout.includes('Usage: eoc'));
58
- done();
59
- });
60
- });
61
- });
40
+ };
@@ -0,0 +1,38 @@
1
+ #! /usr/bin/env node
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2022 Yegor Bugayenko
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included
15
+ * in all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ const mvnw = require('../mvnw');
27
+ const path = require('path');
28
+
29
+ /**
30
+ * Command to link binaries into a single executable binary.
31
+ * @param {Hash} opts - All options
32
+ */
33
+ module.exports = function link(opts) {
34
+ mvnw([
35
+ 'jar:jar',
36
+ `-Deo.targetDir=${path.resolve(opts.target)}`,
37
+ ]);
38
+ };
@@ -0,0 +1,41 @@
1
+ #! /usr/bin/env node
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2022 Yegor Bugayenko
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included
15
+ * in all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ const mvnw = require('../mvnw');
27
+ const path = require('path');
28
+
29
+ /**
30
+ * Command to register .EO sources.
31
+ * @param {Hash} opts - All options
32
+ */
33
+ module.exports = function register(opts) {
34
+ mvnw([
35
+ 'eo:register',
36
+ `-Deo.targetDir=${path.resolve(opts.target)}`,
37
+ `-Deo.sourcesDir=${path.resolve(opts.sources)}`,
38
+ `-Deo.foreign=${path.resolve(opts.target, 'eo-foreign.csv')}`,
39
+ `-Deo.foreignFormat=csv`,
40
+ ]);
41
+ };
@@ -0,0 +1,41 @@
1
+ #! /usr/bin/env node
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2022 Yegor Bugayenko
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included
15
+ * in all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ const mvnw = require('../mvnw');
27
+ const path = require('path');
28
+
29
+ /**
30
+ * Command to transpile XMIR files into target language.
31
+ * @param {Hash} opts - All options
32
+ */
33
+ module.exports = function transpile(opts) {
34
+ mvnw([
35
+ 'eo:transpile',
36
+ `-Deo.targetDir=${path.resolve(opts.target)}`,
37
+ `-Deo.generatedDir=${path.resolve(opts.target, 'generated-sources')}`,
38
+ `-Deo.foreign=${path.resolve(opts.target, 'eo-foreign.csv')}`,
39
+ `-Deo.foreignFormat=csv`,
40
+ ]);
41
+ };
package/src/eoc.js CHANGED
@@ -23,8 +23,6 @@
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- const exec = require('child_process').exec;
27
-
28
26
  const {Command} = require('commander');
29
27
  const program = new Command();
30
28
 
@@ -34,24 +32,80 @@ program
34
32
  .version(require('./version'));
35
33
 
36
34
  program
37
- .option('-s, --sources <path>')
38
- .option('-t, --target <path>');
39
-
40
- program.command('parse')
41
- .description('parse EO source code into XMIR')
42
- // .argument('<test>', 'test argument')
43
- // .option('--a', 'test text')
44
- .option('-b, --bbb <char>', 'test text', ',')
45
- .action((str, options) => {
46
- exec('echo BOOM', function(error, stdout, stderr) {
47
- console.log('stdout: ' + stdout);
48
- console.log('stderr: ' + stderr);
49
- if (error !== null) {
50
- console.log('exec error: ' + error);
51
- }
52
- });
53
- console.log(program.opts());
54
- console.log('hello, world!');
35
+ .option('-s, --sources <path>', 'directory with .EO sources', '.')
36
+ .option('-t, --target <path>', 'directory with all generated files', '.eoc');
37
+
38
+ program.command('audit')
39
+ .description('inspects all packages and reports their status')
40
+ .action((str, options) => {
41
+ const audit = require('./commands/audit');
42
+ audit(program.opts());
43
+ });
44
+
45
+ program.command('clean')
46
+ .description('delete all temporary files')
47
+ .action((str, options) => {
48
+ const clean = require('./commands/clean');
49
+ clean(program.opts());
50
+ });
51
+
52
+ program.command('register')
53
+ .description('register all visible EO source files')
54
+ .action((str, options) => {
55
+ const register = require('./commands/register');
56
+ register(program.opts());
57
+ });
58
+
59
+ program.command('assemble')
60
+ .description('parse EO files into XMIR and join them with required dependencies')
61
+ .action((str, options) => {
62
+ const assemble = require('./commands/assemble');
63
+ assemble(program.opts());
64
+ });
65
+
66
+ program.command('transpile')
67
+ .description('converts EO files into target language')
68
+ .action((str, options) => {
69
+ const transpile = require('./commands/transpile');
70
+ transpile(program.opts());
71
+ });
72
+
73
+ program.command('compile')
74
+ .description('compiles target language sources into binaries')
75
+ .action((str, options) => {
76
+ const compile = require('./commands/compile');
77
+ compile(program.opts());
78
+ });
79
+
80
+ program.command('link')
81
+ .description('link together all binaries into a single executable binary')
82
+ .action((str, options) => {
83
+ const link = require('./commands/link');
84
+ link(program.opts());
85
+ });
86
+
87
+ program.command('dataize')
88
+ .description('run the single executable binary and dataize an object')
89
+ .action((str, options) => {
90
+ const dataize = require('./commands/dataize');
91
+ dataize(program.args[1], program.opts());
92
+ });
93
+
94
+ program.command('run')
95
+ .description('register, assemble, transpile, compile, link, and dataize an object')
96
+ .action((str, options) => {
97
+ const register = require('./commands/register');
98
+ register(program.opts());
99
+ const assemble = require('./commands/assemble');
100
+ assemble(program.opts());
101
+ const transpile = require('./commands/transpile');
102
+ transpile(program.opts());
103
+ const compile = require('./commands/compile');
104
+ compile(program.opts());
105
+ const link = require('./commands/link');
106
+ link(program.opts());
107
+ const dataize = require('./commands/dataize');
108
+ dataize(program.args[1], program.opts());
55
109
  });
56
110
 
57
111
  program.parse();
package/src/mvnw.js ADDED
@@ -0,0 +1,40 @@
1
+ #! /usr/bin/env node
2
+ /*
3
+ * The MIT License (MIT)
4
+ *
5
+ * Copyright (c) 2022 Yegor Bugayenko
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included
15
+ * in all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+
26
+ const path = require('path');
27
+ const {spawnSync} = require('child_process');
28
+
29
+ /**
30
+ * Run mvnw with provided commands.
31
+ * @param {Hash} args - All arguments to pass to it
32
+ */
33
+ module.exports = function mvnw(args) {
34
+ const home = path.resolve(__dirname, '../mvnw');
35
+ spawnSync(
36
+ path.resolve(home, 'mvnw'),
37
+ args,
38
+ {cwd: home, stdio: 'inherit'}
39
+ );
40
+ };
package/src/version.js CHANGED
@@ -23,4 +23,4 @@
23
23
  * SOFTWARE.
24
24
  */
25
25
 
26
- module.exports = '0.0.2';
26
+ module.exports = '0.2.0';
package/.0pdd.yml DELETED
@@ -1,9 +0,0 @@
1
- errors:
2
- - yegor256@gmail.com
3
- # alerts:
4
- # github:
5
- # - yegor256
6
-
7
- tags:
8
- - pdd
9
- - bug
package/.eslintrc.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "env": {
3
- "es6": true
4
- },
5
- "extends": "google",
6
- "rules": {
7
- "indent": "off"
8
- }
9
- }
package/.gitattributes DELETED
@@ -1,9 +0,0 @@
1
- # Check out all text files in UNIX format, with LF as end of line
2
- # Don't change this file. If you have any ideas about it, please
3
- # submit a separate issue about it and we'll discuss.
4
-
5
- * text=auto eol=lf
6
- *.rb ident
7
- *.xml ident
8
- *.png binary
9
- *.pdf binary
@@ -1,17 +0,0 @@
1
- name: grunt
2
- on:
3
- push:
4
- pull_request:
5
- concurrency:
6
- group: ${{ github.ref }}
7
- cancel-in-progress: true
8
- jobs:
9
- build:
10
- runs-on: ubuntu-latest
11
- steps:
12
- - uses: actions/checkout@v2
13
- - uses: actions/setup-node@v1
14
- with:
15
- node-version: ${{ matrix.node-version }}
16
- - run: npm ci
17
- - run: grunt
package/.pdd DELETED
@@ -1,8 +0,0 @@
1
- --source=.
2
- --verbose
3
- --exclude target/**/*
4
- --exclude coverage/**/*
5
- --exclude node_modules/**/*
6
- --rule min-words:20
7
- --rule min-estimate:15
8
- --rule max-estimate:90
package/.rultor.yml DELETED
@@ -1,25 +0,0 @@
1
- assets:
2
- npmrc: objectionary/secrets#npmrc
3
- install: |
4
- pip install git+https://chromium.googlesource.com/external/gyp
5
- npm install --no-color --include dev
6
- sudo npm install --no-color --global grunt-cli
7
- npm uninstall --no-color grunt-cli
8
- npm install --no-color mocha
9
- pdd -f /dev/null -v
10
- release:
11
- script: |
12
- [[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1
13
- sed -i -e "s/\"version\": \"0.0.0\"/\"version\": \"${tag}\"/" package.json
14
- sed -i -e "s/0.0.0/${tag}/" src/version.js
15
- grunt --no-color
16
- git commit -am "set version to ${tag}"
17
- chmod 600 ../npmrc
18
- npm publish --no-color --userconfig=../npmrc
19
- merge:
20
- script: |-
21
- grunt --no-color
22
- deploy:
23
- script: |-
24
- echo "There is nothing to deploy"
25
- exit -1