1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-03 03:30:06 +00:00

Projucer: Use more modern alternative to variantFilter in build.gradle

This commit is contained in:
reuk 2026-01-30 14:18:29 +00:00
parent 3904381e7d
commit 537f0a740a
No known key found for this signature in database
5 changed files with 35 additions and 48 deletions

View file

@ -77,16 +77,12 @@ android {
}
}
variantFilter { variant ->
def names = variant.flavors*.name
if (names.contains ("debug_")
&& variant.buildType.name != "debug") {
setIgnore(true)
}
if (names.contains ("release_")
&& variant.buildType.name != "release") {
setIgnore(true)
}
androidComponents {
beforeVariants(selector().all(), { variant ->
variant.enabled = false
variant.enabled |= variant.productFlavors*.second.contains ("debug_") && variant.buildType == "debug"
variant.enabled |= variant.productFlavors*.second.contains ("release_") && variant.buildType == "release"
})
}
sourceSets {

View file

@ -77,16 +77,12 @@ android {
}
}
variantFilter { variant ->
def names = variant.flavors*.name
if (names.contains ("debug_")
&& variant.buildType.name != "debug") {
setIgnore(true)
}
if (names.contains ("release_")
&& variant.buildType.name != "release") {
setIgnore(true)
}
androidComponents {
beforeVariants(selector().all(), { variant ->
variant.enabled = false
variant.enabled |= variant.productFlavors*.second.contains ("debug_") && variant.buildType == "debug"
variant.enabled |= variant.productFlavors*.second.contains ("release_") && variant.buildType == "release"
})
}
sourceSets {

View file

@ -77,16 +77,12 @@ android {
}
}
variantFilter { variant ->
def names = variant.flavors*.name
if (names.contains ("debug_")
&& variant.buildType.name != "debug") {
setIgnore(true)
}
if (names.contains ("release_")
&& variant.buildType.name != "release") {
setIgnore(true)
}
androidComponents {
beforeVariants(selector().all(), { variant ->
variant.enabled = false
variant.enabled |= variant.productFlavors*.second.contains ("debug_") && variant.buildType == "debug"
variant.enabled |= variant.productFlavors*.second.contains ("release_") && variant.buildType == "release"
})
}
sourceSets {

View file

@ -77,16 +77,12 @@ android {
}
}
variantFilter { variant ->
def names = variant.flavors*.name
if (names.contains ("debug_")
&& variant.buildType.name != "debug") {
setIgnore(true)
}
if (names.contains ("release_")
&& variant.buildType.name != "release") {
setIgnore(true)
}
androidComponents {
beforeVariants(selector().all(), { variant ->
variant.enabled = false
variant.enabled |= variant.productFlavors*.second.contains ("debug_") && variant.buildType == "debug"
variant.enabled |= variant.productFlavors*.second.contains ("release_") && variant.buildType == "release"
})
}
sourceSets {

View file

@ -858,20 +858,23 @@ private:
MemoryOutputStream mo;
mo.setNewLineString (getNewLineString());
mo << " variantFilter { variant ->" << newLine;
mo << " def names = variant.flavors*.name" << newLine;
mo << " androidComponents {" << newLine
<< " beforeVariants(selector().all(), { variant ->" << newLine
<< " variant.enabled = false" << newLine;
for (ConstConfigIterator config (*this); config.next();)
{
auto& cfg = dynamic_cast<const AndroidBuildConfiguration&> (*config);
mo << " if (names.contains (\"" << cfg.getProductFlavourNameIdentifier() << "\")" << newLine;
mo << " && variant.buildType.name != \"" << (cfg.isDebug() ? "debug" : "release") << "\") {" << newLine;
mo << " setIgnore(true)" << newLine;
mo << " }" << newLine;
mo << " variant.enabled |= variant.productFlavors*.second.contains (\""
<< cfg.getProductFlavourNameIdentifier()
<< "\") && variant.buildType == \""
<< (cfg.isDebug() ? "debug" : "release")
<< '"'
<< newLine;
}
mo << " }" << newLine;
mo << " })" << newLine
<< " }" << newLine;
return mo.toString();
}