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

add support to other build types than only debug and release #274

Open
kibotu opened this issue Oct 13, 2022 · 5 comments · May be fixed by #291
Open

add support to other build types than only debug and release #274

kibotu opened this issue Oct 13, 2022 · 5 comments · May be fixed by #291
Labels
bug Something isn't working

Comments

@kibotu
Copy link

kibotu commented Oct 13, 2022

Currently only debug and release build types are supported

imagine having a setup with build types

android {

    buildTypes {

        alpha {
            initWith(buildTypes.debug)
        }

        release {
        }

        beta {
            initWith(buildTypes.release)
        }
    }

    dependencies {
        alphaImplementation "com.airbnb.android:showkase:1.0.0-beta14"
        kaptAlpha "com.airbnb.android:showkase-processor:1.0.0-beta14"
    }
}

then the dependencies won't be available in alpha builds because the way it is published to maven central

https://repo1.maven.org/maven2/com/airbnb/android/showkase/1.0.0-beta14/

compared to e.g. leakcanary

https://repo1.maven.org/maven2/com/squareup/leakcanary/leakcanary-android/2.9.1/

the problem lies with the file naming

where instead of having one artifact, the showkase library has 2: one for debug and one for release, which is not a bad idea if you want automatic switching with just adding implementation instead of having to add debugImplementation and releaseImplementation

however I'm not aware of a way to have those files added for alpha/beta/release or any other non default build type now


for this to work we would have to have two different artifacts, e.g. one for

    com.airbnb.android:showkase:1.0.0-beta14 
    com.airbnb.android:showkase-no-op:1.0.0-beta14 // e.g. for release 
@kibotu
Copy link
Author

kibotu commented Oct 14, 2022

ok turns out there is a workaround

android {

    buildTypes {

        alpha {
            matchingFallbacks = ['debug']
        }
    }
}
            

@popovanton0
Copy link

I also encountered this problem, spent a whole day on it, and even wrote a Medium article about solving it.

TLDR; As it turns out, if you have a project like this:

graph LR
  B(base-ui) --> D("design-system<br>(with showkase)")
  A(app) --> A1(feature-module) --> B
  A1 --> D
Loading

you need (not entirely sure why) to specify matchingFallbacks in all build.gradle files. I did this using a root file that applies to all modules the project.

Unfortunately, I haven’t realized that need in time and wrote almost a Gradle plugin to modify dependency metadata.

Why the library has multiple versions (debug and release)? Is it necessary? If not, it will be mush easier for developers if the library had only one version, like the aforementioned LeakCanary.

@vinaygaba
Copy link
Collaborator

Thanks, I do see the problem and I don't think it's intended to be like this. I think having a single artifact makes sense to me. I can fix this in the next release.

@vinaygaba
Copy link
Collaborator

@popovanton0 also, thank you for the write up and documenting a way to unblock people until the fix is merged

@vinaygaba
Copy link
Collaborator

vinaygaba commented Dec 20, 2022

Published a PR to fix this - #291
Not 100% sure I have the right fix so if either of you have thoughts, please chime in on the PR @kibotu @popovanton0

@vinaygaba vinaygaba added the bug Something isn't working label Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants