google / blockly-games

Games for tomorrow's programmers.
https://blockly.games/
Apache License 2.0
1.28k stars 604 forks source link

build-app.py fails on windows #10

Open carlosperate opened 9 years ago

carlosperate commented 9 years ago

Trying to build under windows gives the following error:

Index - en - uncompressed:
Traceback (most recent call last):
  File "build-app.py", line 212, in <module>
    main(sys.argv[1], sys.argv[2])
  File "build-app.py", line 93, in main
    write_uncompressed(name, lang)
  File "build-app.py", line 110, in write_uncompressed
    proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
  File "C:\Python27\lib\subprocess.py", line 711, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 948, in _execute_child
    startupinfo)
WindowsError: [Error 193] %1 is not a valid Win32 application

I believe this is cause by hardcoded Unix slashes in the build file. I'm currently testing a version of the file using os.path instead, but since the file has the warning copied below (link), I am not quite sure how to edit the file that generates build-app.py before I submit a pull request.

WARNING = '// Automatically generated file.  Do not edit!\n'
carlosperate commented 9 years ago

I'm currently trying to build with the following changes: https://github.com/carlosperate/blockly-games/commit/8c4c2a6abc6fdadec52a5039a8aa3c893eaf9f89

The commit is in a branch and hasn't been cleaned up, as you can see I left a lot of commented-out code. The main changes were to add "python" as the first list item be executed by subprocess.Popen() and to change the the filter prefix = 'appengine/ to use os.path.join() instead.

I'm currently experiencing other issues when trying to build the pond game:

Pond/Basic - en - uncompressed:

closure-library-bin-read-only/build/closurebuilder.py: Scanning paths...
closure-library-bin-read-only/build/closurebuilder.py: 1904 sources scanned.
closure-library-bin-read-only/build/closurebuilder.py: Building dependency tree.
.
Traceback (most recent call last):
  File "closure-library-bin-read-only/build/closurebuilder.py", line 287, in <module>
    main()
  File "closure-library-bin-read-only/build/closurebuilder.py", line 223, in main
    tree = depstree.DepsTree(sources)
  File "G:\git\blockly-games_fork - Copy\closure-library-bin-read-only\build\depstree.py", line 56, in __init__
    raise NamespaceNotFoundError(require, source)
depstree.NamespaceNotFoundError: Namespace "Pond.soy" never provided. Required in PathSource appengine\pond\basic\generated\en\soy.js

Pond/Basic - en - compressed:
closure-library-bin-read-only/build/closurebuilder.py: Scanning paths...
closure-library-bin-read-only/build/closurebuilder.py: 1904 sources scanned.
closure-library-bin-read-only/build/closurebuilder.py: Building dependency tree.
.
Traceback (most recent call last):
  File "closure-library-bin-read-only/build/closurebuilder.py", line 287, in <module>
    main()
  File "closure-library-bin-read-only/build/closurebuilder.py", line 223, in main
    tree = depstree.DepsTree(sources)
  File "G:\git\blockly-games_fork - Copy\closure-library-bin-read-only\build\depstree.py", line 56, in __init__
    raise NamespaceNotFoundError(require, source)
depstree.NamespaceNotFoundError: Namespace "Pond.soy" never provided. Required in PathSource appengine\pond\basic\generated\en\soy.js
NeilFraser commented 9 years ago

Over here at Google there are almost no Windows machines (for obvious security reasons) -- other than the photobooth in the lobby. So I can't really help much with this.

With respect to the Pond, /pond/template.soy gets compiled by the Closure Templates tool into /pond/generated/xx/soy.js (where 'xx' is a language code). This file contains "goog.provide('Pond.soy');", which is apparently missing from your build. There is a loop in the build file "while(directory)" that steps down each level looking for generated code. Is your skipping that level? I wonder what "directory.rpartition(os.path.sep)" does in Windows.

Hope this points you in the right direction.

Good catch on the changed URL in the copyright notice stripper. Thanks.

NeilFraser commented 9 years ago

WARNING = '// Automatically generated file. Do not edit!\n'

Oh, heh. That's just a string. It is used to inject the warning into the generated files. The build file is not itself generated. Gosh, I'd never thought of it in that way.

Here is where WARNING is used: https://github.com/google/blockly-games/blob/master/build-app.py#L89 https://github.com/google/blockly-games/blob/master/build-app.py#L140 https://github.com/google/blockly-games/blob/master/build-app.py#L202

I'll add a comment so that the string does not look like a genuine warning.

JEZIGA01 commented 2 years ago

You must have all packages installed! If you are on Win, open PowerShell as ADM and paste this command to install wsl: command: wsl --install doc: https://docs.microsoft.com/en-us/windows/wsl/install

Enter a password and login, restart your computer.

Type wsl to open the terminal on your Win, go to the blockly-games directory and type the commands:

sudo apt update

sudo apt-get install subversion sudo apt-get install sed sudo apt-get install wget sudo apt-get install make sudo apt install default-jre sudo apt install default-jdk sudo apt-get install software-properties-common sudo apt-get install python3

And finally type the make command in the root of your project (blockly-games) where the MakeFile is and watch the magic happen, hehe.