Giter Site home page Giter Site logo

rules_appengine's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rules_appengine's Issues

rules_appengine is failing on Bazel CI

https://buildkite.com/bazel/rules-appengine-appengine/builds/89#_

ERROR: /var/lib/buildkite-agent/builds/buildkite-worker-ubuntu1404-java8-g0s7-1/bazel/rules-appengine-appengine/examples/py/hello_world/BUILD:8:1: every rule of type py_appengine_binary_base implicitly depends upon the target '@com_google_cloud_sdk//:gcloud', but this target could not be found because of: no such package '@com_google_cloud_sdk//': The repository could not be resolved
--
  | ERROR: /var/lib/buildkite-agent/builds/buildkite-worker-ubuntu1404-java8-g0s7-1/bazel/rules-appengine-appengine/examples/py/hello_world/BUILD:8:1: no such package '@com_google_cloud_sdk//': The repository could not be resolved and referenced by '//examples/py/hello_world:main.deploy'
  | WARNING: errors encountered while analyzing target '//examples/py/hello_world:main': it will not be built
  | WARNING: errors encountered while analyzing target '//examples/py/hello_world:main.deploy': it will not be built

The culprit should be 8122a70

Use gcloud for deployment of java apps

As application deployments with appcfg are no longer supported it is valuable gcloud to be used and for java apps to ensure that Java apps could be deployed on GAE.

Addresses the following issue with appcfg:

Application deployment failed. Message: Deployments using appcfg are no longer supported.

Flag --incompatible_no_implicit_file_export will break rules_appengine in a future Bazel release

Incompatible flag --incompatible_no_implicit_file_export will be enabled by default in a future Bazel release [1], thus breaking rules_appengine.

The flag is documented here: bazelbuild/bazel#10225

Please check the following CI builds for build and test results:

Never heard of incompatible flags before? We have documentation that explains everything.

If you don't want to receive any future issues for rules_appengine or if you have any questions,
please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

[1] The target release hasn't been determined yet. Our tool will update the issue title once the flag flip has been scheduled.

How does "data" attribute work in java_war and appengine_war

In an exploratory project I'm trying to run an Java application that serves some static resource. I tried to add static resources to the war file using the data attribute.
https://github.com/jiaqi/angular-on-java/blob/seattle/java/org/cyclopsgroup/aoj/server/BUILD

It seems the setting is effective and after some work files do end up in the war file as expected.

$ bazel build java/org/cyclopsgroup/aoj/server
INFO: Analyzed target //java/org/cyclopsgroup/aoj/server:server (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //java/org/cyclopsgroup/aoj/server:server up-to-date:
  bazel-bin/java/org/cyclopsgroup/aoj/server/server.war
  bazel-bin/java/org/cyclopsgroup/aoj/server/server_deploy.sh
  bazel-bin/java/org/cyclopsgroup/aoj/server/server
  ...
$ jar -tvf bazel-bin/java/org/cyclopsgroup/aoj/server/server.war
    94 Fri Jan 01 00:00:00 PST 2010 ./webapp/aoj/styles.css
5628103 Fri Jan 01 00:00:00 PST 2010 ./webapp/aoj/js_bundle.js
   141 Fri Jan 01 00:00:00 PST 2010 ./webapp/aoj/styles.css.map
 11413 Fri Jan 01 00:00:00 PST 2010 ./favicon.png
 ...

Then I ran the war target with bazel run and found that only favicon.png is served and none of the others is.

After reading appengine_runner.sh.template I realized the root directory of web application at runtime has nothing to do with the files in the war file.

bazel-out/darwin-fastbuild/bin/java/org/cyclopsgroup/aoj/server/server.runfiles/angular_on_java/java/org/cyclopsgroup/aoj/server
├── WEB-INF
│   ├── appengine-generated
│   │   └── local_db.bin
│   ├── appengine-web.xml -> /Users/jguo/github/jiaqi/angular-on-java/java/org/cyclopsgroup/aoj/server/WEB-INF/appengine-web.xml
│   ├── jsp
│   │   └── index.jsp -> /Users/jguo/github/jiaqi/angular-on-java/java/org/cyclopsgroup/aoj/server/WEB-INF/jsp/index.jsp
│   └── lib
│       ├── appengine-api.jar -> /private/var/tmp/_bazel_jguo/239a5101fa986e10f8c504b3e6b8e624/execroot/angular_on_java/bazel-out/darwin-fastbuild/bin/java/org/cyclopsgroup/aoj/server/server.runfiles/angular_on_java/../com_google_appengine_java/lib/impl/appengine-api.jar
...
├── server -> /private/var/tmp/_bazel_jguo/239a5101fa986e10f8c504b3e6b8e624/execroot/angular_on_java/bazel-out/darwin-fastbuild/bin/java/org/cyclopsgroup/aoj/server/server
└── server.war -> /private/var/tmp/_bazel_jguo/239a5101fa986e10f8c504b3e6b8e624/execroot/angular_on_java/bazel-out/darwin-fastbuild/bin/java/org/cyclopsgroup/aoj/server/server.war

