File tree Expand file tree Collapse file tree 3 files changed +7
-2
lines changed
java_layout/src/main/java/io/customer/android/sample/java_layout/buildinfo Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 9696 echo "workspace=${{ matrix.cio-workspace-name }}" >> "samples/local.properties"
9797 echo "branchName=$BRANCH_NAME" >> "samples/local.properties"
9898 echo "commitHash=${COMMIT_HASH:0:7}" >> "samples/local.properties"
99+ echo "commitsAheadCount=$(git rev-list $(git describe --tags --abbrev=0)..${{ env.BRANCH_NAME }} --count)" >> samples/local.properties
99100 if [ "${{ inputs.use_latest_sdk_version == true }}" ]; then
100101 echo "sdkVersion=${{ steps.latest-sdk-version-step.outputs.LATEST_TAG }}" >> "samples/local.properties"
101102 fi
Original file line number Diff line number Diff line change @@ -27,8 +27,10 @@ public class BuildInfoMetadata {
2727 private final String sdkIntegration ;
2828
2929 public BuildInfoMetadata () {
30- this .sdkVersion = BuildInfoMetadataUtils .resolveValidOrElse (BuildConfig .SDK_VERSION , () -> Version .version + " (as source)" );
31- this .appVersion = BuildConfig .VERSION_NAME ;
30+ this .sdkVersion = String .format (Locale .ENGLISH , "%s-%s" ,
31+ BuildInfoMetadataUtils .resolveValidOrElse (BuildConfig .SDK_VERSION , () -> Version .version ),
32+ BuildInfoMetadataUtils .resolveValidOrElse (BuildConfig .COMMITS_AHEAD_COUNT , () -> "as-source" ));
33+ this .appVersion = String .valueOf (BuildConfig .VERSION_CODE );
3234 this .buildDate = BuildInfoMetadataUtils .formatBuildDateWithRelativeTime (BuildConfig .BUILD_TIMESTAMP );
3335 this .gitMetadata = String .format (Locale .ENGLISH , "%s-%s" ,
3436 BuildInfoMetadataUtils .resolveValidOrElse (BuildConfig .BRANCH_NAME , () -> "working branch" ),
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ android {
4646 String sdkVersion = localProperties[" sdkVersion" ]
4747 String branchName = localProperties[" branchName" ]
4848 String commitHash = localProperties[" commitHash" ]
49+ String commitsAheadCount = localProperties[" commitsAheadCount" ]
4950
5051 // Set build config fields for API keys
5152 buildConfigField " String" , " CDP_API_KEY" , " \" ${ cdpApiKey} \" "
@@ -57,6 +58,7 @@ android {
5758 buildConfigField " String" , " SDK_VERSION" , " \" ${ sdkVersion} \" "
5859 buildConfigField " String" , " BRANCH_NAME" , " \" ${ branchName} \" "
5960 buildConfigField " String" , " COMMIT_HASH" , " \" ${ commitHash} \" "
61+ buildConfigField " String" , " COMMITS_AHEAD_COUNT" , " \" ${ commitsAheadCount} \" "
6062 buildConfigField " long" , " BUILD_TIMESTAMP" , System . currentTimeMillis() + " L"
6163 }
6264 // Avoid redefining signing configs in sample apps to avoid breaking release
You can’t perform that action at this time.
0 commit comments