80 Commits

Author SHA1 Message Date
George Mount
bc81292ae8 Fix license on expression grammar. 2015-03-31 14:13:05 -07:00
George Mount
75aa9bf96f Require only one pass to make BR.java file.
Bug 19985005

Because the generation of Binding files created @Bindable
annotations, the BR file generation had to wait until a
second annotation pass. This caused errors to be generated
that were later cleared, causing confusion. I moved the
BR file generation to the same annotation processing stage
that generates the Binding files to clear up the error
generation.

TODO: merge the annotation processing stages so that there
is less cross-talk between annotation processors.
2015-03-30 12:27:25 -07:00
George Mount
a428ab93ec Address comments on LeakTest. 2015-03-27 16:14:36 -07:00
George Mount
46bb16c303 Make ViewStub support binding variables like include.
Bug 19969378
2015-03-27 16:05:21 -07:00
George Mount
efff1c249e Move to public final fields instead of getters for Views.
Bug 19933644
2015-03-26 16:22:41 -07:00
George Mount
038ad93e7e Don't execute binding when the root view is detached.
Also add tests for memory leaks. The binder should be deleted
when the root view is deleted.

Change-Id: Ifcb24feb80791e64cdfd7203d071d9b1453f6f70
2015-03-26 15:57:23 -07:00
Yigit Boyar
ff5868ed69 Fix integration tests that were broken after package renaming 2015-03-25 12:47:13 -07:00
George Mount
fc195a64c6 Move to package android.databinding. 2015-03-23 16:51:33 -07:00
George Mount
77ab0a0281 Created command line method to be invoked by make.
make needs some means for copying resource files, stripping them,
and generating the intermediate java/xml files. This calls into
the same code used by the gradle plugin to do it. When aapt
work has completed, this can be removed entirely and replaced
by a simple shell script.

Change-Id: Ie6e1fda8fa27892cc74a13f1404ab064f6210270
2015-03-20 11:20:19 -07:00
George Mount
5b9cab18a3 Move common parts of AnnotationAnalyzer methods to ModelAnalyzer.
Bug 19643846
Bug 19627630

Also made it so that setter methods will auto-cast from Object
when necessary. This is useful for heterogenous map objects
where .get(id) may return an Integer or a String or a Drawable.

Change-Id: Iacfd739ea4938f38b584a8eab9193f1fd4071df1
2015-03-19 14:15:36 -07:00
Yigit Boyar
243a1e3e18 Support for multi module setups
This CL adds support for building multi module apps
with proper context.

For library modules, we only generate base classes in the initial
compilation. We also generate a temporary BR file which does
not have final methods.

When final app is being generated, all layout binders, adapters
and Bindable information gets merged and all final classes
are generated in their appropriate packages.

This CL also adds support for Test runs and any
number of build variants.

Bug: 19714904
Change-Id: I9b50b54db05f3fa206eec33709d43c2ac94a9e5e
2015-03-19 12:40:00 -07:00
George Mount
230ecdbf05 Use abstract base class instead of interfaces for Binding objects.
Bug 19627511
Bug 19709604

Changed generated classes to end with "Binding" instead of "Binder"
to avoid confusion with Android Binders.

Removed DataBinder class and moved the important aspects of its
contents to ViewDataBinding.

Improved mapping of Views in included layouts. Avoid traversing
included layouts while looking for bound expressions.

Change-Id: I1f28093b0792d5428d07192f1fc458a5b4b788b2
2015-03-17 18:26:54 -07:00
Yigit Boyar
f5140a1529 Move configuration values into a config file
Change-Id: I7055c109cb04ae2ae375c2126c2a70fa52e85e31
2015-03-13 12:57:48 -07:00
Yigit Boyar
1ec5cb0729 Restructure project for test apps
This CL updates project to use a local maven repo.
(local as in near source code w/ relative path).
This is necessary to have multiple versions of the
project on the same computer also provides better
separation.

I also moved integration tests to depend on these
because we cannot build the compiler and test app at
the same project.

