aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/android/java
Commit message (Collapse)AuthorAge
* In UseBridge.class, check whether the owner of the method call instruction andGravatar cnsun2017-07-24
| | | | | | | | | | the owner of the method reference have assignable relation. If yes, use the bridge method. This CL addresses the integration problem between Desugar and the lambda factory of JDK 9. The change in JDK 9 is here,http://hg.openjdk.java.net/jdk9/dev/jdk/rev/a3b3c7b6464d. RELNOTES: None PiperOrigin-RevId: 162965244
* Stop reporting manifest merge errors as exceptions with stack traces as well ↵Gravatar apell2017-07-24
| | | | | | | as printing the merge error report. The stack traces duplicated the error report and gave the impression that the error may be an internal error instead of a build error. RELNOTES: None. PiperOrigin-RevId: 162755827
* Automated rollback of commit 01ddfb7bf418b371859de62f4eab2f41ea9a4a4a.Gravatar laszlocsomor2017-07-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a partial rollback. I restored the old flags (with PathListConverter), added the new ones, added deprecation warnings and annotations, and added code to concat the values of new and old. Existing released versions of Bazel should keep working with the new code until 2018-01-31, i.e. for the next ~6 months. After that I'll remove the old flags and the PathListConverter. *** Reason for rollback *** Fixed broken integration with release Blaze. *** Original change description *** Automated rollback of commit 5752463ece84ebb4fb074888cba57412ab8d86b3. *** Reason for rollback *** Broke too many targets. *** RELNOTES: none PiperOrigin-RevId: 162587548
* Make the @Option annotation depend on the java version of the tagging enums.Gravatar ccalvarin2017-07-18
| | | | | | | The option filters proto dependency can be removed from the OptionsParser. This is in response to option parser users that want to avoid the bazel-internal proto file in their dependencies. RELNOTES: None. PiperOrigin-RevId: 162249778
* Internal changeGravatar Googler2017-07-17
| | | | PiperOrigin-RevId: 162194755
* AndroidBusyBox: deprecate path-list-type flagsGravatar laszlocsomor2017-07-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit: - deprecates PathListConverter - removes ExistingPathListConverter because it was not used in production, only tests - deprecated List<Path> type flags that use PathListConverter - introduces new List<Path> type flags next to the deprecated ones that use @Options.allowMultiple and convert with PathConverter; the new and old lists are concatenated, yielding the flag value PathListConverter and all of its occurrences should be removed after 2018-01-31 (about 6 months from now, which is a safe enough timeframe for everyone to upgrade Bazel so it uses the new-style flags). Reason for deprecation is that colon-separated path lists don't work on Windows because paths have colons in them. Since the Android BusyBox is not intended to be executed by users but by Bazel only, there's no release notes necessary. See https://github.com/bazelbuild/bazel/issues/3264 RELNOTES: none PiperOrigin-RevId: 162193998
* Add flag to turn Android resource merge conflicts from warnings into errorsGravatar Googler2017-07-14
| | | | | RELNOTES: none PiperOrigin-RevId: 161831232
* Fix bug where merge conflicts for resources defined in XML with equal values ↵Gravatar Googler2017-07-13
| | | | | | | were being falsely logged during build as warnings RELNOTES: none PiperOrigin-RevId: 161723206
* Fold OptionUsageRestrictions into OptionDocumentationCategory and ↵Gravatar ccalvarin2017-07-11
| | | | | | | | | | OptionMetadataTags. These are similar, no need to have both fields. Removing the "DOCUMENTED" default, the absence of UNDOCUMENTED will be used instead. Since requiring a documentation category for undocumented options doesn't make sense, list that as one of the OptionDocumentationCategories, but list HIDDEN and INTERNAL as part of OptionMetadata. These options should list UNDOCUMENTED as their category. PiperOrigin-RevId: 161515674
* AndroidResourceOutputs: fix ZipEntry pathsGravatar Laszlo Csomor2017-07-11
| | | | | | | | | | Make sure that ZipEntry paths always use forward slashes, even on Windows. Also add a test. See https://github.com/bazelbuild/bazel/issues/3264 Change-Id: I4508e46dde49cd44c8e3792017d0d280a51dc565 PiperOrigin-RevId: 161500049
* Android BusyBox: use the JunctionCreatorGravatar Laszlo Csomor2017-07-11
| | | | | | | | | | | | | | | | | | | Use the recently added JunctionCreator class in the Android BusyBox. Query the current OS's name, where the BusyBox process runs (using System.getProperty("os.name")) and instantiate the corresponding JunctionCreator implementation. This allows the BusyBox to work around path length limitations on Windows; see WindowsJunctionCreator. See https://github.com/bazelbuild/bazel/issues/3264 Change-Id: Ifc1a3c86971e64c2f42bcec2988b7e9239a1d29a PiperOrigin-RevId: 161494557
* Windows, Android BusyBox: create JunctionCreatorGravatar Laszlo Csomor2017-07-10
| | | | | | | | | | | Introduce the JunctionCreator classes that the Android BusyBox can use to work around path length limitations on Windows. See https://github.com/bazelbuild/bazel/issues/3264 Change-Id: Ia5ee39f0635dcc2690ffb1755dc56d21e7bc7536 PiperOrigin-RevId: 161378422
* Android: fix path bugs and enable tests on WindowsGravatar Laszlo Csomor2017-07-10
| | | | | | | | | | | | | | Now all tests under //src/test/j/c/g/devtools/build/android/...:* pass on Windows, yay! Also adjust test sizes as advised by Bazel (using --test_verbose_timeout_warnings). See https://github.com/bazelbuild/bazel/issues/3264 Change-Id: I3f1f4978306bdedaf805149295daa413d2248fbb PiperOrigin-RevId: 161373699
* Remove an unused constructorGravatar cushon2017-07-07
| | | | PiperOrigin-RevId: 161125326
* Identify which methods are used in invokedynamic, and only desugar theseGravatar cnsun2017-07-03
| | | | | | | methods. RELNOTES: None PiperOrigin-RevId: 160663025
* Windows, Android: ScopedTemporaryDirectory bugfixGravatar Laszlo Csomor2017-07-03
| | | | | | | | | | | | ScopedTemporaryDirectory now makes all files writable before attempting to delete them. This is important on Windows where readonly files cannot be deleted, the attempt resulting in an exception. See https://github.com/bazelbuild/bazel/issues/3264 Change-Id: If79478a4b419c05d77ce89cc30cb701d42df1b75 PiperOrigin-RevId: 160644599
* Add the rest of the categories transition values to android options.Gravatar ccalvarin2017-06-30
| | | | | | Automated formatting fixes standardize the @Option annotation. PiperOrigin-RevId: 160582653
* Flip the flag --rewrite_calls_to_long_compare to false by default. NowGravatar cnsun2017-06-30
| | | | | | | | desugaring Long.compare(long, long) is only enabled if either --min_sdk_version < 19 or --rewrite_calls_to_long_compare is specified. RELNOTES: set --rewrite_calls_to_long_compare to false by default. PiperOrigin-RevId: 160578028
* Add categories transition values to android options.Gravatar ccalvarin2017-06-30
| | | | | | Automated formatting fixes standardize the @Option annotation. PiperOrigin-RevId: 160567787
* Open source dexer tests.Gravatar ajmichael2017-06-29
| | | | | RELNOTES: None PiperOrigin-RevId: 160461708
* When we access a field of an interface, if the field is of type long or double,Gravatar cnsun2017-06-29
| | | | | | | then we use pop2 to pop the value out of the stack. RELNOTES: None PiperOrigin-RevId: 160453904
* Fix extra bytes and missing resources for roboelectric tests:Gravatar Googler2017-06-29
| | | | | | | | | *) Changed the GenerateRobolectricResourceSymbolsAction to merge duplicate namespaces from the dependency list input. *) RClassGenerator throws if an existing R.class file exists for that package. *) New test for duplicate package dependencies RELNOTES: none PiperOrigin-RevId: 160436937
* Access interface constants to explicitly trigger the execution of interfaceGravatar cnsun2017-06-29
| | | | | | | | | | | | | | | | | | | | | initializers. The problem is that when we desugar default methods, the static intializer of interface will not be executed. The JVM spec says that if an interface has default methods, then when it is loaded, it will also be initialized. After we desugar such an interface, its default methods are removed, and when we load the interface, the <clinit> will not be executed. This CL checks whether an interface has default methods and fields. If yes (needs to be initialized when the interface is loaded), it injects field access code to access the interface fields in the <clinit> of the companion class. We also create a constant $$CONSTANT$$ in the companion class. Then for all the classes that implement the interface, we inject GETSTATIC in the class <clinit> to the $$CONSTANT$$ of the companion class of the interface. This indirection is to avoid the IllegalAccessError when the interface is package private. Note that accessing an arbitrary interface field does not guarantee the interface will be initialized. We need to access the field that is initialized in the interface static initializer. RELNOTES: None PiperOrigin-RevId: 160414671
* Add the default category and tag to all options.Gravatar ccalvarin2017-06-28
| | | | | | | | Move the default from the annotation to every mention. This makes the incompleteness explicit. Will add the defaults to test targets in a separate change. Once all dependencies are cleaned up, the Option annotation will no longer allow options without the documentationCategory or effectTag, to prevent new options being added without categories while we migrate to the new option categorization. PiperOrigin-RevId: 160281252
* Make it an error to pass --multidex=off with --main-dex-list orGravatar ajmichael2017-06-26
| | | | | | | | | | | --minimal-main-dex. This matches dx's behavior. Previously, DexFileMerger would override --multidex=off with --multidex=minimal if either --main-dex-list or --minimal-main-dex were passed. RELNOTES: Incremental dexing errors on combination of --multidex=off and either --main-dex-list or --minimal-main-dex. PiperOrigin-RevId: 159858242
* Automated rollback of commit 317e0de2113f0361c9dbf98653ceda4efea3f3e2.Gravatar Googler2017-06-20
| | | | | | | | | | | | | | | | | | | | | *** Original change description *** Access interface constants to explicitly trigger the execution of interface initializers. The problem is that when we desugar default methods, the static intializer of interface will not be executed. The JVM spec says that if an interface has default methods, then when it is loaded, it will also be initialized. After we desugar such an interface, its default methods are removed, and when we load the interface, the <clinit> will not be executed. This CL checks whether an interface has default me... *** ROLLBACK_OF=159496992 NO_SQ=PURE_ROLLBACK RELNOTES: None PiperOrigin-RevId: 159545752
* Access interface constants to explicitly trigger the execution of interfaceGravatar cnsun2017-06-20
| | | | | | | | | | | | | | | | | | | | | initializers. The problem is that when we desugar default methods, the static intializer of interface will not be executed. The JVM spec says that if an interface has default methods, then when it is loaded, it will also be initialized. After we desugar such an interface, its default methods are removed, and when we load the interface, the <clinit> will not be executed. This CL checks whether an interface has default methods and fields. If yes (needs to be initialized when the interface is loaded), it injects field access code to access the interface fields in the <clinit> of the companion class. We also create a constant $$CONSTANT$$ in the companion class. Then for all the classes that implement the interface, we inject GETSTATIC in the class <clinit> to the $$CONSTANT$$ of the companion class of the interface. This indirection is to avoid the IllegalAccessError when the interface is package private. Note that accessing an arbitrary interface field does not guarantee the interface will be initialized. We need to access the field that is initialized in the interface static initializer. RELNOTES: None PiperOrigin-RevId: 159496992
* Roll forward R generation for Robolectric behind a flag to enable testingGravatar Googler2017-06-19
| | | | | RELNOTES: none PiperOrigin-RevId: 159263527
* Automated g4 rollback of commit 5c2dc673a3ad2aa52f25c6f7d767671ba3e9b02c.Gravatar corysmith2017-06-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Appears that the generated R classes are not correct, causing test failures. *** Original change description *** Automated g4 rollback of commit 1be84ee92a825694b0c0026ac77134f8a084bd9c. *** Reason for rollback *** Rolling forward with the generated resources directory being created for tests without resources. *** Original change description *** Automated g4 rollback of commit d028d7854d3e95d97143945a1ec32944e5e4594b. *** Reason for rollback *** Breaks 1000+ targets in the depot: [] *** Original change description *** Generate pre-reconciled ids R classes for dependen... *** RELNOTES: None PiperOrigin-RevId: 159032530
* Automated g4 rollback of commit 1be84ee92a825694b0c0026ac77134f8a084bd9c.Gravatar corysmith2017-06-13
| | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Rolling forward with the generated resources directory being created for tests without resources. *** Original change description *** Automated g4 rollback of commit d028d7854d3e95d97143945a1ec32944e5e4594b. *** Reason for rollback *** Breaks 1000+ targets in the depot: [] *** Original change description *** Generate pre-reconciled ids R classes for dependency libraries with resources in the transitive closure of robolectric tests. RELNOTES: None PiperOrigin-RevId: 158756991
* Extract FieldInfo as a top-level class. In the following CL, I will use thisGravatar cnsun2017-06-12
| | | | | | | class in DefaultMethodClassFixer to fix the bug b/38255926 RELNOTES: n/a PiperOrigin-RevId: 158561127
* Erase <clinit> of interfaces to prevent <clinit> from execution during desugar.Gravatar cnsun2017-06-08
| | | | | | | For all declared non-premitive fields, this CL sets each one to null. RELNOTES: n/na PiperOrigin-RevId: 158305638
* Move bridge methods for default methods down to the implementing classes.Gravatar cnsun2017-06-07
| | | | | RELNOTES: n/na PiperOrigin-RevId: 158162658
* Automated g4 rollback of commit d028d7854d3e95d97143945a1ec32944e5e4594b.Gravatar lpino2017-06-07
| | | | | | | | | | | | | | *** Reason for rollback *** Breaks 1000+ targets in the depot: [] *** Original change description *** Generate pre-reconciled ids R classes for dependency libraries with resources in the transitive closure of robolectric tests. RELNOTES: None PiperOrigin-RevId: 158159550
* Improve the error message when Desugar fails to load a class from theGravatar cnsun2017-06-05
| | | | | | | classpath. Now it prints the name of the class that is under desugaring. RELNOTES: n/a PiperOrigin-RevId: 157889131
* Generate pre-reconciled ids R classes for dependency libraries with resourcesGravatar corysmith2017-06-02
| | | | | | | in the transitive closure of robolectric tests. RELNOTES: None PiperOrigin-RevId: 157762190
* Enable desugaring try-with-resources by default.Gravatar cnsun2017-05-31
| | | | | RELNOTES: none PiperOrigin-RevId: 157490771
* For static interface method, when we move it to the companion class,Gravatar cnsun2017-05-26
| | | | | | | | append a suffix to the method name, so as to avoid name clash in the companion class. RELNOTES: n/a PiperOrigin-RevId: 157021961
* Fix bug with combining resource attributes. Attributes were reporting that ↵Gravatar apell2017-05-26
| | | | | | | they were over-writable in all cases instead of differentiating by attribute type. RELNOTES: None. PiperOrigin-RevId: 156999284
* Add a new action for generating reconciled R classes for Robolectric.Gravatar corysmith2017-05-23
| | | | | | | | | This includes some refactoring: * Move the symbol deserialization our of the merger and into the ParsedAndroidData (probably move again.) * Change the FailedFutureAggregator generics to work more callables RELNOTES: None PiperOrigin-RevId: 156863698
* Make Desugar work for relative dumpDirectory paths.Gravatar Googler2017-05-23
| | | | | | | | | | | | | Before CL 155913466, Desugar was not working when dumpDirectory was a relative path because of an extra/incorrect resolve() that ended up duplicating such a relative path. CL 155913466 fixed this by converting Desugar's dumpDirectory to an absolute path. However, CL 156257767 introduced a check that Desugar's dumpDirectory must match the one in Java's InnerClassLambdaMetafactory, which broke the case of a relative path again. Therefore, this CL undoes the conversion to absolute path again (so that Desugar's path matches that in InnerClassLambdaMetafactory). Instead, to make relative paths work, it drops the unnecessary/incorrect call to resolve(). A regression test is left for a future CL (I don't have a dev environment set up that would allow me to easily write one). RELNOTES: None. PiperOrigin-RevId: 156852882
* Make checking of lambda dump directory accept relative path.Gravatar cnsun2017-05-23
| | | | | | | | | | | | | | Before, we use Path.equals(Object), which will fail if we use relative path in the system property. Now I use Files.isSameFile which will check two paths point to the same file system resource. In https://github.com/bazelbuild/bazel/commit/69e855c7b0f0f7899a69a882cba0abd304233c97, I introduce the check to test whether setting the system property for lambda meta factory succeeds. However, the check does not consider relative path, which will always fail. RELNOTES: n/a PiperOrigin-RevId: 156796457
* Move the field name out of the FieldInitializerGravatar corysmith2017-05-23
| | | | | RELNOTES: None PiperOrigin-RevId: 156747534
* Keep annotations of default methods in interfaces during desugaring.Gravatar cnsun2017-05-22
| | | | | RELNOTES: n/a PiperOrigin-RevId: 156582965
* Remove the RTxtSymbolEntry in favor of the FieldInitializer class.Gravatar corysmith2017-05-19
| | | | | RELNOTES: None PiperOrigin-RevId: 156321468
* Improve diagnostics. Report an error when we fail to register the lambda dumpGravatar cnsun2017-05-17
| | | | | | | | | | directory. This is achieved by checking InnerClassLambdaMetafactory.dumper's dumpDir. Also, if a user provides a dump folder, we verify whether the folder is empty. RELNOTES: n/a PiperOrigin-RevId: 156257767
* Use one writer for generating R.java source filesGravatar corysmith2017-05-17
| | | | | RELNOTES: None PiperOrigin-RevId: 156205544
* Refine assertion by providing more information. When the given path is NOT aGravatar cnsun2017-05-17
| | | | | | | directory, output its path. RELNOTES: n/a PiperOrigin-RevId: 156187835
* Further Refactoring/Yak ShavingGravatar corysmith2017-05-15
| | | | | | | | | * Extract the FieldInitializer with placeholder ids from the AndroidResourceClassWriter * Extract a resource sink interface from the AndroidResourceClassWriter (a little renaming, the change isn't actually that big.) RELNOTES: None PiperOrigin-RevId: 156053478
* Fix Desugar duplicating path for dumped classes.Gravatar Googler2017-05-15
| | | | | | | | | When dumpDirectory (jdk.internal.lambda.dumpProxyClasses) is a relative path, Desugar was duplicating that path because it was resolving lambdaClass.getKey() (which contained already the the dumpDirectory path). Fixed by ensuring dumpDirectory is always an absolute path. RELNOTES: n/a PiperOrigin-RevId: 155913466