Skip to content

Commit acaec83

Browse files
committed
Add release signing infrastructure
1 parent 046f260 commit acaec83

File tree

3 files changed

+50
-3
lines changed

3 files changed

+50
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
.externalNativeBuild
1515
.cxx
1616
local.properties
17+
signing.properties

app/build.gradle.kts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* If not, see <http://www.gnu.org/licenses/>.
1515
*/
1616

17+
import java.util.Properties
18+
1719
plugins {
1820
alias(libs.plugins.android.application)
1921
alias(libs.plugins.kotlin.android)
@@ -52,15 +54,35 @@ android {
5254
buildConfig = true
5355
}
5456

57+
signingConfigs {
58+
create("release") {
59+
val props = Properties().apply {
60+
val propsFile = File("signing.properties")
61+
if (propsFile.exists()) {
62+
load(propsFile.reader())
63+
}
64+
}
65+
storeFile = props.getProperty("storeFilePath")?.let { File(it) }
66+
storePassword = props.getProperty("storePassword")
67+
keyPassword = props.getProperty("keyPassword")
68+
keyAlias = props.getProperty("keyAlias")
69+
}
70+
}
71+
5572
buildTypes {
5673
release {
5774
isMinifyEnabled = true
5875
proguardFiles(
5976
getDefaultProguardFile("proguard-android-optimize.txt"),
6077
"proguard-rules.pro"
6178
)
62-
// FIXME
63-
signingConfig = signingConfigs.getByName("debug")
79+
val signing = signingConfigs.findByName("release")
80+
if (signing != null && signing.storeFile != null && signing.storePassword != null && signing.keyPassword != null && signing.keyAlias != null) {
81+
signingConfig = signing
82+
} else {
83+
println("Release signing config not available, falling back to debug config")
84+
signingConfig = signingConfigs.getByName("debug")
85+
}
6486
}
6587
debug {
6688
isDebuggable = true

wear/build.gradle.kts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
1010
*/
1111

12+
import java.util.Properties
13+
1214
plugins {
1315
alias(libs.plugins.android.application)
1416
alias(libs.plugins.kotlin.android)
@@ -32,13 +34,35 @@ android {
3234
compose = true
3335
}
3436

37+
signingConfigs {
38+
create("release") {
39+
val props = Properties().apply {
40+
val propsFile = File("signing.properties")
41+
if (propsFile.exists()) {
42+
load(propsFile.reader())
43+
}
44+
}
45+
storeFile = props.getProperty("storeFilePath")?.let { File(it) }
46+
storePassword = props.getProperty("storePassword")
47+
keyPassword = props.getProperty("keyPassword")
48+
keyAlias = props.getProperty("keyAlias")
49+
}
50+
}
51+
3552
buildTypes {
3653
release {
3754
isMinifyEnabled = true
3855
proguardFiles(
3956
getDefaultProguardFile("proguard-android-optimize.txt"),
4057
"proguard-rules.pro"
4158
)
59+
val signing = signingConfigs.findByName("release")
60+
if (signing != null && signing.storeFile != null && signing.storePassword != null && signing.keyPassword != null && signing.keyAlias != null) {
61+
signingConfig = signing
62+
} else {
63+
println("Release signing config not available, falling back to debug config")
64+
signingConfig = signingConfigs.getByName("debug")
65+
}
4266
}
4367
}
4468
compileOptions {
@@ -64,4 +88,4 @@ dependencies {
6488
implementation(libs.androidx.wear.compose.material)
6589
implementation(libs.androidx.wear.tooling.preview)
6690
implementation(project(":wearapi"))
67-
}
91+
}

0 commit comments

Comments
 (0)