I've changed library plugin's jar to be a separate
upload task to avoid some build issues in TestApp
when we release a @jar and @aar with same group and
artifact ids.

This CL also adds some convenience methods to
gradle build script to run all tests, prepare maven
repo, run integration tests etc. These were needed
to do CI.

Bug: 19718690
Change-Id: I3c80e09fe7c8c2780ca00c3e9b9ba99a162531cf
2015-03-12 19:27:20 -07:00
Michal Bendowski
0710ff5b59 Merge "Add a unit test to the sample project." 2015-03-12 18:30:23 +00:00
Michal Bendowski
dd47168f3d Add a unit test to the sample project. 2015-03-12 09:34:11 -07:00
Yigit Boyar
20af2f0c5a Downgrade to java 1.6
This CL removes java 1.7 code so that we can easily integrate
w/ Idea.

It also partially removes dependency on ModelAnalyzer for
interface generation so that we can call it from the Idea
plugin.

Change-Id: Id7616987f5660911e951ddf20dacd4f407dacbd9
2015-03-12 09:17:11 -07:00
Yigit Boyar
ac5dc9a4e1 Check API version for methods called via binding
In data binding, setting an attribute actually means calling a method, which might be
an issue if the method is added after a certain API.

This CL introduces a change which will check called methods per api and add necessary
API check code to avoid calling those methods in older platforms.

This CL also resurrects the Java Model Analyzer (in testing) and also fixes compiler tests.

Bug: 19593398
Change-Id: I0da4194625231cf43125e1b43338069e7d191eb9
2015-03-11 10:44:08 -07:00
George Mount
eed3f1fee4 Support bracket expressions for SparseArray.
Also support single-quotes for XML attributes.
2015-03-04 16:23:53 -08:00
George Mount
f9c62b6f52 Don't require IDs for most bound views. 2015-03-04 14:12:06 -08:00
Yigit Boyar
10dd0cb6f2 Fix gradle plugin
Change-Id: Iac2ea9ddcbf07bd390945723cb785d77c1efb7d0
2015-03-03 18:38:07 -08:00
George Mount
81536a4da5 Move expression parsing to Annotation Processing stage.
Change-Id: Ibf1e9c02856212c20300f10e4c63b96ec33b7a13
2015-03-02 15:21:18 -08:00
George Mount
2af44f8417 Add fraction resource parameters. 2015-02-23 16:18:38 -08:00
George Mount
9a1918ff96 Add quantity and format string easy formats. 2015-02-23 15:43:53 -08:00
George Mount
25ac81d863 Added support for imports in type checking.
findType did not support user-defined imports, so casting,
for example, of Foo<String> didn't recognize Foo or String.
This also will import java.lang.* by default.
2015-02-20 10:52:20 -08:00
George Mount
980449bc4c Fix broken static import with alias.
Added tests to ensure they don't break again.
2015-02-19 16:43:01 -08:00
George Mount
0e7ca4055e Support static method and field access and improve method finding.
Bug 19425630
Bug 19336295

Change-Id: I4c04db32492edfa093e94c3c15bf7799128b1e03
2015-02-19 07:47:54 -08:00
George Mount
371450b5b1 Support casting operation in binding expressions.
Bug 19272385

Change-Id: I5a992f4eaf6f456d21983481ab4ca01305582f36
2015-02-18 10:44:22 -08:00
George Mount
812d215fa6 Removed reflection-based implementations and renamed classes.
Renamed Model* classes to Annotation*
Renamed Reflection* classes to Model*
Removed Class* classes -- they are no longer needed.

