diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..c6f29d6 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index f1cb63f..98b3516 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ generate stylized QR code based on ZXing ## Usage +### Add into project + +```groovy + implementation 'io.arcblock.forge:stylize_qr:$version' + implementation 'com.google.zxing:core:3.3.3' +``` ### Basic Dot Style QRCode diff --git a/app/build.gradle b/app/build.gradle index 62cad1c..22f8e4a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -35,6 +35,9 @@ android { dependencies { implementation project(':stylize_qr') +// implementation 'io.arcblock:stylize_qr:1.0.0' + implementation 'com.google.zxing:core:3.3.3' + implementation 'androidx.core:core-ktx:1.7.0' implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'com.google.android.material:material:1.5.0' diff --git a/build.gradle b/build.gradle index 77c92f8..da30fca 100644 --- a/build.gradle +++ b/build.gradle @@ -7,4 +7,20 @@ plugins { task clean(type: Delete) { delete rootProject.buildDir +} + + + +allprojects { + repositories { + google() + mavenCentral() + maven { + url = uri("https://maven.pkg.github.com/arcblock/StylizeQRCode") + credentials { + username = project.findProperty("gpr.user") ?: System.getenv("USERNAME") + password = project.findProperty("gpr.key") ?: System.getenv("TOKEN") + } + } + } } \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 0ad9309..4a2f69e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -5,13 +5,6 @@ pluginManagement { mavenCentral() } } -dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) - repositories { - google() - mavenCentral() - } -} rootProject.name = "StylizeQR" include ':app' include ':stylize_qr' diff --git a/stylize_qr/build.gradle b/stylize_qr/build.gradle index 3347746..4e56c3b 100644 --- a/stylize_qr/build.gradle +++ b/stylize_qr/build.gradle @@ -2,8 +2,9 @@ plugins { id 'com.android.library' id 'org.jetbrains.kotlin.android' id 'maven-publish' + id 'signing' } -group='io.arcblock' +group='io.arcblock.forge' def getArtificatId = { -> return "stylize_qr" @@ -12,6 +13,15 @@ def getVersionName = { -> return System.getenv('TAG_NAME') ?: "1.0.0" } + +def snapshotRepositoryUrl = hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL + : "https://oss.sonatype.org/content/repositories/snapshots/" + +def repositoryUsername = project.findProperty("nexus.username") ?: hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "" + +def repositoryPassword = project.findProperty("nexus.pw") ?: hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "" + + android { compileSdk 31 @@ -51,37 +61,57 @@ task sourceJar(type: Jar) { from android.sourceSets.main.java.srcDirs archiveClassifier.set("sources") } +signing { + sign publishing.publications +} publishing { repositories { + // maven { + // name = "GitHubPackages" + // url = uri("https://maven.pkg.github.com/ArcBlock/StylizeQRCode") + // credentials { + // username = project.findProperty("gpr.user") ?: System.getenv("USERNAME") + // password = project.findProperty("gpr.key") ?: System.getenv("TOKEN") + // } maven { - name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/ArcBlock/StylizeQRCode") + url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2") credentials { - username = project.findProperty("gpr.user") ?: System.getenv("USERNAME") - password = project.findProperty("gpr.key") ?: System.getenv("TOKEN") + username = repositoryUsername + password = repositoryPassword } } } publications { maven(MavenPublication) { - groupId group + groupId 'io.arcblock.forge' artifactId getArtificatId() version getVersionName() artifact("$buildDir/outputs/aar/${getArtificatId()}-release.aar") pom { - withXml { - def dependenciesNode = asNode().appendNode('dependencies') - project.configurations.implementation.allDependencies.each { - if (it.group != null || it.name != null || it.version != null || it.name == "unspecified") return - - def dependencyNode = dependenciesNode.appendNode('dependency') - dependencyNode.appendNode('groupId', it.group) - dependencyNode.appendNode('artifactId', it.name) - dependencyNode.appendNode('version', it.version) + name = artifactId + description = "android sdk base on zxing to generate stylize QR code" + url = 'https://github.com/ArcBlock/StylizeQRCode' + licenses { + license { + name = 'The Apache Software License, Version 2.0' + url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + id = 'paper' + name = 'paper' + email = 'paper@arcblock.io' } } + scm { + connection = 'scm:git:git://github.com/ArcBlock/StylizeQRCode.git' + developerConnection = 'scm:git:ssh://git@github.com/ArcBlock/StylizeQRCode.git' + url = 'https://github.com/ArcBlock/StylizeQRCode' + } + } } }