Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upload to maven #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .idea/jarRepositories.xml

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

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
16 changes: 16 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
}
}
7 changes: 0 additions & 7 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
60 changes: 45 additions & 15 deletions stylize_qr/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

Expand Down Expand Up @@ -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 = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/ArcBlock/StylizeQRCode.git'
developerConnection = 'scm:git:ssh://[email protected]/ArcBlock/StylizeQRCode.git'
url = 'https://github.com/ArcBlock/StylizeQRCode'
}

}
}
}
Expand Down