4 directories, 31 files

None of the webapp/aoj/* files we saw in the war file exists under runfiles. With file structure like this in runfiles, the running application actually serves server.war by mistake.

Unless I miss anything, this doesn't make sense to me at all. What the data attribute specifies is correctly honored when creating a war file, but completely ignored when running it. Is it by design? What's the right way to specify data attribute so it matters at runtime?

Flag --incompatible_load_python_rules_from_bzl will break rules_appengine in Bazel 1.2.1

Incompatible flag --incompatible_load_python_rules_from_bzl will break rules_appengine once Bazel 1.2.1 is released.

Please see the following CI builds for more information:

Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

`appengine-web.xml` not being put in WEB-INF

This to me looks more or less identical to the README example. Am I missing something simple?

Bazel version:

$ bazel version
Build label: 0.8.0-homebrew
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Mon Nov 27 20:38:09 2017 (1511815089)
Build timestamp: 1511815089
Build timestamp as int: 1511815089

.bazelrc:

build --experimental_repository_cache=/Users/dclemen/.bazel/cache

Structure of project:

foo/
    BUILD
    WORKSPACE
    src/main/java/<various>/
        - VariousFiles.java
    src/test/java/<various>
        - VariousFilesTest.java
    webapp/
        WEB-INF/
            appengine-web.xml
            logging.properties
            web.xml

WORKSPACE:

git_repository(
    name = "io_bazel_rules_appengine",
    remote = "https://github.com/bazelbuild/rules_appengine.git",
    tag = "0.0.7",
)

load("@io_bazel_rules_appengine//appengine:appengine.bzl", "appengine_repositories")
appengine_repositories()

<various maven_jar definitions>

BUILD:

load("@io_bazel_rules_appengine//appengine:appengine.bzl", "appengine_war")

package(default_visibility = ["//visibility:public"])

java_library(
    name = "java-maven-lib",
    resources = glob(["src/main/resources/**"]),
    srcs = glob(["src/main/java/**/*.java"]),
    deps = [
      "//external:appengine/java/api",
      "@io_bazel_rules_appengine//appengine:javax.servlet.api",
      <additional jars>
    ]
)

appengine_war(
    name = "foo-gae",
    jars = [":java-maven-lib"],
    data = glob(["webapp/**"]),
    data_path = "webapp",
)

<test definition, which if removed renders the exact same result>

I build it and then run it (with bazel run //:foo-gae -- --port=12345), and it generates the following exception:

SEVERE: Received exception processing /private/var/tmp/_bazel_dclemen/7b6609c6dba886f72d542786a5989753/execroot/__main__/bazel-out/darwin-fastbuild/bin/foo-gae.runfiles/__main__/WEB-INF/appengine-web.xml
com.google.apphosting.utils.config.AppEngineConfigException: Could not locate /private/var/tmp/_bazel_dclemen/7b6609c6dba886f72d542786a5989753/execroot/__main__/bazel-out/darwin-fastbuild/bin/foo-gae.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)
	at com.google.apphosting.utils.config.EarHelper.readWebModule(EarHelper.java:178)
	at com.google.appengine.tools.development.ApplicationConfigurationManager$WarModuleConfigurationHandle.readConfiguration(ApplicationConfigurationManager.java:414)
	at com.google.appengine.tools.development.ApplicationConfigurationManager.<init>(ApplicationConfigurationManager.java:159)
	at com.google.appengine.tools.development.ApplicationConfigurationManager.newWarConfigurationManager(ApplicationConfigurationManager.java:101)
	at com.google.appengine.tools.development.ApplicationConfigurationManager.newWarConfigurationManager(ApplicationConfigurationManager.java:87)
	at com.google.appengine.tools.development.DevAppServerImpl.<init>(DevAppServerImpl.java:142)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:271)
	at com.google.appengine.tools.development.DevAppServerFactory.access$000(DevAppServerFactory.java:33)
	at com.google.appengine.tools.development.DevAppServerFactory$1.run(DevAppServerFactory.java:233)
	at com.google.appengine.tools.development.DevAppServerFactory$1.run(DevAppServerFactory.java:231)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:231)
	at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:101)
	at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:347)
	at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:47)
	at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:223)
	at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:214)
