在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):spotify/ruler开源软件地址(OpenSource Url):https://github.com/spotify/ruler开源编程语言(OpenSource Language):Kotlin 98.7%开源软件介绍(OpenSource Introduction):Ruler is a Gradle plugin which helps you analyze the size of your Android apps. MotivationApp size is an important metric which directly correlates with business metrics like install conversion rate. Measuring app size is straightforward, but knowing what contributes to it is not. Especially in bigger projects with hundreds or thousands of modules and third-party dependencies. Ruler provides a convenient way to find out how much each module and dependency contributes to the total size of your app by running a single Gradle task. UsageFollow the following steps to start using Ruler in your project. Adding the pluginFirst you need to add the Ruler Gradle plugin to the buildscript classpath in your top-level buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.spotify.ruler:ruler-gradle-plugin:1.2.1")
}
} You also have to apply the plugin in the plugins {
id("com.android.application")
id("com.spotify.ruler")
} Configuring the pluginWhen using app bundles, Google Play will generate optimized APKs for each device. This means that the size of an APK depends on the specifications of the device that's downloading it. You can configure which device specifications should be used for the analysis in the ruler {
abi.set("arm64-v8a")
locale.set("en")
screenDensity.set(480)
sdkVersion.set(27)
} Running the taskOnce this is done, OwnershipIn larger organizations, Gradle modules and dependencies are often owned by specific teams. If that's the case for your app, Ruler can help you analyze app size contributions by different teams. All you need to do is provide a YAML file listing all components and their owners. It's also possible to specify ownership for individual files, if some of the files within a component are owned by a different team: # Identifier for Gradle modules -> path of the module
- identifier: :sample:app
owner: app-team
# Identifier for dependencies -> dependency shorthand without the version
- identifier: androidx.core:core
owner: core-team
# Identifier for individual files -> Full path/name as it shows up in the APK
- identifier: com.sample.MainActivity
owner: main-team
# Wildcard identifier -> matches multiple components (modules or dependencies) or files
- identifier: :sample:wildcard:*
owner: wildcard-team This ownership file can be maintained manually, but in most cases it will be more practical to generate it during the build. You can point Ruler to your YAML file in the ruler {
ownershipFile.set(project.file("/path/to/ownership.yaml"))
defaultOwner.set("default-team") // unknown by default
} When you pass an ownership file to Ruler, you'll see a new tab in the HTML report with app size insights broken down by team: Project structureRuler is built with Kotlin and contains multiple modules:
Working with this projectThe project is set up like a standard Gradle project. You can build it using There is also a sample project, which shows the usage of the plugin. Because the way this sample project is set up, the initial build can fail if you bump the plugin version. To fix this, you have to publish the plugin to your local Maven repository by running When working on the frontend, you can start a development server by running CompatibilityThe latest version of this plugin is compatible with
Earlier versions might also work, but compatibility can't be guaranteed. Code of conductThis project adheres to the Open Code of Conduct. By participating, you are expected to honor this code. License
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论