The names were confusing. I think this is better.
2015-02-17 16:15:29 -08:00
George Mount
d872e1cdf7 Move expression generation to annotation processor. 2015-02-17 10:42:10 -08:00
Yigit Boyar
8d2181b44d Allow chef to be created from bundle
Change-Id: If5b00a98684803cdd46547b9a94c961fe0bbf4e3
2015-02-11 15:00:35 -08:00
Yigit Boyar
e5741e49ce Separate resource parser
Change-Id: I3b5f44b48269130834d013425dbaf79fe084c855
2015-02-11 11:26:46 -08:00
George Mount
fbdb3c08f0 Prepare ClassAnalyzer to be replaced by other implementations.
ClassAnalyzer uses normal reflection. We intend to move
to an Annotation Processor and possibly an Android Studio
plugin version of type interaction as well. This abstracts
the type interaction to prepare.

Change-Id: I2b95ea9074bca7e3053aeadcd3692dffe93b41d6
2015-02-11 10:49:11 -08:00
Yigit Boyar
30bc4d25dd Fix how we handle non-bindable fields in Observable objects
Change-Id: Ia33200a2ade3bd3ed8d3a66e1602a04111f4387a
2015-02-10 12:38:33 -08:00
George Mount
b389318b1c Added support for Observable fields.
Added support for ObservableField and it primitive siblings.

Bug 19268016

Change-Id: I28322e5adc44d40013e876271e7d40010c2fe0bb
2015-02-10 09:16:19 -08:00
Yigit Boyar
3d6127246d Check for final observable fields
If a field is final, we know it cannot change thus cannot include it in dependency
logic. Unfortunately, observable final fields can invalidate themselves so
we should consider them dynamic.

Bug: 19299279
Change-Id: I643377f7faea6a7b0e858ee55d22318b3fc5898e
2015-02-06 17:13:26 -08:00
George Mount
af890a6722 Test now really breaks.
Bug 19286803
2015-02-06 15:38:38 -08:00
Yigit Boyar
cf0cf8770c Fixed unit test
Change-Id: Id3f93a76868c74237841f707e82623b24a98a779
2015-02-06 14:43:24 -08:00
George Mount
5184371612 Made new breaking test.
Bug 19286803
2015-02-06 14:08:14 -08:00
Yigit Boyar
e7b298475a added test for binding to a final field
Change-Id: I0945b0128c390cd6f91337359c16fd9d94735550
2015-02-06 13:19:47 -08:00
George Mount
49f8a82653 Made expressions prefix with "@" 2015-02-04 13:15:26 -08:00
George Mount
99dfc75dc4 Added tests for BindingAdapters
Fixed a few small bugs as well.

Change-Id: Ie50afc6be457b293ce69508452bb38ea1ab75b41
2015-02-04 07:27:34 -08:00
Yigit Boyar
6bd7cd429e Support for layout files in multiple resource folders
Multiple layout files with the same name now share a common interface.
They also share all variables no matter where it is defined.
If a variable is NOT used in one of the layout files, its implementation
does not create a field BUT STILL creates the setter (to implement
the base interface).

If the same view id is used for two different types of views, return
type in the interface is android.view.View. If it is an include,
the return value is IViewDataBinder.

Change-Id: Ie3cc2bb8ec5ea48b71337e314ec588a050d714df
2015-02-03 15:54:13 -08:00
Yigit Boyar
8323229b0c Support include tags as inner binders
Change-Id: I2d35c9887678a3547937ad384b9c0dc7603f4f60
2015-01-30 16:58:32 -08:00
George Mount
5d97aa8a87 Made SetterStore serialization upgradable.
Bug 19197607
2015-01-30 12:03:33 -08:00
George Mount
31c37ffe68 Made ProcessBindable read intermediate files from class path.
Bug 19192030
2015-01-29 16:16:31 -08:00
George Mount
e72bfcd968 Added tests for ViewBindingAdapter.
Also fixed:
Bug 19192030
2015-01-29 10:06:23 -08:00
George Mount
8a9d3762ec Add more tests. 2015-01-28 10:58:27 -08:00
George Mount
662d87aa0b Moved classes from library to baseLibrary
Added tests for some classes.
2015-01-27 15:47:05 -08:00
Yigit Boyar
607fb14067 fix genereated code folder
Change-Id: Ic7efa25a60efac547bf7531b4b5aed8634babb95
2015-01-27 14:30:59 -08:00