Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Speed - using static git information for debug build config #5668

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/5668.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improving build speed after committing or changing branches by removing git sha information from debug builds
12 changes: 8 additions & 4 deletions matrix-sdk-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ android {

buildConfigField "String", "SDK_VERSION", "\"1.4.10\""

buildConfigField "String", "GIT_SDK_REVISION", "\"${gitRevision()}\""
buildConfigField "String", "GIT_SDK_REVISION_UNIX_DATE", "\"${gitRevisionUnixDate()}\""
buildConfigField "String", "GIT_SDK_REVISION_DATE", "\"${gitRevisionDate()}\""

defaultConfig {
consumerProguardFiles 'proguard-rules.pro'
}
Expand All @@ -53,11 +49,19 @@ android {
buildConfigField "boolean", "LOG_PRIVATE_DATA", project.property("vector.debugPrivateData")
// Set to BODY instead of NONE to enable logging
buildConfigField "okhttp3.logging.HttpLoggingInterceptor.Level", "OKHTTP_LOGGING_LEVEL", "okhttp3.logging.HttpLoggingInterceptor.Level." + project.property("vector.httpLogLevel")

buildConfigField "String", "GIT_SDK_REVISION", "\"dev\""
buildConfigField "String", "GIT_SDK_REVISION_UNIX_DATE", "\"dev\""
buildConfigField "String", "GIT_SDK_REVISION_DATE", "\"dev\""
}

release {
buildConfigField "boolean", "LOG_PRIVATE_DATA", "false"
buildConfigField "okhttp3.logging.HttpLoggingInterceptor.Level", "OKHTTP_LOGGING_LEVEL", "okhttp3.logging.HttpLoggingInterceptor.Level.BASIC"

buildConfigField "String", "GIT_SDK_REVISION", "\"${gitRevision()}\""
buildConfigField "String", "GIT_SDK_REVISION_UNIX_DATE", "\"${gitRevisionUnixDate()}\""
buildConfigField "String", "GIT_SDK_REVISION_DATE", "\"${gitRevisionDate()}\""
}
}

Expand Down
22 changes: 14 additions & 8 deletions vector/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,6 @@ android {
// Required for sonar analysis
versionName "${versionMajor}.${versionMinor}.${versionPatch}-sonar"

// Generate a random app task affinity
manifestPlaceholders = [appTaskAffinitySuffix:"H_${gitRevision()}"]

buildConfigField "String", "GIT_REVISION", "\"${gitRevision()}\""
buildConfigField "String", "GIT_REVISION_DATE", "\"${gitRevisionDate()}\""
buildConfigField "String", "GIT_BRANCH_NAME", "\"${gitBranchName()}\""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's quite annoying not to have the branch name. I use it to check that I am on the correct version when installing an APK built from Buildkite.
I guess I can live without that. Or we can include it when built on the CI, but not when built on a local computer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also agree, I find the branch name quite useful for quickly confirming build origins

I'll have a bit more of a play around which the separate cacheable module approach to see if there's a way to play nice with the SDK project (without resorting to releasing a another artifact)

buildConfigField "String", "BUILD_NUMBER", "\"${buildNumber}\""

buildConfigField "im.vector.app.features.VectorFeatures.OnboardingVariant", "ONBOARDING_VARIANT", "im.vector.app.features.VectorFeatures.OnboardingVariant.FTUE_AUTH"

buildConfigField "im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy", "outboundSessionKeySharingStrategy", "im.vector.app.features.crypto.keysrequest.OutboundSessionKeySharingStrategy.WhenTyping"
Expand Down Expand Up @@ -232,6 +224,13 @@ android {
buildConfigField "boolean", "ENABLE_STRICT_MODE_LOGS", "false"
buildConfigField "Boolean", "ENABLE_LIVE_LOCATION_SHARING", "true"

// using static values to avoid cache misses on new commits
manifestPlaceholders = [appTaskAffinitySuffix: "H_aaaaaa"]
buildConfigField "String", "GIT_REVISION", "\"dev\""
buildConfigField "String", "GIT_REVISION_DATE", "\"dev\""
buildConfigField "String", "GIT_BRANCH_NAME", "\"dev\""
buildConfigField "String", "BUILD_NUMBER", "\"dev\""

signingConfig signingConfigs.debug
}

Expand All @@ -242,6 +241,13 @@ android {
buildConfigField "boolean", "ENABLE_STRICT_MODE_LOGS", "false"
buildConfigField "Boolean", "ENABLE_LIVE_LOCATION_SHARING", "false"

manifestPlaceholders = [appTaskAffinitySuffix:"H_${gitRevision()}"]

buildConfigField "String", "GIT_REVISION", "\"${gitRevision()}\""
buildConfigField "String", "GIT_REVISION_DATE", "\"${gitRevisionDate()}\""
buildConfigField "String", "GIT_BRANCH_NAME", "\"${gitBranchName()}\""
buildConfigField "String", "BUILD_NUMBER", "\"${buildNumber}\""

postprocessing {
removeUnusedCode true
removeUnusedResources true
Expand Down