Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dependOnAssemble = true builds all variants #233

Closed
AndrewReitz opened this issue Mar 23, 2021 · 11 comments · Fixed by #235 or #243
Closed

dependOnAssemble = true builds all variants #233

AndrewReitz opened this issue Mar 23, 2021 · 11 comments · Fixed by #235 or #243

Comments

@AndrewReitz
Copy link
Contributor

dependOnAssemble = true builds all variants of an application rather than just the one flank needs to run the tests.

This appears to be related to #60, if fladle doesn't know what variant apks it needs, it makes sense that it wouldn't know which to build.

@runningcode
Copy link
Owner

@runningcode
Copy link
Owner

@AndrewReitz do you have a build scan that demonstrates this? If not can you name the flank task as well as the dependent assemble tasks that are being run? Do you have multiple flavors configured? Do you run a single instrumentation test task against multiple flavors?

I added a simple test case for this. https://github.com/runningcode/fladle/pull/234/files#diff-fae81d6619b0f02b12c40c2f9c567d2dd485e2c6c5bf8c2d072626cad86f3285R183

@runningcode
Copy link
Owner

I created #235 to use the extension's variant to determine which variant to depend on. Does this help?

@AndrewReitz
Copy link
Contributor Author

@runningcode the tests look like I'm looking for trying out the snapshot now!
Thanks

@runningcode
Copy link
Owner

Thanks for testing. Please report back. I think I missed a test case (when no flavors are declared) so I will write this test case and make sure it works before releasing.

@AndrewReitz
Copy link
Contributor Author

I'm trying to run it but the snapshot seems to have issues authenticating against FTL.

I am getting

{
  "code": 403,
  "errors": [
    {
      "domain": "global",
      "message": "The caller does not have permission",
      "reason": "forbidden"
    }
  ],
  "message": "The caller does not have permission",
  "status": "PERMISSION_DENIED"
}

I ran flankAuth just to be sure, but no luck. Switching back to 15.0.0 and it's fine.
Is there something I should do differently or is there an issue with the SNAPSHOT?

I can get you the logs and output of stacktrace if that would be helpful.

@runningcode
Copy link
Owner

runningcode commented Mar 24, 2021

This seems to be an issue with the latest version of flank. Thanks for reporting. Can you set flankVersion = '21.01.1'? That's what 15.0.0 is using.

@AndrewReitz
Copy link
Contributor Author

@runningcode this works as in it only builds one APK, but it's the last one that was set with variant.set.
We have multiple configurations for running different apks or different flavors, as well as different sets of tests.
So it seems #60 is the issue we are running into now. Let me know if I can help out in anyway.

@runningcode
Copy link
Owner

Thanks for testing @AndrewReitz can you give an example of your flavors and the fladle config and what dependencies you would expect to happen?

@AndrewReitz
Copy link
Contributor Author

AndrewReitz commented Mar 26, 2021

Here's an example of how things are setup. Left out a lot and just trying to highlight the issue. So in the case below if I don't specifically set the apks for any of the product flavors the bBetaDebug apk will be used for all the different configs. If I set the apk explicitly it will be used for the tests but dependsOnAssemble will only build bBetaDebug. I can write a test case to show the error in fladle if that would help out.

 flavorDimensions "market", "mode"

  productFlavors {
    standard {
        dimension "mode"
    }
    beta {
        dimension "mode"
    }

    a {
        dimension "market"
    }
    b {
        dimension "market"
    }
    c {
        dimension "market"
    }
}

fladle {
    configs {
        standard {
            variant.set('aStandardDebug')
        }
        standardPr {
            variant.set('aStandardDebug')
            // only run subset of tests
        }
        standardDaggerReflect {
            variant.set('aStandardDebug')
        }
        regression {
            variant.set('aStandardDebug')
            testTargets.set(['annotation com.example.regression.Regression'])
        }
        beta {
            variant.set('bBetaDebug')
        }
    }
}

@runningcode runningcode reopened this Mar 26, 2021
@runningcode
Copy link
Owner

Thanks for the clear example. The API was originally only designed to handle one variant. I did not imagine such a use case. The API needs to be changed. Will take a look at this soon hopefully.

runningcode added a commit that referenced this issue Apr 2, 2021
Fixes #233

First stab at #60 but does not fix it since it is impossible to know whether or not the root is configured already.
runningcode added a commit that referenced this issue Apr 5, 2021
Fixes #233

First stab at #60 but does not fix it since it is impossible to know whether or not the root is configured already.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants