我有 5 个构建变体。需要一组给定 Gradle 依赖项的 4 个不同的构建变体(“内部”)和不需要的 1 个构建变体(“外部”)。引用这些依赖项的代码仅在内部构建变体的 /src 文件夹中。
我可以更简洁地声明“除此变体之外的所有”都需要给定的依赖项列表吗?
这就是我们现在处理这个问题的方式app-level build.gradle file
:
internalDevelopmentImplementation(name:'MyGreatDependency-1.1.0', ext:'jar')
internalDevelopmentImplementation(name:"MyGreatDependency-logger-1.1.0", ext:'aar')
internalDevelopmentImplementation(name:"MyGreatDependency-android-2.0.0", ext:'aar')
internalDevelopmentImplementation(name:"MyGreatDependency-extension-android-1.1", ext:'aar')
internalReleaseImplementation(name:'MyGreatDependency-1.1.0', ext:'jar')
internalReleaseImplementation(name:"MyGreatDependency-logger-1.1.0", ext:'aar')
internalReleaseImplementation(name:"MyGreatDependency-android-2.0.0", ext:'aar')
internalReleaseImplementation(name:"MyGreatDependency-extension-android-1.1", ext:'aar')
internalStageImplementation(name:'MyGreatDependency-1.1.0', ext:'jar')
internalStageImplementation(name:"MyGreatDependency-logger-1.1.0", ext:'aar')
internalStageImplementation(name:"MyGreatDependency-android-2.0.0", ext:'aar')
internalStageImplementation(name:"MyGreatDependency-extension-android-1.1", ext:'aar')
internalProdImplementation(name:'MyGreatDependency-1.1.0', ext:'jar')
internalProdImplementation(name:"MyGreatDependency-logger-1.1.0", ext:'aar')
internalProdImplementation(name:"MyGreatDependency-android-2.0.0", ext:'aar')
internalProdImplementation(name:"MyGreatDependency-extension-android-1.1", ext:'aar')
然后,externalProd变体根本不声明依赖项。
有没有办法改善这一点?