Issue in rules_appengine

27 views
Skip to first unread message

Jesse Hutton

unread,
Dec 21, 2016, 7:05:23 PM12/21/16
to bazel-...@googlegroups.com
Due to an issue in the Dart 1.21.0 SDK, I moved an appengine java project from a subdirectory of a bazel workspace to the root of the bazel workspace, and ran into a problem when I then tried to run the appengine dev server. The problem manifested in the runner not being able to find the appengine-web.xml file. I found the issue to be in the _short_path_dirname() function: see the attached patch.

I'm not sure if it's the best solution, but it fixed the problem for me.

Jesse
short_path_dirname.patch

Kristina Chodorow

unread,
Dec 22, 2016, 11:25:44 AM12/22/16
to Jesse Hutton, bazel-...@googlegroups.com
Thanks for the patch, but I'm not sure it's correct.  Could you give some more details about what you're doing?  When you say "the bazel workspace," do you mean a clone of the rules_appengine repository?  And were you moving the contents of the examples/ directory to the root of the WS?

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/CANJEScbroDHh5NMy0PhYVNQ4rH8oN4Czbxx43LK4J6H1sp_8Zw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Jesse Hutton

unread,
Jan 6, 2017, 12:01:02 PM1/6/17
to Kristina Chodorow, bazel-...@googlegroups.com
I realized my response before went only to Kristina, so I'm resending (slightly edited) to the group. 

Previously my application workspace looked basically like this:

/foo/WORKSPACE
/foo/my_appengine_dir/
/foo/my_appengine_dir/BUILD
/foo/my_appengine_dir/webapp/
...
/foo/my_appengine_ui/
...

The ui module is a dart module and because of this issue (https://youtrack.jetbrains.com/issue/WEB-24605) I ended up moving my project WORKSPACE file into /foo/my_appengine_dir/ as the dart UI wasn't really using bazel yet anyway. After I did that, however, I got this error when running the appengine dev server:

 /home/jesse/.cache/bazel/_bazel_jesse/913e32167429706965f96523edb1ecb0/execroot/my-appengine-app/bazel-out/local-fastbuild/bin/my_appengine_app: line 42: cd: my_appengine_app.wa/webapp/: No such file or directory
Dec 22, 2016 9:46:55 AM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
SEVERE: Received exception processing /home/jesse/.cache/bazel/_bazel_jesse/913e32167429706965f96523edb1ecb0/execroot/my-appengine-app/bazel-out/local-fastbuild/bin/my_appengine_app.runfiles/__main__/WEB-INF/appengine-web.xml
com.google.apphosting.utils.config.AppEngineConfigException: Could not locate /home/jesse/.cache/bazel/_bazel_jesse/913e32167429706965f96523edb1ecb0/execroot/my-appengine-app/bazel-out/local-fastbuild/bin/my_appengine_app.runfiles/__main__/WEB-INF/appengine-web.xml
        at com.google.apphosting.utils.config.AppEngineWebXmlReader.getInputStream(AppEngineWebXmlReader.java:141)
        at com.google.apphosting.utils.config.AppEngineWebXmlReader.readAppEngineWebXml(AppEngineWebXmlReader.java:75)
The no such file or directory error occurs in the runner template where the script tries to change to the 'data_path' directory. In my build file the appengine_war() rule sets the data_path to "webapp/", something like this:
load("@io_bazel_rules_appengine//appengine:appengine.bzl", "appengine_war")

java_library(
    name = "my_lib",
    ...
)

appengine_war(
    name = "my_appengine_app",
    data = glob(["webapp/**/*"]),
    data_path = "webapp/",
    jars = [":my_lib"],
)
After a bit of print debugging, I discovered that with the new directory structure, the _short_path_dirname() function didn't seem to be producing the correct result. It was returning a data_path of "my_appengine_app.wa"--note the missing 'r'. The last line, 'return sp[0:len(sp)-len(path.basename)-1]', was evaluating to sp[0:-1], which is clearly incorrect.

I'm not really familiar with bazel APIs, but in my case the short path and base name in that function were the same (after changing the directory structure as above), and I assumed that it was trying to compute the directory name of the app module directory (previously 'my_appengine_dir'). After my directory layout change, the app directory is actually '.' (relative to the WORKSPACE file).

I'm not sure if the patch is correct either, but it fixes my particular issue.

Jesse

On Thu, Dec 22, 2016 at 8:25 AM 'Kristina Chodorow' via bazel-discuss <bazel-...@googlegroups.com> wrote:
Thanks for the patch, but I'm not sure it's correct.  Could you give some more details about what you're doing?  When you say "the bazel workspace," do you mean a clone of the rules_appengine repository?  And were you moving the contents of the examples/ directory to the root of the WS?

On Wed, Dec 21, 2016 at 7:05 PM, Jesse Hutton <jesse....@gmail.com> wrote:
Due to an issue in the Dart 1.21.0 SDK, I moved an appengine java project from a subdirectory of a bazel workspace to the root of the bazel workspace, and ran into a problem when I then tried to run the appengine dev server. The problem manifested in the runner not being able to find the appengine-web.xml file. I found the issue to be in the _short_path_dirname() function: see the attached patch.

I'm not sure if it's the best solution, but it fixed the problem for me.

Jesse

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/CAJdJyYfs_-hYevfeA6jJhWUg-i6KwiT9K%2Bo_PSPSohKkuT0H%3DQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages