Skip to content

Commit

Permalink
Merge branch 'release/v1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
rouddy committed Mar 25, 2021
2 parents af8647e + 528432f commit b8547eb
Show file tree
Hide file tree
Showing 13 changed files with 197 additions and 206 deletions.
80 changes: 80 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,80 @@
version: 2
jobs:
build:
docker:
- image: circleci/android:api-30
steps:
- checkout
- run:
command: |
sdkmanager "system-images;android-29;default;x86"
name: Install system image "system-images;android-29;default;x86"
- run:
command: |
find . -name 'build.gradle' | sort | xargs cat |
shasum | awk '{print $1}' > ./tmp_gradle_cache_seed
name: Generate cache checksum
- restore_cache:
key: gradle-v1a-{{ arch }}-{{ checksum "./tmp_gradle_cache_seed" }}
name: Restore gradle cache
- run:
name: gradle.property
command: |
mkdir -p ~/.gradle
curl $GRADLE_PROPERTY_PATH --output ~/.gradle/gradle.properties
curl $SECRET_KEY_RING_PATH --output algorigoble/secret-keys.gpg
- run:
command: |
./gradlew build
name: 'Run: ./gradlew build'
- save_cache:
key: gradle-v1a-{{ arch }}-{{ checksum "./tmp_gradle_cache_seed" }}
name: Save gradle cache
paths:
- ~/.gradle/caches
- ~/.gradle/wrapper
- save_cache:
key: gradle-properties-${CIRCLE_WORKFLOW_ID}
name: Save gradle properties
paths:
- ~/.gradle/gradle.properties
- store_artifacts:
path: algorigoble/build/reports
destination: reports
- store_test_results:
path: algorigoble/build/test-results
- persist_to_workspace:
root: .
paths:
- .
resource_class: medium
deploy:
docker:
- image: circleci/android:api-30
working_directory: ~/code
steps:
- attach_workspace:
at: .
- restore_cache:
key: gradle-v1a-{{ arch }}-{{ checksum "./tmp_gradle_cache_seed" }}
name: Restore gradle cache
- restore_cache:
key: gradle-properties-${CIRCLE_WORKFLOW_ID}
name: Restore gradle properties
- run:
name: Upload Maven Central
command: ./gradlew uploadArchives

workflows:
version: 2
build_deploy:
jobs:
- build
- deploy:
requires:
- build
filters:
branches:
only:
- master
- /release\/.*/
146 changes: 85 additions & 61 deletions algorigoble/build.gradle
Expand Up @@ -2,72 +2,96 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'

version '1.2.0'
group 'com.algorigo.algorigoble'

