Where/how can I find/generate .class files after building Nomulus using Bazel?

40 views
Skip to first unread message

Pooyan Behnamghader

unread,
Dec 20, 2017, 6:23:54 PM12/20/17
to nomulus-discuss
I'm using Nomulus as a case study for a research project, and I need to generate .class files. After building Nomulus using the following command, I cannot find/generate .class files.  

bazel --batch build --javacopt="-target 8 -source 8" //java/google/registry/...

Where/how can I find/generate .class files?

Thanks,
Pooyan

Lai Jiang

unread,
Dec 20, 2017, 6:32:22 PM12/20/17
to behnam...@gmail.com, nomulus-discuss
They should be packaged in bazel-out folder in your workspace. Search for .jar files in that folder, and the class files are inside the jars.




Lai Jiang | Software Engineer | jian...@google.com | 212-565-6361



--
NOTE: This is a public discussion list for the Nomulus domain registry project.
---
You received this message because you are subscribed to the Google Groups "nomulus-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nomulus-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nomulus-discuss/fdd245fc-442a-4272-8389-8511f7168391%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ben McIlwain

unread,
Dec 20, 2017, 7:09:17 PM12/20/17
to Lai Jiang, behnam...@gmail.com, nomulus-discuss
Also worth pointing out that the command-line program find that helps in this case.  From the root of the nomulus directory, run:

$ find -L . -iname \*.class
./bazel-out/host/bin/external/io_bazel_rules_closure/java/com/google/javascript/jscomp/_javac/jscomp/libjscomp_classes/com/google/javascript/jscomp/CheckStrictDeps$FirstPass.class
./bazel-out/host/bin/external/io_bazel_rules_closure/java/com/google/javascript/jscomp/_javac/jscomp/libjscomp_classes/com/google/javascript/jscomp/JsCompilerWarnings.class
...

The -L option instructs find to follow symlinks, which is necessary because bazel-out is a symlink to a temporary directory in .cache/bazel in your homedir.


Pooyan Behnamghader

unread,
Dec 20, 2017, 7:34:19 PM12/20/17
to nomulus-discuss
Ben, Lai, thanks a lot for the comments. I can see .class files now. 

Is there any way that I can have all .class files in one directory with a structure similar to "./java" directory?

I mean, for example, for ./java/google/registry/export/ExportConstants.java I can have something like ./target/classes/google/registry/export/ExportConstants.class similar to what MVN generates?

Thanks,
Pooyan

Ben McIlwain

unread,
Dec 20, 2017, 7:42:01 PM12/20/17
to Pooyan Behnamghader, nomulus-discuss
Sure, but you'll likely need to write something to make that happen.  It's not a hard problem though.  You're trying to move paths that look like this:

./bazel-out/local-fastbuild/bin/java/google/registry/rde/imports/_javac/imports/libimports_classes/google/registry/rde/imports/RdeHostImportAction.class

to:

./target/classes/google/registry/rde/imports/ExportConstants.class

The parts in bold are always the same and can simply be stripped out/handled appropriately.  The parts in italics are the package, which are duplicated twice within the bazel path for some reason and only once in the Maven format.  I'm sure that someone who's really good at bash could come up with a one-liner to do this, but I'd probably resort to writing a simple Python script.

Reply all
Reply to author
Forward
0 new messages