Gradle Native - Change name of binary built according its BuildType

I’m using in a Gradle Native Project two different build types, debug and release, as follows:

model {
  buildTypes {
    debug
    release
  }
  ...
}

I’m also using two different platforms, x86 e x64. The Shared Library produced goes in

build/foox86SharedLibrary/debug/libfoox86.so
build/foox86SharedLibrary/release/libfoox86.so
build/foox64SharedLibrary/debug/libfoox64.so
build/foox64SharedLibrary/release/libfoox64.so

I woud like the libraries to be named libfoox86d.so for debug, and libfoox86r.so for release. How can I achieve that?

Thanks,
Mauro

Hi Mauro,
I have your same problem.

I am in a multiproject environment and I’d like to rename debug libraries in different way.
I found out that If I put these lines within each subproject file, I get the right names:

model {
  components {    
    MyLibrary(NativeLibrarySpec) {
      binaries.withType(NativeLibraryBinarySpec) {
        if (buildType == buildTypes.Debug) {
          baseName = project.name + "-dbg"
        }
        else {
          baseName = project.name
        }
      }
    }
  }
}

Now I am trying to move those lines within the build.gradle file in root directory. I tried this but it doesn’t work:

model {
  components {    
    binaries.withType(NativeLibraryBinarySpec) {
      if (buildType == buildTypes.Debug) {
        baseName = project.name + "-dbg"
      }
      else {
        baseName = project.name
      }
    }
  }
}

Gradle tells me that “baseName” property does not exist.
> Exception thrown while executing model rule: ComponentModelBasePlugin.Rules#collectBinaries
> No such property: baseName for class: org.gradle.nativeplatform.internal.DefaultSharedLibraryBinarySpec_Decorated

Have anyone found any better solution?