Skip to content

Commit

Permalink
Merge branch 'release/2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
G00fY2 committed Jun 5, 2020
2 parents 5e589ec + 25fdf0f commit e0a14cc
Show file tree
Hide file tree
Showing 24 changed files with 604 additions and 574 deletions.
229 changes: 209 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,214 @@
# Reference gitignore https://gist.github.com/G00fY2/81c0aa67943cca021e915840bf73ee1b

# Built application files
*.apk
*.ap_
*.aab

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle
.gradle/
build/
gradle-app.setting
.gradletasknamecache

# Signing files
.signing/

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

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio
/*/build/
/*/local.properties
/*/out
/*/*/build
/*/*/production
/*/*/staging
*.ipr
*~
.DS_Store
*.swp

# Android Patch
gen-external-apklibs

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# IntelliJ
*.iml
.idea
templates
build
scripts
public
repo
*.iws
.idea/artifacts
.idea/modules
.idea/modules.xml
.idea/workspace.xml
.idea/navEditor.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/libraries
.idea/caches
.idea/shelf
.idea/.name
.idea/compiler.xml
.idea/copyright/profiles_settings.xml
.idea/encodings.xml
.idea/misc.xml
.idea/scopes/scope_settings.xml
.idea/vcs.xml
.idea/jsLibraryMappings.xml
.idea/dataSources
.idea/datasources.xml
.idea/dataSources.local.xml
.idea/dataSources.ids
.idea/sqlDataSources.xml
.idea/dbnavigator.xml
.idea/dynamic.xml
.idea/uiDesigner.xml
.idea/usage.statistics.xml
.idea/contentModel.xml
.idea/kotlinc.xml
.idea/jarRepositories.xml
# optional
.idea/dictionaries
.idea/inspectionProfiles
.idea/runConfigurations
.idea/runConfigurations.xml

.gradle
/local.properties
/gradle.properties
/.idea
.DS_Store
/build
/captures
# Keystore files
*.jks
*.keystore

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
/icon.png
/bin
.classpath
.project
.settings/org.eclipse.buildship.core.prefs

out/
# NDK
obj/

# CMake
cmake-build-*/

# Google Services (e.g. APIs or Firebase)
google-services.json

# Freeline
freeline.py
freeline/
freeline_project_description.json

# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md

#Crashlytics
crashlytics-build.properties
com_crashlytics_export_strings.xml
crashlytics.properties
fabric.properties

## Plugin-specific files:

# mpeltonen/sbt-idea plugin
.idea_modules/

# Mongo Explorer plugin
.idea/mongoSettings.xml

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Editor-based Rest Client
.idea/httpRequests

## OS specific files:

# General
.DS_Store
.DS_Store?
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*
19 changes: 19 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

102 changes: 41 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,92 +1,72 @@
## What is this?
# Android Versioning Gradle Plugin [ ![Download](https://api.bintray.com/packages/appcom-interactive/android/android-versioning/images/download.svg) ](https://bintray.com/appcom-interactive/android/android-versioning/_latestVersion)

* Generate the android app version name and version code automatically (via git).
* Append the version number to your APK artifacts.
This plugin automatically generates your Android versionName and versionCode using Git. It also appends the version and variant names to your ABB/APK artifacts.

## Preconditions

* [Git](https://git-scm.com/)
* At least one git tag which defines your current version (e.g. 1.0.2).
* We suggest to follow the [SemVer](http://semver.org/) specification for the versioning.

## Installation

Add the following to your project level build.gradle
## Usage

### `buildscript` block:
```groovy
// top-level build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'eu.appcom.gradle:android-versioning:1.0.0'
classpath 'eu.nanogiants:android-versioning:2.0.0'
}
}
```
```groovy
// app build.gradle
apply plugin: 'eu.nanogiants.android-versioning'
```

Add the following to the module level build.gradle

### Version code and name
```groovy
apply plugin: 'eu.appcom.gradle.android-versioning'
android {
defaultConfig {
versionCode versioning.getVersionCode()
versionName versioning.getVersionName()
}
}
```
**Use the plugin by referencing the versioning extension.**

## Usage
* `getVersionCode()` returns the current Git commit count
* `getVersionName()` returns the latest Git tag of your repository

All usage scenarios take place in the app level build.gradle file within the android section.
#### Optional:
* `getVersionName(checkBranch: Boolean)` if `checkBranch` is set to *true* the plugin will check if the current branch is `release/x.x.x` or `hotfix/x.x.x` and use the naming instead the latest tag.

### Version code and name
### Artifact naming

The android version code is represented by the git commit count.
The android version name is represented by the newest git tag of your repository.
To make use of the plugin, just remove the following lines from the build.gradle file.
The plugin will automatically set the APK and AAB naming for all assemble and bundle tasks. This will also work if you do not use the versioning extension in the defaultConfig. You can still use the default `archivesBaseName` property.

#### Example:

Build Variant `productionStoreDebug`
```groovy
versionCode versioning.getVersionCode()
versionName versioning.getVersionName()
android {
defaultConfig {
archivesBaseName = "MyAppName"
}
}
```

### Apk naming

Artifacts:
```
MyAppName-production-store-3.9.0-3272-debug.apk
MyAppName-production-store-3.9.0-3272-debug.aab
```
#### Optional:
You can define a comma separated list of buildTypes (e.g. debug) be excluded from the artifact naming.
```groovy
versioning {
baseName = "sample-app"
}
applicationVariants.all { variant ->
if (variant.getName().contains("Release")) {
variant.outputs.all {
outputFileName = versioning.getApkName(variant)
}
}
excludeBuildTypes = "debug" {
}
```

This will automatically generate file names for each flavor with the following structure: baseName-flavor-tag-buildnumber.apk

In this example with flavor 'develop': sample-app-develop-1.0.0-33.apk

### APK Artifact with versioned name

The name of the output APK will get an additional version number part which consists of the git tag (app version name) and the git commit count (app version code), e.g.:
* version name (git tag): 1.2.0
* version code (git commit count): 23
* APK version info: 1.2.0.23
* full APK name: appname-1.2.0.23-debug.apk

### Show the current versions

Use the gradle task 'printVersions' to print out all relevant version information to the gradle console.

In Android projects use the gradle task 'printApkNames' to print out all file names for each flavor to the gradle console.

### Gradle tasks
- clean build
- publishToMavenLocal
- bintrayUpload -PbintrayUser=XXX -PbintrayApiKey=XXX

## License

Copyright (c) 2017 appcom interactive GmbH
Copyright (C) 2020 NanoGiants GmbH

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit e0a14cc

Please sign in to comment.