Skip to content

Commit

Permalink
Fix no-opt build option for materials (#6756)
Browse files Browse the repository at this point in the history
- `-g` option was missing from `build.sh`
- `-Pcom.google.android.filament.matnopt` should be passed to
   the sample apps as well.
- Add logic to respect `-Pcom.google.android.filament.matnopt`
   in `FilamentPlugin.groovy`
  • Loading branch information
poweifeng committed Apr 24, 2023
1 parent bd9ba11 commit b748ea7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions android/buildSrc/src/main/groovy/FilamentPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ abstract class MaterialCompiler extends TaskWithBinary {
if (!exclude_vulkan) {
matcArgs += ['-a', 'vulkan']
}

def mat_no_opt = providers
.gradleProperty("com.google.android.filament.matnopt")
.forUseAtConfigurationTime().present
if (mat_no_opt) {
matcArgs += ['-g']
}

matcArgs += ['-a', 'opengl', '-p', 'mobile', '-o', getOutputFile(file), file]

exec.exec {
Expand Down
4 changes: 3 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ function build_android {
./gradlew \
-Pcom.google.android.filament.dist-dir=../out/android-debug/filament \
-Pcom.google.android.filament.abis=${ABI_GRADLE_OPTION} \
${MATOPT_GRADLE_OPTION} \
:samples:${sample}:assembleDebug
done
fi
Expand Down Expand Up @@ -539,6 +540,7 @@ function build_android {
./gradlew \
-Pcom.google.android.filament.dist-dir=../out/android-release/filament \
-Pcom.google.android.filament.abis=${ABI_GRADLE_OPTION} \
${MATOPT_GRADLE_OPTION} \
:samples:${sample}:assembleRelease
done
fi
Expand Down Expand Up @@ -756,7 +758,7 @@ function run_tests {

pushd "$(dirname "$0")" > /dev/null

while getopts ":hacCfijmp:q:uvslwtedk:b" opt; do
while getopts ":hacCfgijmp:q:uvslwtedk:b" opt; do
case ${opt} in
h)
print_help
Expand Down

0 comments on commit b748ea7

Please sign in to comment.