buildSrc/src/main/kotlin/AndroidSigning.kt
changeset 100 9ec927c219b0
parent 75 534a19e25217
equal deleted inserted replaced
99:641b0bfe5292 100:9ec927c219b0
    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.api.dsl.*
    24 import com.android.build.api.dsl.ApplicationExtension
    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 
    27 
    31 // TODO  This implicitly supports only the AppPlugin
       
    32 //  should we support other android plugins: LibraryPlugin TestPlugin ?
       
    33 internal fun Project.configureReleaseSigningConfig() {
    28 internal fun Project.configureReleaseSigningConfig() {
    34     val releaseStoreFile = findProperty("RELEASE_STORE_FILE") as? String ?: ""
    29     val releaseStoreFile = findProperty("RELEASE_STORE_FILE") as? String ?: ""
    35     val releaseStorePassword = findProperty("RELEASE_STORE_PASSWORD") as? String ?: ""
    30     val releaseStorePassword = findProperty("RELEASE_STORE_PASSWORD") as? String ?: ""
    36     val releaseKeyAlias= findProperty("RELEASE_KEY_ALIAS") as? String ?: ""
    31     val releaseKeyAlias= findProperty("RELEASE_KEY_ALIAS") as? String ?: ""
    37     val releaseKeyPassword= findProperty("RELEASE_KEY_PASSWORD") as? String ?: ""
    32     val releaseKeyPassword= findProperty("RELEASE_KEY_PASSWORD") as? String ?: ""
    38 
    33 
    39     extensions.configure<AppExtensionWithSigning>("android") {
    34     extensions.configure<ApplicationExtension>("android") {
    40         signingConfigs {
    35         signingConfigs {
    41             register("release") {
    36             register("release") {
    42                 storeFile =  file(releaseStoreFile)
    37                 storeFile =  file(releaseStoreFile)
    43                 storePassword = releaseStorePassword
    38                 storePassword = releaseStorePassword
    44                 keyAlias = releaseKeyAlias
    39                 keyAlias = releaseKeyAlias