This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String taskNamePrefix = "transformNativeLibsWithMergeJniLibsFor" | |
if (!task.name.startsWith(taskNamePrefix)) { | |
return | |
} | |
… |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
// Full description will be something like "appname_flavor_buildType" | |
String fullDescription = task.name | |
.substring(taskNamePrefix.size()) | |
.toLowerCase() | |
String taskPath = null | |
android.applicationVariants.all { variant -> | |
if (fullDescription.contains(variant.flavorName.toLowerCase()) | |
&& fullDescription.contains(variant.buildType.name.toLowerCase())) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
if (taskPath != null) { | |
copyNativeLibs(taskPath) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def copyNativeLibs(taskPath) { | |
// The native libraries will be found somewhere under the root directory | |
// defined below. From there, the armeabi sub-directory needs to be found. | |
File rootDir = new File( | |
projectDir, | |
"build/intermediates/transforms/mergeJniLibs/${taskPath}/" | |
) | |
if (!rootDir.isDirectory()) return | |
def srcDir = searchForDirectory("armeabi", rootDir) | |
if (srcDir == null) return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private File searchForDirectory(String name, File currentDirectory) { | |
for (file in currentDirectory.listFiles()) { | |
if (file.isDirectory() && file.name == name) { | |
return file | |
} | |
if (file.isDirectory()) { | |
File result = searchForDirectory(name, file) | |
if (result != null) { | |
return result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sets the supported res configurations. By default resources for all languages, | |
// densities, and screen sizes are included in each build. However, a subset can be | |
// specified (e.g. en,ko). This will speed up build times considerably, but should | |
// only be done for developer builds. | |
ext.supportedResConfigs = project.hasProperty('supportedResConfigs') ? | |
project.getProperty('supportedResConfigs').split(",") : | |
null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Supported res configurations. If left commented, all languages, densities, and sizes | |
# will be included in the build. Uncomment to only include a subset. This should be a | |
# comma delimited list (e.g. supportedResConfigs=en,fr,ko). | |
supportedResConfigs=en |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
apply from: "$rootDir/gradle/buildTasks.gradle" | |
android { | |
// ... | |
defaultConfig { | |
if (project.supportedResConfigs != null) { | |
resConfigs project.supportedResConfigs | |
} | |
// ... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
android { | |
// ... | |
defaultConfig { | |
resConfigs "en" | |
// ... | |
} | |
// ... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
supportedResConfigs=en,notnight,port |
OlderNewer