Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit 6c1e41b

Browse files
authored
Revamp build configuration (#1156)
* release: move scripts to scripts directory Signed-off-by: Harsh Shandilya <[email protected]> * Move CI secrets to secrets directory Signed-off-by: Harsh Shandilya <[email protected]> * gradle: uprev to 6.7 Signed-off-by: Harsh Shandilya <[email protected]> * gradle: suppress warnings about unsupported options Signed-off-by: Harsh Shandilya <[email protected]> * build: update dependencies Signed-off-by: Harsh Shandilya <[email protected]> * build: move Gradle plugins to ext Signed-off-by: Harsh Shandilya <[email protected]> * build: move configuration tasks to buildSrc Signed-off-by: Harsh Shandilya <[email protected]> * CHANGELOG: add entry for #1137 Signed-off-by: Harsh Shandilya <[email protected]> * Fix lint warnings Signed-off-by: Harsh Shandilya <[email protected]>
1 parent 92f1aab commit 6c1e41b

24 files changed

+222
-97
lines changed

.github/workflows/deploy_snapshot.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
uses: actions/checkout@v2
1414

1515
- name: Decrypt secrets
16-
run: release/signing-setup.sh "$ENCRYPT_KEY"
16+
run: scripts/signing-setup.sh "$ENCRYPT_KEY"
1717
env:
1818
ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }}
1919

@@ -28,10 +28,10 @@ jobs:
2828
arguments: :app:assembleFreeRelease :app:assembleNonFreeRelease
2929

3030
- name: Clean secrets
31-
run: release/signing-cleanup.sh
31+
run: scripts/signing-cleanup.sh
3232

3333
- name: Deploy snapshot
34-
run: release/deploy-snapshot.sh
34+
run: scripts/deploy-snapshot.sh
3535
env:
3636
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
3737
SSH_USERNAME: ${{ secrets.SSH_USERNAME }}

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
uses: actions/checkout@v2
1414

1515
- name: Decrypt secrets
16-
run: release/signing-setup.sh "$ENCRYPT_KEY"
16+
run: scripts/signing-setup.sh "$ENCRYPT_KEY"
1717
env:
1818
ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }}
1919

@@ -45,7 +45,7 @@ jobs:
4545

4646
- name: Clean secrets
4747
if: always()
48-
run: release/signing-cleanup.sh
48+
run: scripts/signing-cleanup.sh
4949

5050
create_github_release:
5151
name: Create GitHub Release

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Created by https://www.gitignore.io/api/androidstudio,gradle
32
# Edit at https://www.gitignore.io/?templates=androidstudio,gradle
43

@@ -44,7 +43,7 @@ out/
4443

4544
# Signing files
4645
.signing/
47-
keystore.*
46+
/keystore.*
4847

4948
# Local configuration file (sdk path, etc)
5049
local.properties

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file.
1414

1515
- Add GPG key selection step to onboarding flow
1616
- Allow configuring an app-wide HTTP(S) proxy
17+
- Add option to automatically sync repository on app launch
1718

1819
## [1.12.1] - 2020-10-13
1920

app/build.gradle.kts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import com.android.build.gradle.internal.api.BaseVariantOutputImpl
66
import java.util.Properties
77

88
plugins {
9+
id("com.android.application")
910
kotlin("android")
11+
`aps-plugin`
1012
}
1113

