Skip to content

Commit

Permalink
Add release signing infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
maniac103 committed Jul 12, 2024
1 parent 046f260 commit acaec83
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
.externalNativeBuild
.cxx
local.properties
signing.properties
26 changes: 24 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* If not, see <http://www.gnu.org/licenses/>.
*/

import java.util.Properties

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
Expand Down Expand Up @@ -52,15 +54,35 @@ android {
buildConfig = true
}

signingConfigs {
create("release") {
val props = Properties().apply {
val propsFile = File("signing.properties")
if (propsFile.exists()) {
load(propsFile.reader())
}
}
storeFile = props.getProperty("storeFilePath")?.let { File(it) }
storePassword = props.getProperty("storePassword")
keyPassword = props.getProperty("keyPassword")
keyAlias = props.getProperty("keyAlias")
}
}

buildTypes {
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
// FIXME
signingConfig = signingConfigs.getByName("debug")
val signing = signingConfigs.findByName("release")
if (signing != null && signing.storeFile != null && signing.storePassword != null && signing.keyPassword != null && signing.keyAlias != null) {
signingConfig = signing
} else {
println("Release signing config not available, falling back to debug config")
signingConfig = signingConfigs.getByName("debug")
}
}
debug {
isDebuggable = true
Expand Down
26 changes: 25 additions & 1 deletion wear/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import java.util.Properties

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
Expand All @@ -32,13 +34,35 @@ android {
compose = true
}

signingConfigs {
create("release") {
val props = Properties().apply {
val propsFile = File("signing.properties")
if (propsFile.exists()) {
load(propsFile.reader())
}
}
storeFile = props.getProperty("storeFilePath")?.let { File(it) }
storePassword = props.getProperty("storePassword")
keyPassword = props.getProperty("keyPassword")
keyAlias = props.getProperty("keyAlias")
}
}

buildTypes {
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
val signing = signingConfigs.findByName("release")
if (signing != null && signing.storeFile != null && signing.storePassword != null && signing.keyPassword != null && signing.keyAlias != null) {
signingConfig = signing
} else {
println("Release signing config not available, falling back to debug config")
signingConfig = signingConfigs.getByName("debug")
}
}
}
compileOptions {
Expand All @@ -64,4 +88,4 @@ dependencies {
implementation(libs.androidx.wear.compose.material)
implementation(libs.androidx.wear.tooling.preview)
implementation(project(":wearapi"))
}
}

0 comments on commit acaec83

Please sign in to comment.