Caused by: java.io.FileNotFoundException: /private/var/tmp/_bazel_dclemen/7b6609c6dba886f72d542786a5989753/execroot/__main__/bazel-out/darwin-fastbuild/bin/foo-gae.runfiles/__main__/WEB-INF/appengine-web.xml (No such file or directory)
	at java.io.FileInputStream.open0(Native Method)
	at java.io.FileInputStream.open(FileInputStream.java:195)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at java.io.FileInputStream.<init>(FileInputStream.java:93)
	at com.google.apphosting.utils.config.AppEngineWebXmlReader.getInputStream(AppEngineWebXmlReader.java:137)
	... 22 more

com.google.apphosting.utils.config.AppEngineConfigException: Invalid configuration
	at com.google.appengine.tools.development.DevAppServerImpl.reportDeferredConfigurationException(DevAppServerImpl.java:432)
	at com.google.appengine.tools.development.DevAppServerImpl.doStart(DevAppServerImpl.java:232)
	at com.google.appengine.tools.development.DevAppServerImpl.access$000(DevAppServerImpl.java:47)
	at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:219)
	at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:217)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:217)
	at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:359)
	at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:47)
	at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:223)
	at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:214)
Caused by: com.google.apphosting.utils.config.AppEngineConfigException: Invalid appengine-web.xml(/private/var/tmp/_bazel_dclemen/7b6609c6dba886f72d542786a5989753/execroot/__main__/bazel-out/darwin-fastbuild/bin/foo-gae.runfiles/__main__/WEB-INF/appengine-web.xml) - Could not locate /private/var/tmp/_bazel_dclemen/7b6609c6dba886f72d542786a5989753/execroot/__main__/bazel-out/darwin-fastbuild/bin/foo-gae.runfiles/__main__/WEB-INF/appengine-web.xml

When I open up bazel-bin/foo-gae.war: I see the following structure:

/
    appengine-web.xml
    logging.properties
    web.xml
    WEB-INF/
        lib/
            - various.jar

deploy rule fails: __main__/../bazel_tools/tools/zip/zipper/zipper: No such file or directory

If gae is my appengine project, I cannot deploy with

bazel clean
bazel run //foo/bar/gae:gae.deploy

The deploy target fails with

/private/var/tmp/_bazel_regis/7227e5e4290f12bab77822f13216ec6d/execroot/workspace/bazel-out/local-fastbuild/bin/foo/bar/gae/gae.deploy: line 33: /Users/regis/Documents/workspace/__main__/../bazel_tools/tools/zip/zipper/zipper: No such file or directory

Flag --incompatible_load_java_rules_from_bzl will break rules_appengine in Bazel 1.2.1

Incompatible flag --incompatible_load_java_rules_from_bzl will break rules_appengine once Bazel 1.2.1 is released.

Please see the following CI builds for more information:

Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

For Java rules, files from multiple Labels of data attribute are flattened in war file

In https://github.com/bazelbuild/rules_appengine/blob/master/appengine/java_appengine.bzl#L82

    if path and in_file.short_path.startswith(path):
        output_path += in_file.short_path[len(path):]

when in_file.short_path does not start with path, what happens is output_path will remain output, the root directory of war file. And eventually ln -s $(pwd)/%s %s creates in_file symlink at the root directory, and ignores the directory structure of in_file.

If multiple files from different directories have the same name, one will overwrite the other.

I believe the desired behavior is to preserve the original directory structure of in_file and create symlink at output_path/in_file.path instead of output_path. I've got it working in a fork, it looks roughly like this

https://github.com/jiaqi/rules_appengine/pull/1/files#diff-3b8b4a89deffca2ab1dabfb178ff7012

If it make sense I can create a PR.

Deploy fails

I am following the Bazel backend tutorial

When I run $WORKSPACE/bazel-bin/backend/backend.deploy <project-id>

I get:

steren-macbookpro:tutorial steren$ $WORKSPACE/bazel-bin/backend/backend.deploy test-gae-bazel
Cannot stat file /private/var/folders/3v/vr09tqmx6t3bkzc046mzdb84007nxl/T/war.9u3YywA3/./WEB-INF: No such file or directory
Cannot stat file /private/var/folders/3v/vr09tqmx6t3bkzc046mzdb84007nxl/T/war.9u3YywA3/./WEB-INF/lib: No such file or directory
/Users/steren/work/test-bazel-gae/examples/tutorial//bazel-bin/backend/backend.deploy: line 38: /Users/steren/work/test-bazel-gae/examples/tutorial//bazel-bin/backend/backend.runfiles/__main__/../com_google_appengine_java/appengine-java-sdk-1.9.38//bin/appcfg.sh: No such file or directory

@kchodorow said in this PR:

it looks like it's using AppEngine 1.9.38, not 1.9.48 (which is what rule_appengine 0.0.5 specifies). > Is it possible you're using an older version of rules_appengine (maybe overriding the version in your WORKSPACE file)?