1214
val keystorePropertiesFile = rootProject.file("keystore.properties")
@@ -26,13 +28,16 @@ android {
2628

2729
adbOptions.installOptions("--user 0")
2830

29-
buildFeatures.viewBinding = true
30-
buildFeatures.buildConfig = true
31+
buildFeatures {
32+
viewBinding = true
33+
buildConfig = true
34+
}
3135

3236
defaultConfig {
3337
applicationId = "dev.msfjarvis.aps"
3438
versionCode = 11211
3539
versionName = "1.13.0-SNAPSHOT"
40+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
3641
}
3742

3843
lintOptions {
@@ -41,13 +46,6 @@ android {
4146
disable("MissingTranslation", "PluralsCandidate", "ImpliedQuantity")
4247
}
4348

44-
packagingOptions {
45-
exclude("**/*.version")
46-
exclude("**/*.txt")
47-
exclude("**/*.kotlin_module")
48-
exclude("**/plugin.properties")
49-
}
50-
5149
buildTypes {
5250
named("release") {
5351
isMinifyEnabled = true

app/src/main/res/layout/oreo_autofill_dataset.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
-->
55

66
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
7+
xmlns:app="http://schemas.android.com/apk/res-auto"
78
xmlns:tools="http://schemas.android.com/tools"
89
android:layout_width="match_parent"
910
android:layout_height="match_parent"
@@ -22,7 +23,7 @@
2223
android:adjustViewBounds="true"
2324
android:maxWidth="20dp"
2425
android:maxHeight="20dp"
25-
android:tint="@color/secondary_color"
26+
app:tint="@color/secondary_color"
2627
tools:src="@mipmap/ic_launcher" />
2728

2829
<LinearLayout

app/src/main/res/layout/oreo_autofill_filter_row.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
android:layout_marginStart="8dp"
2020
android:alpha="0.5"
2121
android:src="@drawable/ic_person_black_24dp"
22-
android:tint="?colorOnPrimary"
2322
app:layout_constraintBottom_toBottomOf="parent"
2423
app:layout_constraintEnd_toStartOf="@id/title"
2524
app:layout_constraintHorizontal_bias="0.0"
2625
app:layout_constraintStart_toStartOf="parent"
27-
app:layout_constraintTop_toTopOf="parent" />
26+
app:layout_constraintTop_toTopOf="parent"
27+
app:tint="?colorOnPrimary" />
2828

2929
<TextView
3030
android:id="@+id/title"

autofill-parser/build.gradle.kts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
plugins {
2-
kotlin("android")
3-
id("maven-publish")
2+
id("com.android.library")
3+
id("maven-publish")
4+
kotlin("android")
5+
`aps-plugin`
46
}
57

68
// Type safety can sometimes suck

build.gradle.kts

Lines changed: 7 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2,76 +2,24 @@
22
* Copyright © 2014-2020 The Android Password Store Authors. All Rights Reserved.
33
* SPDX-License-Identifier: GPL-3.0-only
44
*/
5-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
6-
import com.android.build.gradle.BaseExtension
7-
import kotlinx.validation.ApiValidationExtension
8-
95
buildscript {
6+
apply(from = "buildSrc/buildDependencies.gradle")
7+
val build: Map<Any, Any> by extra
108
repositories {
119
google()
1210
jcenter()
1311
// For binary compatibility validator.
1412
maven { url = uri("https://kotlin.bintray.com/kotlinx") }
1513
}
1614
dependencies {
17-
classpath(Plugins.agp)
18-
classpath(Plugins.binaryCompatibilityValidator)
19-
classpath(Plugins.kotlin)
15+
classpath(build.getValue("androidGradlePlugin"))
16+
classpath(build.getValue("binaryCompatibilityValidator"))
17+
classpath(build.getValue("kotlinGradlePlugin"))
2018
}
2119
}
2220

2321
plugins {
2422
id("com.github.ben-manes.versions") version "0.33.0"
25-
}
26-
27-
apply(plugin = "binary-compatibility-validator")
28-
29-
extensions.configure<ApiValidationExtension> {
30-
ignoredProjects = mutableSetOf(
31-
"app"
32-
)
33-
}
34-
35-
subprojects {
36-
repositories {
37-
google()
38-
jcenter()
39-
maven {
40-
setUrl("https://jitpack.io")
41-
}
42-
}
43-
if (name == "app") {
44-
apply(plugin = "com.android.application")
45-
} else {
46-
apply(plugin = "com.android.library")
47-
}
48-
configure<BaseExtension> {
49-
compileSdkVersion(29)
50-
defaultConfig {
51-
minSdkVersion(23)
52-
targetSdkVersion(29)
53-
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
54-
}
55-
compileOptions {
56-
sourceCompatibility = JavaVersion.VERSION_1_8
57-
targetCompatibility = JavaVersion.VERSION_1_8
58-
}
59-
tasks.withType<JavaCompile> {
60-
options.compilerArgs.add("-Xlint:unchecked")
61-
options.isDeprecation = true
62-
}
63-
}
64-
tasks.withType<KotlinCompile> {
65-
kotlinOptions {
66-
jvmTarget = "1.8"
67-
freeCompilerArgs = listOf("-Xopt-in=kotlin.RequiresOptIn", "-Xallow-result-return-type")
68-
languageVersion = "1.4"
69-
}
70-
}
71-
}
72-
73-
tasks.wrapper {
74-
gradleVersion = "6.6.1"
75-
distributionType = Wrapper.DistributionType.ALL
76-
distributionSha256Sum = "11657af6356b7587bfb37287b5992e94a9686d5c8a0a1b60b87b9928a2decde5"
23+
`binary-compatibility-validator`
24+
`aps-plugin`
7725
}

buildSrc/build.gradle.kts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
1+
apply(from = "buildDependencies.gradle")
2+
val build: Map<Any, Any> by extra
3+
14
plugins {
25
`kotlin-dsl`
36
}
47

58
repositories {
6-
jcenter()
9+
google()
10+
gradlePluginPortal()
711
}
812

913
kotlinDslPluginOptions {
1014
experimentalWarning.set(false)
1115
}
16+
17+
gradlePlugin {
18+
plugins {
19+
register("aps") {
20+
id = "aps-plugin"
21+
implementationClass = "PasswordStorePlugin"
22+
}
23+
}
24+
}
25+
26+
dependencies {
27+
implementation(build.getValue("kotlinGradlePlugin"))
28+
implementation(build.getValue("androidGradlePlugin"))
29+
implementation(build.getValue("binaryCompatibilityValidator"))
30+
}

0 commit comments

Comments
 (0)