123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- apply plugin: 'com.android.library'
- apply plugin: 'maven-publish'
- apply plugin: 'signing'
- ext.artifactId = 'zxing-android-embedded'
- ext["signing.keyId"] = ''
- ext["signing.password"] = ''
- ext["signing.secretKeyRingFile"] = ''
- ext["ossrhUsername"] = ''
- ext["ossrhPassword"] = ''
- ext["sonatypeStagingProfileId"] = ''
- File secretPropsFile = project.rootProject.file('local.properties')
- if (secretPropsFile.exists()) {
- Properties p = new Properties()
- p.load(new FileInputStream(secretPropsFile))
- p.each { name, value ->
- ext[name] = value
- }
- } else {
- ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
- ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
- ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE')
- ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
- ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
- ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
- }
- dependencies {
- api project.zxingCore
- implementation 'androidx.core:core:1.6.0'
- implementation 'androidx.fragment:fragment:1.3.6'
- testImplementation 'junit:junit:4.13.1'
- testImplementation 'org.mockito:mockito-core:1.9.5'
- implementation 'com.geyifeng.immersionbar:immersionbar:3.2.2'
- }
- android {
- resourcePrefix 'zxing_'
- compileSdkVersion project.androidTargetSdk
- sourceSets {
- main {
- manifest.srcFile 'AndroidManifest.xml'
- java.srcDirs = ['src']
- res.srcDirs = ['res']
- assets.srcDirs = ['assets']
- }
- test.setRoot('test')
- }
- // This is bad practice - we should fix the warnings instead.
- lintOptions {
- // Android warns about the he and id locale folders. he -> iw is already handled with a
- // symlink. TODO: what about id?
- disable 'LocaleFolder'
- }
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
- testOptions {
- // We test with primitives such as Rect, and rely on their default behaviour working.
- unitTests.returnDefaultValues = true
- }
- defaultConfig {
- minSdkVersion 19
- }
- buildTypes {
- debug {
- versionNameSuffix ".debug"
- resValue "string", "app_version", "${defaultConfig.versionName}${versionNameSuffix}"
- }
- release {
- resValue "string", "app_version", "${defaultConfig.versionName}"
- }
- }
- }
- task sourceJar(type: Jar) {
- classifier = 'sources'
- from android.sourceSets.main.java.srcDirs
- }
- project.afterEvaluate {
- publishing {
- publications {
- maven(MavenPublication) {
- artifact bundleReleaseAar
- artifactId project.artifactId
- artifact sourceJar
-
- pom {
- name = project.artifactId
- description = 'Barcode scanner library for Android, based on the ZXing decoder'
- url = 'https://github.com/journeyapps/zxing-android-embedded'
- licenses {
- license {
- name = 'The Apache License, Version 2.0'
- url = 'https://github.com/journeyapps/zxing-android-embedded/blob/master/COPYING'
- }
- }
- developers {
- developer {
- id = ''
- name = 'Ralf Kistner'
- email = 'ralf@journeyapps.com'
- organization = 'Journey Mobile, Inc'
- organizationUrl = 'https://journeyapps.com'
- }
- }
- scm {
- connection = 'scm:git:github.com/journeyapps/zxing-android-embedded.git'
- developerConnection = 'scm:git:ssh://github.com/journeyapps/zxing-android-embedded.git'
- url = 'https://github.com/journeyapps/zxing-android-embedded'
- }
- }
- pom.withXml {
- // HACK to add dependencies to POM.
- // When maven-publish can do this automatically for Android projects,
- // remove this section.
- def deps = asNode().appendNode('dependencies')
- project.configurations.api.allDependencies.each { dep ->
- def node = deps.appendNode('dependency')
- node.appendNode('groupId', dep.group)
- node.appendNode('artifactId', dep.name)
- node.appendNode('version', dep.version)
- node.appendNode('scope', 'api')
- }
- }
- }
- }
- repositories {
- maven {
- name = "sonatype"
- url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
- credentials {
- username ossrhUsername
- password ossrhPassword
- }
- }
- }
- }
- }
- signing {
- sign publishing.publications
- }
|