publishing {
publications {
AlgorigoBle(MavenPublication) {
artifact("$buildDir/outputs/aar/algorigoble-release.aar")
groupId this.group
artifactId 'AlgorigoBleLibrary'
version this.version

pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')

// Iterate over the implementation dependencies (we don't want the test ones), adding a <dependency> node for each
configurations.implementation.allDependencies.each {
// Ensure dependencies such as fileTree are not included in the pom.
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
def versionStr = '1.3.0'

def getCurrentGitBranch() {
def gitBranch = "Unknown branch"
try {
def workingDir = new File("${project.projectDir}")
def result = 'git rev-parse --abbrev-ref HEAD'.execute(null, workingDir)
result.waitFor()
if (result.exitValue() == 0) {
gitBranch = result.text.trim()
}
} catch (e) {
}
return gitBranch
}

def getUserName() {
return System.properties['user.name']
}

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.bmuschko:gradle-nexus-plugin:2.3.1'
}
}

bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
publications = ['AlgorigoBle']
configurations = ['archives']
override = true
pkg {
repo = 'maven'
name = 'AlgorigoBle'
userOrg = 'chagilhwan'
description = "Algorigo Ble Library with rx"
publish = true
publicDownloadNumbers = true
licenses = ['Apache-2.0']
websiteUrl = 'https://github.com/Algorigo/AlgorigoBleLibrary'
vcsUrl = '${websiteUrl}.git'
dryRun = false
version {
name = this.version
desc = 'minor update'
released = new Date()
vcsTag = this.version
apply plugin: 'com.bmuschko.nexus'

group = "com.algorigo.rx"
archivesBaseName = "algorigoble"
if (getCurrentGitBranch().equals('master')) {
version = versionStr
} else {
version = "${versionStr}-${getUserName()}-SNAPSHOT"
}

modifyPom {
project {
name 'AlgorigoBleLibrary'
description 'Ble Library for Android using ReactiveX'
url 'https://github.com/Algorigo/AlgorigoBleLibrary'
inceptionYear '2018'

scm {
url 'https://github.com/Algorigo/AlgorigoBleLibrary'
connection 'scm:https://github.com/Algorigo/AlgorigoBleLibrary.git'
developerConnection 'scm:git:https://github.com/Algorigo/AlgorigoBleLibrary.git'
}

licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}

developers {
developer {
id 'rouddy'
name 'Rouddy'
email 'rouddy@naver.com'
}
}
}
}

extraArchive {
sources = true
tests = true
javadoc = true
}

nexus {
sign = true
repositoryUrl = NEXUS_REPOSITORY_URL
snapshotRepositoryUrl = NEXUS_SNAPSHOT_REPOSITORY_URL
}

android {
compileSdkVersion 29
compileSdkVersion 30

defaultConfig {
minSdkVersion 18
targetSdkVersion 29
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName this.version
versionName versionStr

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -85,23 +109,23 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

implementation 'org.jetbrains.kotlin:kotlin-reflect:1.3.72'
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.4.31'

//RxAndroidBle
implementation "com.polidea.rxandroidble2:rxandroidble:1.10.1"
implementation "com.polidea.rxandroidble2:rxandroidble:1.11.1"

//ReactiveX
implementation 'io.reactivex.rxjava2:rxkotlin:2.4.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
//ReactiveX Relay
implementation 'com.jakewharton.rxrelay2:rxrelay:2.1.0'
implementation 'com.jakewharton.rxrelay2:rxrelay:2.1.1'

// gson
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.google.code.gson:gson:2.8.6'
}

repositories {
Expand Down
1 change: 1 addition & 0 deletions algorigoble/src/main/AndroidManifest.xml
Expand Up @@ -10,5 +10,6 @@
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

</manifest>
Expand Up @@ -36,7 +36,9 @@ object BleScanOptionsConverter {
fun convertScanFilters(filters: Array<out BleScanFilter>): List<ScanFilter> {
return filters.map {
ScanFilter.Builder().apply {
setDeviceName(it.deviceName)
it.deviceName?.let { deviceName ->
setDeviceName(deviceName)
}
it.deviceAddress?.let { deviceAddress ->
setDeviceAddress(deviceAddress)
}
Expand Down
27 changes: 9 additions & 18 deletions app/build.gradle
Expand Up @@ -5,19 +5,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
signingConfigs {
release {
keyAlias 'Algorigo'
keyPassword project.property("keyPassword")
storeFile file(project.property("storeFile"))
storePassword project.property("storePassword")
}
}
compileSdkVersion 29
compileSdkVersion 30
defaultConfig {
applicationId "com.algorigo.algorigoblelibrary"
minSdkVersion 18
targetSdkVersion 29
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -26,19 +18,18 @@ android {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

implementation 'androidx.recyclerview:recyclerview:1.1.0'

Expand All @@ -47,5 +38,5 @@ dependencies {
//ReactiveX
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
//ReactiveX Relay
implementation 'com.jakewharton.rxrelay2:rxrelay:2.1.0'
implementation 'com.jakewharton.rxrelay2:rxrelay:2.1.1'
}
Expand Up @@ -87,7 +87,7 @@ class MainActivity : AppCompatActivity() {
// 권한이 없음 -> 퍼미션을 요구
PermissionUtil.requestExternalPermissions(
this,
Manifest.permission.ACCESS_COARSE_LOCATION,
arrayOf(Manifest.permission.ACCESS_BACKGROUND_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION),
REQUEST_CODE
)
}
Expand Down

0 comments on commit b8547eb

Please sign in to comment.