My answer is: I am just following the tutorial and have no real idea of what I am doing. I did not specify myself an sdk version.
However, I note the presence of an appengine.BUILD next to my WORKSPACE file in the sample code I download for the tutorial: https://github.com/bazelbuild/examples/blob/source-only/tutorial/appengine.BUILD
Is this normal ? Could this be the problem?

Are these rules still being maintained?

Hi,
Are these rules still being maintained?
It seems there's a tiny bit of activity so it's not completely dead but there are open issues which sound important (like #63 ) and it's unclear if there's an owner.

cc @davidstanke @helenalt @dslomov who might have some answers

(We obviously need them which is why I'm asking)

appengine_war doesn't work with a java_library

The doc reads:

appengine_war(name, jars, data, data_path)

and

jars List of labels, required
List of JAR files that will be uncompressed as the code for the Web Application.
If it is a java_library or a java_import, the JAR from the runtime classpath will be added in the lib directory of the Web Application.

In my experience, the jars from the targets are not added.

In fact, even examples is adding the jar explicitely:

jars = ["//examples/src:src_deploy.jar"],

This would also work:

jars = ["//examples/src:srr.jar"],

But this doesn't:

jars = ["//examples/src:src"],

If I understand correctly, it should (and the syntax would be nicer and follow the convention of listing targets, not build artifacts).

Support homebrew bazel 4.0.0

Homebrew upgraded me to bazel 4.0.0 and now I'm getting this failure:
@io_bazel_rules_appengine//appengine:jdk8: no such attribute 'extclasspath' in 'java_toolchain' rule

$ bazel --version
bazel 4.0.0-homebrew

py_appengine_test doesn't allow python_version

In Bazel 0.27 the default Python runtime behavior changed and as a side effect of that it seems that tests are trying to execute in Python 3 unless you explicitly specify Python 2. However py_appengine_test doesn't allow for the python_version flag. Is there any plans to add this functionality to the appengine rules or a workaround that I'm missing?

missing com_google_cloud_sdk

I tried updating google/upvote to use 0.0.8 but then ran into:
/monolith_binary.deploy: line 26: ${{TMPDIR:-/tmp}}/war.XXXXXXXX: bad substitution
presumably due to double curly braces that seems to be fixed in the latest release.

Using head I get:
upvote/gae/BUILD:15:1: no such package '@com_google_cloud_sdk//': The repository could not be resolved and referenced by '//upvote/gae:monolith_binary.deploy'

Support standard Python3 environment

While bazel itself works perfectly with Flask, it seems currently it's impossible to deploy app like Python3 quickstart.

The first issue is requirements.txt is not symlinked into bazel-build/path/to/app/app.deploy.runfiles/project (where app.yaml is located). Probably, the issue could be overcome if flask is bundled into external dependency, but gunicorn (or other wsgi server) should be declared somehow.

I manually added symlink to /path/to/app/requirements.txt into bazel-build/path/to/app/app.deploy.runfiles/project and after bazel run //path/to/app:app.deploy it worked, gunicorn dependency was resolved.

The second issue is related to loading main module.

Tried several ways to specify entrypoint in app.yaml:

entrypoint: gunicorn -b :$PORT main:app

This caused the following stacktrace:

Traceback (most recent call last):
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
    worker.init_process()
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/gunicorn/util.py", line 359, in import_app
    mod = importlib.import_module(module)
  File "/opt/python3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'main'

And

entrypoint: gunicorn -b :$PORT --chdir /path/to/app main:app
entrypoint: gunicorn -b :$PORT path.to.app.main:app

produced:

Traceback (most recent call last):
  File "/opt/python3.8/lib/python3.8/pkgutil.py", line 493, in find_loader
    spec = importlib.util.find_spec(fullname)
  File "/opt/python3.8/lib/python3.8/importlib/util.py", line 94, in find_spec
    parent = __import__(parent_name, fromlist=['__path__'])
ModuleNotFoundError: No module named '/workspace/path/to/app/main'

Any plans on supporting flask in python appengine standard environment?

Thanks.

rules_appengine is failing on ci.bazel.io

http://ci.bazel.io/job/rules_appengine/BAZEL_VERSION=HEAD,PLATFORM_NAME=linux-x86_64/303/console

==================== Test output for //test:check_war:
Contents of /home/ci/.cache/bazel/_bazel_ci/c750b964429e227e39aa79a8541a1a88/bazel-sandbox/82344825-2998-4893-bb74-03d7753caf81-0/execroot/linux-x86_64/bazel-out/local-fastbuild/bin/test/check_war.runfiles/io_bazel_rules_appengine/test/test-war.war:
./
./data/
./data/BUILD
./data/welcome.jsp
./data/gen-data.out
./WEB-INF/
./WEB-INF/web.xml
./WEB-INF/lib/
./WEB-INF/lib/appengine-tools-api.jar
./WEB-INF/lib/appengine-agent.jar
./WEB-INF/lib/app_deploy.jar
./WEB-INF/logging.properties
./WEB-INF/appengine-web.xml
Expected './WEB-INF/lib/appengine-api.jar' in /home/ci/.cache/bazel/_bazel_ci/c750b964429e227e39aa79a8541a1a88/bazel-sandbox/82344825-2998-4893-bb74-03d7753caf81-0/execroot/linux-x86_64/bazel-out/local-fastbuild/bin/test/check_war.runfiles/io_bazel_rules_appengine/test/test-war.war
================================================================================
Target //test:check_war up-to-date:
  bazel-bin/test/check_war
____Elapsed time: 1.511s, Critical Path: 0.85s
//test:check_war                                                         FAILED in 0.7s
  /home/ci/.cache/bazel/_bazel_ci/c750b964429e227e39aa79a8541a1a88/execroot/linux-x86_64/bazel-out/local-fastbuild/testlogs/test/check_war/test.log

Executed 1 out of 1 test: 1 fails locally.

Looks like 68b0fa6 is breaking rules_appengine on ci.bazel.io
//cc @kchodorow

Support for python 3 google sdk

Failing to run py_appengine_binary due to assertion in google cloud SDK to validate if it is version 2 of python or not.
Please help on how to make it work for python 3? or is there any issue with the version I am using?
I am using the following version

git_repository(
    name = "io_bazel_rules_appengine",
    remote = "https://github.com/bazelbuild/rules_appengine.git",
    # Check https://github.com/bazelbuild/rules_appengine/releases for the latest version.
    tag = "0.0.9",
)

load(
    "@io_bazel_rules_appengine//appengine:sdk.bzl",
    "appengine_repositories",
)

appengine_repositories()

load(
    "@io_bazel_rules_appengine//appengine:py_appengine.bzl",
    "py_appengine_repositories",
)

py_appengine_repositories(
    version = '1.9.78',
)

INFO: Build completed successfully, 1 total action
Traceback (most recent call last):
  File "/private/var/tmp/_bazel_harsh/377f44f7fb0eb350b3e1b9a606fda7bf/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/projects/app-config/main.runfiles/com_google_appengine_py/dev_appserver.py", line 95, in <module>
    assert sys.version_info[0] == 2
AssertionError

broken again by bazel's paths

Similar to: bazelbuild/bazel#1233

At HEAD of both bazel and rules_appengine
bazel run :myapp

.../bazel-out/local-fastbuild/bin/myapp: line 32: .../bazel-out/local-fastbuild/bin/myapp.runfiles/../bazel_tools/tools/zip/zipper/zipper: No such file or directory
Error: Could not find or load main class com.google.appengine.tools.development.DevAppServerMain

and also
bazel build :myapp && bazel-bin/myapp.deploy $myproject
bazel-bin/myapp.deploy: line 33: .../bazel-bin/refapp.runfiles/../bazel_tools/tools/zip/zipper/zipper: No such file or directory
bazel-bin/myapp.deploy: line 38: .../bazel-bin/myapp.runfiles/external/com_google_appengine_java/appengine-java-sdk-1.9.34//bin/appcfg.sh: No such file or directory

Flag --incompatible_no_implicit_file_export will break rules_appengine in Bazel 1.2.1

Incompatible flag --incompatible_no_implicit_file_export will break rules_appengine once Bazel 1.2.1 is released.

Please see the following CI builds for more information:

Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

App Engine deployment should use "gcloud" cli rather than "appcfg.py" (or have a way to use "gcloud")

Steps to reproduce:

  1. Create a py_appengine_binary target
  2. Build the .deploy target
  3. Run the .deploy script

Observed:

This command runs appcfg.py

Expected

This should run gcloud app deploy

Rationale

The gcloud cli is the more modern approach to deploying to App Engine. Additionally, gcloud app deploy can pick up the project from a prior invocation of gcloud config set project without having to specific it in the invocation explicitly (as is the case with appcfg.py). Likewise, gcloud app deploy is capable of auto-assigning a version number (based on the date), whereas appcfg.py requires an explicit -V parameter with the version specification.

CI fails with Bazel@HEAD due to missing java_runtime

CI for rules_appengine is failing with Bazel@HEAD
https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/1838#d8060cf3-3da6-491f-8598-92312e044b19

(02:09:50) ERROR: /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/78942d9c203732b140720053b958a9bd/external/rules_appengine_toolchain/BUILD.bazel:9:23: @rules_appengine_toolchain//:jdk8: missing value for mandatory attribute 'java_runtime' in 'java_toolchain' rule
--
  | (02:09:50) ERROR: /var/lib/buildkite-agent/builds/bk-docker-p58c/bazel-downstream-projects/rules_appengine/appengine/BUILD:15:6: Target '@rules_appengine_toolchain//:jdk8' contains an error and its package is in error and referenced by '//appengine:jdk8'

This originates from a change introduced in bazelbuild/bazel@c8e179f

This made java_runtime a mandatory attribute of java_toolchain.

target 'appengine/java/api' not declared in package 'external'

Hello,

I'm trying to make the bookshelf example app in the google documentation work with Bazel.

I can't build though. I run into this:

$ bazel build :myapp
INFO: $TEST_TMPDIR defined: output root default is '/spare/local/bazel/'.
.........................
ERROR: /spare/local/code/appengine/BUILD:17:1: no such target '//external:appengine/java/api': target 'appengine/java/api' not declared in package 'external' defined by /spare/local/code/appengine/WORKSPACE and referenced by '//:mylib'.
ERROR: Analysis of target '//:myapp' failed; build aborted.
INFO: Elapsed time: 2.065s

I attached my BUILD and WORKSPACE files.

Thanks

Mirko

configuration.zip

appengine_war cannot complete due to incorrect zipper parameters

As of Bazel 0.4.1 on Windows 10+JDK8.111, the rule appengine_war cannot complete its run due to an apparently incorrect parameter for the Zipper. Attached is the command.log.

Truth be told, I'm not entirely sure if this is specific to the appengine ruleset (the java_library goal runs just fine) or if it's a more general Bazel-issue and should be reported there...

ClassLoader is jdk.internal.loader.ClassLoaders$AppClassLoader@4b85612c, not a URLClassLoader

I followed all the instructions in the README.

My BUILD conf is:

load("@io_bazel_rules_appengine//appengine:java_appengine.bzl", "appengine_war")

java_library(
    name = "mylib",
    srcs = ["java/my/webapp/ServletConfig.java", "java/my/webapp/MyServlet.java"],
    deps = [
        "@maven//:com_google_inject_extensions_guice_servlet",
        "@maven//:com_google_inject_guice",
        "@maven//:javax_inject_javax_inject",
        "@maven//:javax_servlet_javax_servlet_api"
    ],
)

appengine_war(
    name = "myapp",
    jars = [":mylib"],
    data = glob(["java/**"]),
    data_path = "/",
)

The command bazelbuild build works perfectly but when I run bazel run //app_engine:myapp I get the following error:

INFO: Analyzed target //app_engine:myapp (1 packages loaded, 4 targets configured).
INFO: Found 1 target...
Target //app_engine:myapp up-to-date:
  bazel-bin/app_engine/myapp.war
  bazel-bin/app_engine/myapp_deploy.sh
  bazel-bin/app_engine/myapp
INFO: Elapsed time: 0.250s, Critical Path: 0.02s
INFO: 3 processes: 3 internal.
INFO: Build completed successfully, 3 total actions
INFO: Build completed successfully, 3 total actions
java.lang.RuntimeException: Unable to create a DevAppServer
	at com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:401)
	at com.google.appengine.tools.development.DevAppServerFactory.access$000(DevAppServerFactory.java:31)
	at com.google.appengine.tools.development.DevAppServerFactory$1.run(DevAppServerFactory.java:318)
	at com.google.appengine.tools.development.DevAppServerFactory$1.run(DevAppServerFactory.java:315)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:314)
	at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:374)
	at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:45)
	at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:247)
	at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:238)
