buildSrc/src/main/kotlin/AndroidSigning.kt
changeset 19 91a3ad3b1b9c
parent 10 9aad34f43f71
child 20 5d8a0555733d
equal deleted inserted replaced
18:3ccb29f83309 19:91a3ad3b1b9c
    19  * You should have received a copy of the GNU General Public License
    19  * You should have received a copy of the GNU General Public License
    20  * along with Geekdroid.  If not, see <http://www.gnu.org/licenses/>.
    20  * along with Geekdroid.  If not, see <http://www.gnu.org/licenses/>.
    21  */
    21  */
    22 package com.geekorum.build
    22 package com.geekorum.build
    23 
    23 
    24 import com.android.build.gradle.BaseExtension
    24 import com.android.build.api.dsl.*
    25 import org.gradle.api.Project
    25 import org.gradle.api.Project
    26 
    26 
       
    27 private typealias AppExtensionWithSigning = CommonExtension<*, ApplicationBuildType, *, *>
       
    28 private typealias LibExtensionWithSigning = CommonExtension<*, LibraryBuildType, *, *>
       
    29 private typealias TestExtensionWithSigning = CommonExtension<*, TestBuildType, *, *>
       
    30 
       
    31 // TODO  This implicitly supports only the AppPlugin
       
    32 //  should we support other android plugins: LibraryPlugin TestPlugin ?
    27 internal fun Project.configureReleaseSigningConfig() {
    33 internal fun Project.configureReleaseSigningConfig() {
    28     val releaseStoreFile = findProperty("RELEASE_STORE_FILE") as? String ?: ""
    34     val releaseStoreFile = findProperty("RELEASE_STORE_FILE") as? String ?: ""
    29     val releaseStorePassword = findProperty("RELEASE_STORE_PASSWORD") as? String ?: ""
    35     val releaseStorePassword = findProperty("RELEASE_STORE_PASSWORD") as? String ?: ""
    30     val releaseKeyAlias= findProperty("RELEASE_KEY_ALIAS") as? String ?: ""
    36     val releaseKeyAlias= findProperty("RELEASE_KEY_ALIAS") as? String ?: ""
    31     val releaseKeyPassword= findProperty("RELEASE_KEY_PASSWORD") as? String ?: ""
    37     val releaseKeyPassword= findProperty("RELEASE_KEY_PASSWORD") as? String ?: ""
    32 
    38 
    33     extensions.configure<BaseExtension>("android") {
    39     extensions.configure<AppExtensionWithSigning>("android") {
    34         signingConfigs {
    40         signingConfigs {
    35             register("release") {
    41             register("release") {
    36                 storeFile =  file(releaseStoreFile)
    42                 storeFile =  file(releaseStoreFile)
    37                 storePassword = releaseStorePassword
    43                 storePassword = releaseStorePassword
    38                 keyAlias = releaseKeyAlias
    44                 keyAlias = releaseKeyAlias