简体   繁体   中英

baseline-prof.txt location for each build variant

My app has multiple flavor dimensions and so I want to create baseline-prof.txt for each variant (eg fooBar ). However, when I place the file in /app/src/fooBar it is not picked up during the release build. The only time it is picked up is when placed in /app/src/main (as recommended by the docs).

How can this be configured so I can store different baseline-prof.txt for each variant?

Edited 2023-01-16

Android Gradle Plugin 8.0.0-alpha10 and higher comes with new functionality that allows you to have Baseline Profiles in each build variant.

You can now have the rules in these files:

  • src/main/baseline-prof.txt (as before)
  • src/main/baselineProfiles/*.txt
  • src/[variant]/baselineProfiles/*.txt

You can also have multiple files with generated rules, so for example in addition to the generated rules, you can have couple of manually specified.

There's also option to specify custom folder in build.gradle(.kts) by using (which can be overriden in a buildType or a product flavor)

sourceSets {
  main {
    baselineProfiles.srcDirs("[path to folder]")
  }
}

Original answer

Currently this feature is not supported, the profile is accepted only from src/main/baseline-prof.txt .

As a workaround, theoretically you could hook a Gradle task into the build tasks, which would copy the desired profile into the required location.

We're aware this can be a blocker, so stay tuned for future updates.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM