Skip to content

Commit

Permalink
Merge pull request #15 from valueadd-poland/feature/add-simple-versio…
Browse files Browse the repository at this point in the history
…ning-script

add: simple versioning script
  • Loading branch information
PiotrBandurski authored Feb 14, 2020
2 parents 397d72b + b4edc38 commit 995df8b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
5 changes: 3 additions & 2 deletions mvi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply from: "$rootDir/scripts/versioning.gradle"
apply from: "$rootDir/scripts/jfrog.gradle"


Expand All @@ -18,8 +19,8 @@ android {
defaultConfig {
minSdkVersion deps.build_version.min_sdk
targetSdkVersion deps.build_version.target_sdk
versionCode 1
versionName "1.0"
versionName libraryVersionName
versionCode libraryVersionCode
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
Expand Down
6 changes: 1 addition & 5 deletions scripts/jfrog.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ ext {
siteUrl = 'https://github.com/valueadd-poland/mvi-valueadd'
gitUrl = 'https://github.com/valueadd-poland/mvi-valueadd.git'

libraryVersion = '0.2'

developerId = 'valueadd-poland'
developerName = 'Valueadd'
developerEmail = '[email protected]'
Expand All @@ -26,7 +24,7 @@ ext {
}

group = publishedGroupId
version = libraryVersion
version = libraryVersionName

install {
repositories.mavenInstaller {
Expand Down Expand Up @@ -61,8 +59,6 @@ install {
}
}



Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

Expand Down
14 changes: 14 additions & 0 deletions scripts/versioning.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Library version variable
def libraryVersionName = '1.0.0'

// Set project library version name
rootProject.ext.libraryVersionName = libraryVersionName
println "libraryVersionName = $libraryVersionName"

// Generate library version code
def (major, minor, patch) = (libraryVersionName != null) ? libraryVersionName.tokenize('.') : [0, 0, 1]
def libraryVersionCode = major.toInteger() * 1_000_000 + minor.toInteger() * 1_000 + patch.toInteger()

// Set project library version code
rootProject.ext.libraryVersionCode = libraryVersionCode
println "libraryVersionCode = $libraryVersionCode ($major.$minor.$patch)"

0 comments on commit 995df8b

Please sign in to comment.