Jul 11 | 7:25 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Jul 11 | 7:30 PM |
Erik | has entered the room |
Mark M. |
hello, Erik!
|
Mark M. |
how can I help you today?
|
Erik |
hi mark!
|
Erik |
how do I exclude a subdirectory in a gradle task?
|
Mark M. |
a subdirectory of what?
|
Mark M. |
source? resources? assets? something else?
|
Erik |
I have 2 flavors, free and paid. tests for the paid flavor reside in 'src/testPaid'. When I run the gradle wrapper compileFreeDebugUnitTestKotlin fails because it tries to run tests in src/testPaid
|
Benny | has entered the room |
Benny |
Hello everyone
|
Erik |
hello benny
|
Mark M. |
(hello, Benny -- I will be with you shortly!)
|
Mark M. |
compileFreeDebugUnitTestKotlin should not be running any tests, as it is just a compile task
|
Jul 11 | 7:35 PM |
Erik |
it fails to compile the test because it does not recognize classes exclusive to the other flavor
|
Mark M. |
OK, that part is not surprising
|
Mark M. |
if you run app code, tests don't need to successfully
|
Mark M. |
er, successfully compile
|
Mark M. |
once you start running tests, they all need to compile, IIRC
|
Mark M. |
so, why do the src/testPaid tests not compile?
|
Erik |
those compile in the other flavor
|
Mark M. |
I don't think they do
|
Erik |
let me try
|
Mark M. |
are you sure?
|
Mark M. |
let me take a question from Benny while you test your tests :-) -- I will be back with you in a little bit
|
Mark M. |
Benny: your turn! how can I help you today?
|
Benny |
I have a little problem with AutoCompleteTextView and the SimpleAdapter
|
Jul 11 | 7:40 PM |
Benny |
in the list given to the Adapter i have some names with firstname and lastname, but after I enter a space it will stop filtering
|
Benny |
Is there any other solution than make a own Adapter?
|
Mark M. |
you could try ArrayAdapter instead of SimpleAdapter and see if that helps, I suppose
|
Mark M. |
I have not used AutoCompleteTextView much, and I think I only used it with ArrayAdapter
|
Benny |
ok, I will try this, thank you
|
Erik |
./gradlew compilePaidDebugUnitTestKotlin completes successfully. ./gradlew compileFreeDebugUnitTestKotlin does not because it is still trying to compile the tests in src/testPaid.
|
Mark M. |
what sort of compile errors are you getting?
|
Erik |
it does not recognize classes the test is using
|
Jul 11 | 7:45 PM |
Erik |
I dont even want it compiling those tests if im on that flavor.
|
Mark M. |
do you have a sourceSets closure in your build.gradle file for this module?
|
Erik |
yes
|
Erik |
heree is what i tried so far
|
Mark M. |
perhaps there is something in sourceSets that is convincing the free flavor to include the paid flavor's tests
|
Mark M. |
can you post the sourceSets closure here?
|
Erik |
View paste
|
Jul 11 | 7:50 PM |
Mark M. |
test.java.srcDirs += 'src/test/kotlin' does not look right -- shouldn't that be src/testFree/kotlin?
|
Mark M. |
sorry, I am referring to the version of that line in the free {} closure
|
Mark M. |
basically, I am wondering why your free and paid closures do not match, other than replacing "free" with "paid"
|
Erik |
i dont have a testFree dir because i want to run the main tests. the paid flavor should run the main tests and the tests in testPaid, free should only run the tests in src/test
|
Mark M. |
try commenting out the test.java.srcDirs += 'src/test/kotlin' line in your free closure, and see if your tests work
|
Mark M. |
we can deal with figuring out how to get it to run other tests later -- right now, let's get a stable run of the free tests
|
Mark M. |
in the meantime... Benny, do you have another question?
|
Benny |
yes, but it is not direclty about android but about MVVM on android
|
Jul 11 | 7:55 PM |
Mark M. |
I am not a GUI architecture expert, though I can try to help
|
Benny |
where would you recommend to put the business-logic in mvvm?
|
Mark M. |
how are you defining "business logic"?
|
Mark M. |
if you mean how business data gets displayed, that's some mix of the viewmodel and perhaps a presenter
|
Benny |
like check the data from the server
|
Mark M. |
depending on what you are checking, and what overall structure you have for your app, that might be in a repository or a use-case
|
Mark M. |
I don't get into the use-case pattern in my books, as that tends to be for really big apps, though I am sure that it has been written about elsewhere
|
Benny |
okay, thank you very much :)
|
Jul 11 | 8:00 PM |
Mark M. |
Erik: after commenting out that line, my hope is that either your desired tests run, or zero tests run, and that we get past the testPaid compile problem -- what are you seeing?
|
Erik |
it still fails. the build variants related to the paid product flavor all compile OK
|
Erik |
compileFreeDebugUnitTestKotlin and compileFreeReleaseUnitTestKotlin fail
|
Mark M. |
and they are still failing on trying to compile the paid tests?
|
Erik |
rather they fail to build because like you mention this is a compile task, not a test task
|
Erik |
no they never failed to compile the paid tests
|
Mark M. |
um, I thought that was the original probelm
|
Mark M. |
er, problem
|
Mark M. |
" ./gradlew compilePaidDebugUnitTestKotlin completes successfully. ./gradlew compileFreeDebugUnitTestKotlin does not because it is still trying to compile the tests in src/testPaid."
|
Erik |
yes
|
Erik |
that still happens
|
Mark M. |
OK, that's what I was trying to confirm
|
Mark M. |
I have no idea why that task is pulling in your src/testPaid source
|
Erik |
so anything related to Paid builds. anything related to free does not build.
|
Mark M. |
my best guess is that it is something tied to your sourceSets closure, as that is what tells Gradle what source to pull in
|
Erik |
I tried exclude */testPaid/** and that didnt work either
|
Jul 11 | 8:05 PM |
Mark M. |
in times like this, I usually set up a scrap project and start slowly trying to mirror the real project's setup, until the problem appears in the scrap project
|
Benny |
I have to leave, thank you very much for your help
|
Mark M. |
Benny: have a pleasant day!
|
Mark M. |
Erik: I only know the bits and pieces of your project that you have written here in the chat, so I cannot give you precise details of how to run that sort of experiment
|
Benny |
you too, good bye
|
Benny | has left the room |
Mark M. |
if we focus solely on the free/paid flavors, I would create a project that had free/paid flavors, without sourceSets, and see if the tests build and run
|
Mark M. |
then, I would slowly start trying to set up those kotlin/ directories and adding them, one at a time, until the tests stop building and exhibit the same problem that you are seeing
|
Mark M. |
product flavors and tests definitely work
|
Mark M. |
so my guess is that the scrap project will work at the outset, then start failing during some part of altering the sourceSets
|
Jul 11 | 8:10 PM |
Erik |
ok. is the dot notation the same as brackets? ie test.java.srcDirs is equivalent to test { java { srcDirs } }?
|
Mark M. |
yes
|
Mark M. |
at least, it is supposed to be
|
Erik |
thanks
|
Erik |
what do you think about gradle as a build system>
|
Mark M. |
it is better than Ant :-)
|
Mark M. |
I have not used Maven, Buck, or other up-to-date Android alternatives, and so I cannot draw comparisons
|
Erik |
I find it convoluted and easy to make mistakes
|
Mark M. |
some of that is tied to the use of Groovy
|
Mark M. |
that's the language that we normally build Gradle scripts in
|
Erik |
not groovy baby ;)
|
Mark M. |
there is Kotlin support now
|
Mark M. |
I have not tried it yet
|
Mark M. |
but it should offer greater type safety
|
Mark M. |
making it a bit less likely for us to screw things up
|
Erik |
ok thanks
|
Mark M. |
but, I agree: it is a bit too easy to make mistakes in a Gradle script, and the build process is too opaque to really understand where the mistake comes from
|
Mark M. |
for example, it would be great if we had a way of asking Gradle, "why are you trying to use src/testPaid in this task?"
|
Mark M. |
as that should quickly get you to the source of your difficulty
|
Mark M. |
if Gradle has a way of doing that, I am not aware of it
|
Erik |
there isnt a language i know of that can do that
|
Erik |
maybe HAL-2000
|
Jul 11 | 8:15 PM |
Mark M. |
well, by "ask", I more meant "have a debug mode where we can see all the inputs to the various tasks and plugins as they are being performed"
|
Erik |
ic
|
Mark M. |
from there, "ask" turns into grep and similar tools, looking for src/testPaid/ and trying to see where it is starting to show up unexpectedly
|
Erik |
like the source behind the compile task?
|
Mark M. |
right -- we need to figure out where the compile task is getting its list of source directories from
|
Mark M. |
as it is clearly confused
|
Mark M. |
it's possible there is some combination of Gradle flags that you can use that would give you that output, but I do not know what they are
|
Jul 11 | 8:20 PM |
Mark M. |
do you have any other questions?
|
Jul 11 | 8:30 PM |
Erik | has left the room |
Mark M. | turned off guest access |