Building swagger-codegen on Windows - is it ok to use Git Bash? - scala

I am attempting to build swagger-codegen on Windows 7 x64. I ran into a problem when I had to run ./sbt assembly. I couldn't see how to do it from the Windows command prompt.
Instead, I ran it from Git-Bash. It ran successfully, with warnings, but no errors.
Is this an acceptable solution?
I ask because I am stuck on the next step running the template client for petstore.
./bin/scala-petstore.sh produces the following error:
Error: Could not find or load main class Files

I believe the OP was successful in running sbt on Windows 7. However, I believe the OP issue comes from running the scala-petstore.sh script.
I have found the swagger generation scripts depend on a bash shell. However, on Windows Git Bash shell, the basic scala executable does not works. Run "scala -version" on Windows from a CMD shell and you get the scala version. Run "scala -version" on Windows from a GitBash shell and you get:
$ scala -version
Error: Could not find or load main class Files
Answered in another question/topic: Does anyone know how to run the scala executable in Git Bash shell?

The official SBT distribution at scala-sbt.org includes an sbt.bat-file that works on windows.

Related

Powershell commands/scripts not actually running

I am trying to install Emscripten on my computer, and I have run into trouble getting Emscripten actually installed.
I am using the same commands as can be found on the project webpage, but when I try to run
emsdk install latest
Powershell (which is what I am using, but the basic command prompt is behaving the same way) doesn't do anything at all - it just returns without installing anything.
For reference, I have installed Emscripten on this same computer before, but decided to try and do a fresh install of Emscripten after running emsdk activate latest decided to "stop working" as well (whereas it worked just fine last week) - running the command, Powershell simply returned without actually doing anything.
Any ideas on what to check to see why these commands don't seem to run?
I think I solved it. When running the install command in Powershell ISE, it threw the error "Python was not found but can be installed from the Microsoft Store: https://go.microsoft.com/fwlink?linkID=2082640"
despite me having Python installed. Changing the order of my PATH variables to set my Python install directory above the Winapps directory solved the issue with running the install command.

Which shell should be used for Bazel under Windows 10

Usually, on Windows, I use PowerShell (default shell) to call a Bazel command such as bazel build. As far as I understand Bazel makes use of MSYS2 to call and execute commands such as curl, zip or git for instance. Therefore, I wonder if I should use the MSYS2 bash terminal instead of PowerShell. Can there be any problems when using Powershell instead of the MSYS2 bash terminal? Or doesn’t it matter?
As its mentioned here by developers of bazel, using MSYS or MSYS2 is the best choice. Personally I prefer MSYS* over cmd or PowerShell for any thing.
In the current master there was recently an update of the documentation exactly about this issue:
As of 2020-01-15, we do not recommend running Bazel from bash – either
from MSYS2 shell, or Git Bash, or Cygwin, or any other Bash variant.
While Bazel may work for most use cases, some things are broken, like
interrupting the build with Ctrl+C from MSYS2). Also, if you choose to
run under MSYS2, you need to disable MSYS2’s automatic path
conversion, otherwise MSYS will convert command line arguments that
look like Unix paths (e.g. //foo:bar) into Windows paths. See this
StackOverflow answer for details.

Fish can't execute anything on my machine without python3

I have an issue with my fish shell when using pyenv with Python2 activated:
$ pyenv shell 2.7.14
$ ls
pyenv: python3: command not found
The `python3' command exists in these Python versions:
3.6.4
It seems like even when I execute a command as simple as ls / cat / etc, something is calling Python 3. I never get a similar issue without pyenv removing access to Python 3.
How can I find out what is calling Python 3? I've tried clearing my config.fish file, but this problem still occurs
This might be triggered by autocompletion. From the README section on optional dependencies:
automated completion generation from manual pages requires Python 3.5+
the fish_config web configuration tool requires Python 3.5+ and a web browser

How to run mono commands in msysgit?

I am having trouble running mono CLI commands inside the msysgit console. It works fine in the windows command prompt added by the Mono installer. I have paid attention to the path env variable in the mono command prompt and added C:\Program Files (x86)\Mono\bin\; to the beginning of my system path (and restarted msysgit).
I am getting the following error when trying to run xbuild:
/c/Program Files (x86)/Mono/bin/xbuild: line 2: cygpath: command not found Cannot open assembly 'xbuild.exe': No such file or directory.
What am I missing from msysgit to help mono's CLI tools work better?
Mono for windows is built with cygwin + mingw (see Mono compile guide).
I'm not sure whether it's fully compatible with msys or not. From the error, I guess there is a problem of path. You may need cygpath.exe in your path from the following link. You should probably invoke mono either from Cygwin or cmd (through the bat provided files).
Even if mono for windows is compiled with mingw (and thus should not depend on cygwin), from your error, we can see there are still cygwin dependencies.

Chmod u+x windows cmd

I'm trying to install Scalatra on windows seven and need to change a file to executable...the Scalatra documentation says to do this, which is unix. What is the windows equivalant?
chmod u+x srt
You can simply open the relevant folder with a unix command prompt (I use git bash) and execute the unix commands from there
To get scalatra-sbt going on Windows, either port you own sbt.bat from scalatra-sbt, or install chmod via cygwin.
Assuming you've successfully installed the rest of Conscript and giter8, you can start a project that downloads scalatra-sbt. From there, one can look through the ./sbt source, and port the bash script functionality to your own windows specific script, or install a unix compatibility layer into Windows. If you go down the "windows specific script" route, perhaps the scalatra-sbt would appreciate the project contribution.
The "unix compatibility layer" route will eventually allow you to run ./sbt. chmod is a unix command line function, and is provided in a default package of the tool set cygwin, which provides a complete lunix-like environment. Once inside a cygwin terminal, you can chmod your file, as mentioned in the scalatra-sbt first project.
Diving into the contents of ./sbt from scalatra-sbt, this is actually unix script wrapper around the scala build tool (also referred to, confusingly, as sbt). If while trying to run ./sbt you get strange '\r' errors, install the cygwin package dos2unix, and then run it on the sbt file. If you run into any "which: no curl in..." or "which: no wget in..." errors, go back to the cygwin installer, find those packages such as wget, and then install those programs.
By the way, the last thing the scalatra-sbt script runs is the Scala build tool. The Scala build tool sbt itself has many reported issues with cygwin's default configuration, so you will likely need to do more research. Depending on what issues you're running into on your specific setup, you may need to make changes to the end of the ./sbt script to adjust the parameters used to launch the Scala build tool.