Caused by: java.lang.ClassCastException: ClassLoader is jdk.internal.loader.ClassLoaders$AppClassLoader@4b85612c, not a URLClassLoader.
	at com.google.apphosting.utils.security.SecurityManagerInstaller.generatePolicyFile(SecurityManagerInstaller.java:139)
	at com.google.apphosting.utils.security.SecurityManagerInstaller.install(SecurityManagerInstaller.java:94)
	at com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:377)
	... 9 more

WAR packaging will fail if there are dependencies with the same name

WAR packaging will fail if there are different dependencies with the same name

Here you can find an example for a repo that has 2 packages with the same name - services.

Running bazel build on the above repo will fail with:

ln: bazel-out/darwin-fastbuild/bin/src/main/app.war.build_output/WEB-INF/lib/libservices.jar: File exists

Latest release (0.0.7) does not include java_appengine.bzl

Hello,

The tag specified in the README file (0.0.7) does not include the java_appengine.bzl file, please generate a new release that includes the required files.

Workaround (specify the commit instead of the tag):
git_repository( name = "io_bazel_rules_appengine", remote = "https://github.com/bazelbuild/rules_appengine.git", # Check https://github.com/bazelbuild/rules_appengine/releases for the latest version. #tag = "0.0.7", commit = "44caf2de649bb37a41408a821d04833450fa89a3", )

py_appengine_binary only works for targets at the top-level of the workspace

While working on #10, I found that py_appengine_binary only works if the build target is at the top-level of the workspace. Part of what's happening is the wrapper appengine_config.py file created by py_appengine.bzl is created under a different directory in sandbox than the other files from the target. Something like this:

...runfiles/
appengine_config.py
examples/
py/
hello_world/
main.py

sys.path is configured to include the ...runfiles, directory but not examples/py/hello_world, so when devappserver does an 'import main', it fails. I'm not sure the fix is to just update sys.path to include that path. I believe that appcfg and gcloud expect all of the files to be together. Eg.

/
appengine_config.py
main.py

Is it supported in bazel to construct a sandbox with a specific layout? I think this will help with adding gcloud support and third party modules.
For example, the setup instruction recommends pip install GoogleAppEngineCloudStorageClient -t <your_app_directory/lib> to use GCS. It's expected to be under the lib directory and to be uploaded with the rest of the app.

unable to upgrade to 1.9.36, can't run DevServer

Attempting to update to 1.9.36 causes crashes.

diff --git a/appengine/appengine.bzl b/appengine/appengine.bzl
index 9931317..1d7706b 100644
--- a/appengine/appengine.bzl
+++ b/appengine/appengine.bzl
@@ -243,24 +243,24 @@ java_import(

 java_import(
     name = "api",
-    jars = ["appengine-java-sdk-1.9.34/lib/impl/appengine-api.jar"],
+    jars = ["appengine-java-sdk-1.9.36/lib/impl/appengine-api.jar"],
     visibility = ["//visibility:public"],
     neverlink = 1,
 )

 filegroup(
     name = "sdk",
-    srcs = glob(["appengine-java-sdk-1.9.34/**"]),
+    srcs = glob(["appengine-java-sdk-1.9.36/**"]),
     visibility = ["//visibility:public"],
-    path = "appengine-java-sdk-1.9.34",
+    path = "appengine-java-sdk-1.9.36",
 )
 """

 def appengine_repositories():
   native.new_http_archive(
       name = "com_google_appengine_java",
-      url = "http://central.maven.org/maven2/com/google/appengine/appengine-java-sdk/1.9.34/appengine-java-sdk-1.9.34.zip",
-      sha256 = "34e828bf64b48c7dc212b6cb82d67c32d42b75c988d793b97bae5fda849ce486",
+      url = "http://central.maven.org/maven2/com/google/appengine/appengine-java-sdk/1.9.36/appengine-java-sdk-1.9.36.zip",
+      sha256 = "a4694a48c3ecc7c8dc9952cfc8f94b76739ddb0d954a7a14007dcc901a38df9b",
       build_file_content = APPENGINE_BUILD_FILE,
   )

leads to
java.lang.RuntimeException: Unable to create a DevAppServer
at com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:282)
at com.google.appengine.tools.development.DevAppServerFactory.access$000(DevAppServerFactory.java:36)
at com.google.appengine.tools.development.DevAppServerFactory$1.run(DevAppServerFactory.java:236)
at com.google.appengine.tools.development.DevAppServerFactory$1.run(DevAppServerFactory.java:234)
at java.security.AccessController.doPrivileged(Native Method)
at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:234)
at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:104)
at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:265)
at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:225)
at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:216)
Caused by: java.lang.NoSuchMethodError: com.google.apphosting.utils.config.XmlUtils.getChildren(Lorg/w3c/dom/Element;)Ljava/util/List;
at com.google.apphosting.utils.config.WebXmlReader.parseWebXml(WebXmlReader.java:96)
at com.google.apphosting.utils.config.WebXmlReader.processXml(WebXmlReader.java:79)
at com.google.apphosting.utils.config.WebXmlReader.processXml(WebXmlReader.java:20)
at com.google.apphosting.utils.config.AbstractConfigXmlReader.readConfigXml(AbstractConfigXmlReader.java:91)
at com.google.apphosting.utils.config.WebXmlReader.readWebXml(WebXmlReader.java:72)
at com.google.apphosting.utils.config.EarHelper.readWebModule(EarHelper.java:175)
at com.google.appengine.tools.development.ApplicationConfigurationManager$WarModuleConfigurationHandle.readConfiguration(ApplicationConfigurationManager.java:414)
at com.google.appengine.tools.development.ApplicationConfigurationManager.(ApplicationConfigurationManager.java:159)
at com.google.appengine.tools.development.ApplicationConfigurationManager.newWarConfigurationManager(ApplicationConfigurationManager.java:101)
at com.google.appengine.tools.development.ApplicationConfigurationManager.newWarConfigurationManager(ApplicationConfigurationManager.java:87)
at com.google.appengine.tools.development.DevAppServerImpl.(DevAppServerImpl.java:139)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:274)
... 10 more

Argument for --skip_sdk_update_check is not being passed to dev_appserver.py

When running the command bazel run my_appengine_binary the command fails with the following message:

INFO: Analysed target //appname:appname (0 packages loaded).
INFO: Found 1 target...
Target //appname:appname up-to-date:
  bazel-bin/appname/appname_deploy.sh
  bazel-bin/appname/appname
INFO: Elapsed time: 0.290s, Critical Path: 0.00s
INFO: Build completed successfully, 1 total action

INFO: Running command line: bazel-bin/appname/appname
Allow dev_appserver to check for updates on startup? (Y/n): Traceback (most recent call last):
  File "/private/var/tmp/_bazel_user/81bad90251c078816a6123377b969ba0/execroot/__main__/bazel-out/darwin-fastbuild/bin/appname/appname.runfiles/__main__/../com_google_appengine_python/dev_appserver.py", line 101, in <module>
    _run_file(__file__, globals())
  File "/private/var/tmp/_bazel_user/81bad90251c078816a6123377b969ba0/execroot/__main__/bazel-out/darwin-fastbuild/bin/appname/appname.runfiles/__main__/../com_google_appengine_python/dev_appserver.py", line 97, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/private/var/tmp/_bazel_user/81bad90251c078816a6123377b969ba0/external/com_google_appengine_python/google/appengine/tools/devappserver2/devappserver2.py", line 1041, in <module>
    main()
  File "/private/var/tmp/_bazel_user/81bad90251c078816a6123377b969ba0/external/com_google_appengine_python/google/appengine/tools/devappserver2/devappserver2.py", line 1029, in main
    dev_server.start(options)
  File "/private/var/tmp/_bazel_user/81bad90251c078816a6123377b969ba0/external/com_google_appengine_python/google/appengine/tools/devappserver2/devappserver2.py", line 766, in start
    update_checker.check_for_updates(configuration)
  File "/private/var/tmp/_bazel_user/81bad90251c078816a6123377b969ba0/external/com_google_appengine_python/google/appengine/tools/devappserver2/update_checker.py", line 91, in check_for_updates
    if update_check.AllowedToCheckForUpdates():
  File "/private/var/tmp/_bazel_user/81bad90251c078816a6123377b969ba0/external/com_google_appengine_python/google/appengine/tools/sdk_update_checker.py", line 410, in AllowedToCheckForUpdates
    answer = input_fn('Allow dev_appserver to check for updates on startup? '
EOFError: EOF when reading a line
ERROR: Non-zero return code '1' from command: Process exited with status 1

My WORKSPACE file contains the following:

git_repository(
    name = "io_bazel_rules_appengine",
    remote = "https://github.com/bazelbuild/rules_appengine.git",
    # Check https://github.com/bazelbuild/rules_appengine/releases for the latest version.
    tag = "0.0.7",
)
#Load Python Rules
load("@io_bazel_rules_appengine//appengine:py_appengine.bzl", "py_appengine_repositories")
py_appengine_repositories()

java: unable to build examples app on OSX from master

Build label: 3.7.0-homebrew
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Oct 21 04:06:38 2020 (1603253198)
Build timestamp: 1603253198
Build timestamp as int: 1603253198
☁  rules_appengine [master] bazel build --extra_toolchains=@io_bazel_rules_appengine//appengine/jdk:jdk8 //examples/java:examples
INFO: Build option --extra_toolchains has changed, discarding analysis cache.
ERROR: /private/var/tmp/_bazel_mgenov/dd7cf166a2897e6d4ee8f8f48271a52e/external/remote_jdk8_windows_toolchain_config_repo/BUILD.bazel:20:10: @remote_jdk8_windows_toolchain_config_repo//:toolchain: no such attribute 'target_settings' in 'toolchain' rule
ERROR: Analysis of target '//examples/java:examples' failed; build aborted: error loading package '@remote_jdk8_windows_toolchain_config_repo//': Package '' contains errors
INFO: Elapsed time: 0.372s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (8 packages loaded, 16 targets configured)
    Fetching @local_jdk; fetching
☁  rules_appengine [master]

py_appengine_binary doesn't work properly

There multiple issues with that rule:

  1. It doesn't maintain creating of init.py files throughout paths.
  2. External modules don't get imported if they import their submodules inside.
    Actually py_binary() rule does all of that but it's not aware of .yaml configs.

Cannot run Dev server on Mac with java 1.8.0_91

Once #17 is pulled, you can run the Dev-server fine on linux, but on Mac OSX with the latest java 8 "1.8.0_91" going to any jsp page leads to:

"Unable to compile class for JSP:

An error occurred at line: 1 in the generated java file
The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files
"

Which looks like
http://stackoverflow.com/questions/36963248/the-type-java-io-objectinputstream-cannot-be-resolved-it-is-indirectly-referenc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.