-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
android: Add SigningConfig.fromProperties function
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package dsl | ||
|
||
import com.android.build.api.dsl.SigningConfig | ||
import org.gradle.api.Incubating | ||
import java.io.File | ||
import java.util.* | ||
|
||
/** | ||
* Applies signature configuration from the specified [propertiesFile]. | ||
* | ||
* The file content should have the following format: | ||
* ``` | ||
* store_file=[relative path to keystore file] | ||
* store_password=[keystore password] | ||
* key_alias=[the alias of the needed key] | ||
* key_password=[the password for the specified alias] | ||
* ``` | ||
*/ | ||
@Incubating | ||
public fun SigningConfig.fromProperties(propertiesFile: File) { | ||
val directory = propertiesFile.parentFile | ||
val properties = Properties() | ||
propertiesFile.inputStream().use(properties::load) | ||
|
||
storeFile = File(directory, properties.getProperty("store_file")) | ||
storePassword = properties.getProperty("store_password") | ||
keyAlias = properties.getProperty("key_alias") | ||
keyPassword = properties.getProperty("key_password") | ||
} |