Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Issue #60: Generate versionCode for releases dynamically. #62

Merged
merged 4 commits into from
Sep 17, 2018

Conversation

pocmo
Copy link
Contributor

@pocmo pocmo commented Sep 10, 2018

No description provided.

Copy link
Contributor

@JohanLorenzo JohanLorenzo left a comment

Choose a reason for hiding this comment

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

LGTM overall. I think we should address the timezone and the architecture digit before landing. What do you think?

//
// For September 10th, 2018, 5:04pm am this will generate the versionCode: 2531704 (0-253-1704).

val today = Date()
Copy link
Contributor

Choose a reason for hiding this comment

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

How about using java.time.Instant.now()? This package has been part of Java since Java 8. It gives the UTC time https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html#now--

Copy link
Contributor

Choose a reason for hiding this comment

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

Changed in favor of ZonedDateTime.now(ZoneOffset.UTC). java.time.Instant.now() only returned nano/milli/seconds from Epoch. ZonedDateTime is more handy

val today = Date()

// We use the current year (double digit) and subtract the base year (see above). This value
// will start counting at 0 and increment by one every year.
Copy link
Contributor

Choose a reason for hiding this comment

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

👍


// We append the hour in day (24h) and minute in hour (7:26 pm -> 1926). We do not append
// seconds. This assumes that we do not need to build multiple release(!) builds the same
// minute.
Copy link
Contributor

Choose a reason for hiding this comment

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

The assumption seems fair to me, for now.

app/build.gradle Outdated
// Otherwise this will create version code conflicts.

if (variant.flavorName.contains("X86")) {
versionCode = versionCode + 2
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use a digit to highlight what architecture it is? I'm worried that 2531704 means nothing architecture-wise. This can be confusing on the Google Play dashboard. How about we have:

  • 25317040 -> arm
  • 25317041 -> arm64
  • 25317042 -> x86

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I implemented the proposal.


testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
shrinkResources false
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, what does this config do?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's purpose is to make the APK as small as possible e.g. by removing resources that are not being used:
https://developer.android.com/studio/build/shrink-code

@JohanLorenzo JohanLorenzo requested review from csadilek and removed request for csadilek September 17, 2018 16:13
@JohanLorenzo
Copy link
Contributor

This PR blocks bug 1491796. Could you tell me what you think of it @csadilek ? :)

Copy link
Contributor

@csadilek csadilek left a comment

Choose a reason for hiding this comment

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

🚢


testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
shrinkResources false
Copy link
Contributor

Choose a reason for hiding this comment

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

It's purpose is to make the APK as small as possible e.g. by removing resources that are not being used:
https://developer.android.com/studio/build/shrink-code

@csadilek csadilek merged commit 399a233 into mozilla-mobile:master Sep 17, 2018
@csadilek
Copy link
Contributor

@JohanLorenzo ok done :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants