aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/python/PyCommon.java
Commit message (Collapse)AuthorAge
* Make things easier to serialize: make constants constant, tag some lambdas. ↵Gravatar janakr2018-06-19
| | | | | | Get rid of a useless tag, because the Function being tagged is a concrete class, so won't be serializable. Will deal with it in a follow-up. Implement equality for BazelInfo. PiperOrigin-RevId: 201199255
* Remove attribute read checks expecting a DATA transition.Gravatar gregce2018-05-25
| | | | | | | | | | | | | | This is a precursor to removing the DATA transition outright. While we could also have changed the Mode.DATA instances to Mode.TARGET (which would declare that we expect the attribute not to apply any transition), that would break existing definitions and make depot cleanup more delicate. Plus, these checks weren't being consistently applied across attributes anyway so they don't really offer much. A lot of this logic is really just leftover legacy from the pre-dynamic configuration days. PiperOrigin-RevId: 198085059
* Migrate struct() to skylarkbuildapiGravatar cparsons2018-05-24
| | | | | RELNOTES: None. PiperOrigin-RevId: 197915097
* Rename OutputGroupProvider -> OutputGroupInfo.Gravatar dslomov2017-12-14
| | | | | RELNOTES: None PiperOrigin-RevId: 179046403
* Replace all usages of Blaze's Preconditions class with guava.Gravatar tomlu2017-11-09
| | | | | | | | Blaze had its own class to avoid GC from varargs array creation for the precondition happy path. Guava now (mostly) implements these, making it unnecessary to maintain our own. This change was almost entirely automated by search-and-replace. A few BUILD files needed fixing up since I removed an export of preconditions from lib:util, which was all done by add_deps. There was one incorrect usage of Preconditions that was caught by error prone (which checks Guava's version of Preconditions) that I had to change manually. PiperOrigin-RevId: 175033526
* Reorganise the srcs_version attribute of py_binary/py_test/py_library rules:Gravatar Googler2017-09-27
| | | | | | | | | | | make the default for srcs_version be "PY2AND3" (while leaving default_python_version at "PY2"), since that's a more likely situation and a more obvious error condition. (Having PY2 as the default caused 2to3 to be used a lot more than necessary, which in turn can both hide and cause bugs.) Also, use attribute value restrictions to limit srcs_version and default_python_version to sensible values for the specific rule type. PiperOrigin-RevId: 170174546
* Move --build_python_zip into PythonConfiguration.Gravatar mstaib2017-09-21
| | | | | | | | There's no need for it in the core configuration options, as it's used exclusively by Python rules. RELNOTES: None. PiperOrigin-RevId: 169435643
* Move RuleConfiguredTarget to lib.analysis.configuredtargets.Gravatar gregce2017-09-19
| | | | | | This is a trivial change with a large file footprint. PiperOrigin-RevId: 169169864
* Windows: Implement python native launcherGravatar Yun Peng2017-08-21
| | | | | | | | | | | | Now Bazel build a Windows exe to launch the python self-extracting zip file by default, using --windows_exe_launcher=0 to switch back to cmd wrapper. The extra zip file with shebang preprended is not built on Windows anymore, even when using cmd wrapper. Change-Id: Ic7060326f19ca6e2e73ea8d8211afd1c7618083c PiperOrigin-RevId: 165707076
* Move core test classes to lib.analysis.testGravatar ulfjack2017-08-11
| | | | | | | | These are depended upon by analysis code, so need to live in the same library as lib.analysis. Moving them here makes it possible to split the build-base library into separate libraries for analysis, execution, and rules. PiperOrigin-RevId: 164847161
* Better names for declared providers-related classes.Gravatar dslomov2017-08-01
| | | | | | | | Follows https://docs.google.com/document/d/1aAIVWvHPERDz2cv_PCFGwr8dvh5FcAkENFoRsNS4clk/. RELNOTES: None. PiperOrigin-RevId: 163728291
* Allow py_binary to be the executable of a Skylark action or anyGravatar Philipp Wollermann2017-07-18
| | | | | | | | | SpawnAction on Windows. RELNOTES: None. Change-Id: I2d926447511dab5fb804051abdbef9031cb089be PiperOrigin-RevId: 162201440
* PiperOrigin-RevId: 158274860Gravatar carmi2017-06-08
|
* Do not access SkylarkProviders anywhere outside of ConfiguredTarget ↵Gravatar dslomov2017-05-16
| | | | | | | | | | | implementation. A first step towards applying the same memory optimizations we do for native provider representation to Skylark providers (declared and legacy). RELNOTES: None. PiperOrigin-RevId: 156111749
* Refactor all ctor callsites of PathFragment to instead call a static ↵Gravatar nharmata2017-04-05
| | | | | | | | | | | | 'create' method. This paves the way for changing PathFragment to e.g. an abstract class with multiple subclasses. This way we can split out the windows-specific stuff into one of these concrete classes, making the code more readable and also saving memory (since the shallow heap size of the NonWindowsPathFragment subclass will hopefully be smaller than that of the current PathFragment). This also lets us pursue gc churn optimizations. We can now do interning in PathFragment#create and can also get rid of unnecessary intermediate PathFragment allocations. RELNOTES: None PiperOrigin-RevId: 152145768
* Refactor implementation of native and Skylark declared providers.Gravatar Dmitry Lomov2017-03-03
| | | | | | | | | | | | 1) Instead of having a single class for both, split them into {Skylark,Native}ClassObjectConstructors 2) Allow NativeClassObjectConstructors to customize their instantiation logic. 3) Prepare ClassObjectConstructor.Key to be serializable. -- PiperOrigin-RevId: 148997553 MOS_MIGRATED_REVID=148997553
* Remove some unused code from the Python rules.Gravatar Lukacs Berki2016-09-08
| | | | | -- MOS_MIGRATED_REVID=132433369
* Using stub_template.txt as __main__.py and zip header in python executable zipGravatar Yun Peng2016-08-10
| | | | | | | | | | | | | | | | | | In stub_template.txt, we now unzip the python zip file to a temp directory if needed. This will get rid of bash in python executable file completely. Users can run the binary directly or using python <zip>, like: ./bazel-bin/examples/py_native/bin or python ./bazel-bin/examples/py_native/bin On Windows, we can use the second way to run python binary from native Windows command line (cmd.exe). -- Change-Id: I73fdd88f05f8f343dd19b2f3686ae031dfb476ba Reviewed-on: https://bazel-review.googlesource.com/#/c/5310 MOS_MIGRATED_REVID=129767890
* Add SkylarkClassObjectConstructor - a future return value of "provider" ↵Gravatar Dmitry Lomov2016-08-09
| | | | | | | function. -- MOS_MIGRATED_REVID=129726780
* Make SkylarkClassObject "Bazel-specific".Gravatar Dmitry Lomov2016-08-05
| | | | | | | This in preparation to DeclaredProviders implementation. -- MOS_MIGRATED_REVID=129420617
* Create Python executable zip fileGravatar Yun Peng2016-08-04
| | | | | | | | | | using --build_python_zip to specify it, by default it's enabled on Windows and disabled on other platforms. -- Change-Id: Ib992edaf70c08568816b973159a429ff7165eed8 Reviewed-on: https://bazel-review.googlesource.com/#/c/4244 MOS_MIGRATED_REVID=129326115
* Replace calls to SpawnAction$Builder#addInputs(NestedSet) with ↵Gravatar Liam Miller-Cushon2016-07-29
| | | | | | | addTransitiveInputs -- MOS_MIGRATED_REVID=128820723
* Don't store workspace name on ruleGravatar Michajlo Matijkiw2016-07-18
| | | | | | | Instead have callers get it via package. -- MOS_MIGRATED_REVID=127715494
* Rollback of commit bdfd58a8ca2ed5735d6aaa5b238fb0f689515724.Gravatar Laurent Le Brun2016-06-20
| | | | | -- MOS_MIGRATED_REVID=125160288
* Make the execution root match the runfiles tree structure for external ↵Gravatar Kristina Chodorow2016-06-17
| | | | | | | | | | | | | | | | | | | | | repositories One interesting side effect of how this is implemented is that for external repositories, bin/ and genfiles/ are combined. External repo output is under bazel-out/local-fastbuild/repo_name for each repo. Fixes #1262. RELNOTES[INC]: Previously, an external repository would be symlinked into the execution root at execroot/local_repo/external/remote_repo. This changes it to be at execroot/remote_repo. This may break genrules/Skylark actions that hardcode execution root paths. If this causes breakages for you, ensure that genrules are using $(location :target) to access files and Skylark rules are using http://bazel.io/docs/skylark/lib/File.html's path, dirname, etc. functions. -- MOS_MIGRATED_REVID=125095799
* --Gravatar Carmi Grushko2016-05-27
| | | | MOS_MIGRATED_REVID=123210708
* Improve progress message of the actions triggered by --precompile_python.Gravatar Googler2016-05-17
| | | | | | | | Typical output looks like: Compiling Python my/package/module.py -- MOS_MIGRATED_REVID=122522202
* Switch to using ../repo-name syntax for runfilesGravatar Kristina Chodorow2016-05-04
| | | | | -- MOS_MIGRATED_REVID=121475668
* Automated [] rollback of commit 857cda2c45a5cc68c3fa398311c48c571a64915d and ↵Gravatar Damien Martin-Guillerez2016-04-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | commit 790d2f6009d47fe92cf0cd92a1473bbf0141f32e. *** Reason for rollback *** Broke non-Bazel projects on ci.bazel.io Fixes #1168 *** Original change description *** Move the runfiles for external repositories to under the x.runfiles/ directory This also sets the Bazel workspace name to io_bazel_source. Fixes #848. Relevant to #1116, #1124, RELNOTES[INC]: All repositories are now directly under the x.runfiles directory in the runfiles tree (previously, external repositories were at x.runfiles/main-repo/external/other-repo. This simplifies handling remote repository runfiles considerably, but will break existing references to external repository runfiles.... *** -- MOS_MIGRATED_REVID=120535721
* Remove all internal calls to FileProvider.getLabel.Gravatar Ulf Adams2016-04-22
| | | | | | | | The method will be removed in a subsequent change to facilitate reverting the change in case it goes bad. -- MOS_MIGRATED_REVID=120526894
* Move the runfiles for external repositories to under the x.runfiles/ directoryGravatar Kristina Chodorow2016-04-20
| | | | | | | | | | | | | | | This also sets the Bazel workspace name to io_bazel_source. Fixes #848. Relevant to #1116, #1124, RELNOTES[INC]: All repositories are now directly under the x.runfiles directory in the runfiles tree (previously, external repositories were at x.runfiles/main-repo/external/other-repo. This simplifies handling remote repository runfiles considerably, but will break existing references to external repository runfiles. --- Furthermore, if a Bazel project does not provide a workspace name in the WORKSPACE file, Bazel will now default to using __main__ as the workspace name (instead of "", as previously). The repository's runfiles will appear under x.runfiles/__main__/. -- MOS_MIGRATED_REVID=120224534
* Review a number of action subclasses and update them according to the spec.Gravatar Ulf Adams2016-04-19
| | | | | | | | | | Second pass. Consists of adding @Immutable annotations, adding final modifiers, and changing the types of fields to immutable types. -- MOS_MIGRATED_REVID=120216592
* Fixed indentation problem: 8 spaces -> 4 spacesGravatar Yun Peng2016-03-21
| | | | | -- MOS_MIGRATED_REVID=117583615
* Changed py_wrap_cc rule's dependency validation to mandatoryProvdersList soGravatar Yun Peng2016-03-08
| | | | | | | that it can depend on Skylark rule. -- MOS_MIGRATED_REVID=116385078
* Python provider is now available in SkylarkGravatar Yun Peng2016-03-03
| | | | | | | | | | | | | Using mandatoryProvidersList to validate python rules' dependency. Added a SkylarkProvider named 'py' which is a SkylarkClassObject in Java and a struct in Skylark. Native python rule and Skylark python rule should have this provider so that they can depend on each other. RELNOTES[NEW]: Native python rule can depend on skylark rule as long as skylark rule provides 'py' provider. -- MOS_MIGRATED_REVID=116241504
* Add imports attribute to Bazel native Python rules to allow adding ↵Gravatar David Chen2016-02-10
| | | | | | | | | | | directories to PYTHONPATH. Fixes #702 RELNOTES: Add imports attribute to native Python rules. -- MOS_MIGRATED_REVID=114314430
* --Gravatar Googler2016-02-04
| | | | MOS_MIGRATED_REVID=113835948
* Change text of python package hyphen errorGravatar Googler2016-02-04
| | | | | | | | This message change is intended to make it clearer that hyphens are not allowed anywhere in the path that forms a Python package name, and there's no way around it, except for moving the Python rules to a different directory. -- MOS_MIGRATED_REVID=113833071
* Use Bazel Preconditions variant which avoids varargs array creationGravatar Mark Schaller2015-12-10
| | | | | | | Reduces garbage. -- MOS_MIGRATED_REVID=109914243
* Un-hardcode the names of some Python implicit attributes ↵Gravatar Carmi Grushko2015-10-27
| | | | | | | ($python_precompile, etc.) -- MOS_MIGRATED_REVID=106352835
* Description redacted.Gravatar Googler2015-10-22
| | | | | -- MOS_MIGRATED_REVID=105975871
* Rationalize copyright headersGravatar Damien Martin-Guillerez2015-09-25
| | | | | | | | | | | The headers were modified with `find . -type f -exec 'sed' '-Ei' 's|Copyright 201([45]) Google|Copyright 201\1 The Bazel Authors|' '{}' ';'` And manual edit for not Google owned copyright. Because of the nature of ijar, I did not modified the header of file owned by Alan Donovan. The list of authors were extracted from the git log. It is missing older Google contributors that can be added on-demand. -- MOS_MIGRATED_REVID=103938715
* Move Label from the lib.syntax to the lib.cmdline package so that:Gravatar Lukacs Berki2015-09-21
| | | | | | | | | | - Label parsing can be simplified - lib.syntax is only contains the code for Skylark and is reasonably independent from the problem domain of building things This change is mostly only changes to imports declarations. The rest is reversing the dependency between :cmdline and :syntax and moving a tiny amount of code between Printer and FilesetEntry and the addition of SkylarkPrintableValue that I couldn't be bothered to separate out into its own change. -- MOS_MIGRATED_REVID=103527877
* Separate build-specific types and types inherent to Skylark.Gravatar Lukacs Berki2015-09-21
| | | | | -- MOS_MIGRATED_REVID=103374106
* Code cleanupGravatar Laurent Le Brun2015-09-03
| | | | | -- MOS_MIGRATED_REVID=102239051
* Add a convenience method to InstrumentedFilesCollector.Gravatar Ulf Adams2015-08-31
| | | | | | | This simplifies the users a bit, and makes it easier to refactor the code. -- MOS_MIGRATED_REVID=101802767
* Enable simple compilation of Python artifacts for py_binary and py_library.Gravatar Googler2015-07-27
| | | | | -- MOS_MIGRATED_REVID=99163140
* Refactoring: PseudoAction ctor "inputs" argument is now a NestedSet.Gravatar Laszlo Csomor2015-06-09
| | | | | -- MOS_MIGRATED_REVID=95514599
* Expose Python provider to SkylarkGravatar Laurent Le Brun2015-06-01
| | | | | | | | It is now possible to access transitive sources from py_binary and py_library rules with target.py.transitive_sources -- MOS_MIGRATED_REVID=94751866
* Initial checkin of Python rules into Bazel.Gravatar Lukacs Berki2015-03-23
-- MOS_MIGRATED_REVID=89123900