Browse Source

add mavenCenter Repository

kongzue 2 years ago
parent
commit
66c9c42b5a

+ 3 - 3
.idea/encodings.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
-  <component name="Encoding">
-    <file url="file://$PROJECT_DIR$/DialogXInterface/src/main/java/com/kongzue/dialogx/interfaces/ProgressViewInterface.java" charset="GBK" />
-    <file url="file://$PROJECT_DIR$/DialogXStyleInterface/src/main/java/com/kongzue/dialogx/interfaces/ProgressViewInterface.java" charset="GBK" />
+  <component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
+    <file url="file://$PROJECT_DIR$/DialogXInterface/src/main/java/com/kongzue/dialogx/interfaces/ProgressViewInterface.java" charset="UTF-8" />
+    <file url="PROJECT" charset="UTF-8" />
   </component>
 </project>

+ 1 - 1
.idea/gradle.xml

@@ -7,7 +7,7 @@
         <option name="testRunner" value="GRADLE" />
         <option name="distributionType" value="DEFAULT_WRAPPED" />
         <option name="externalProjectPath" value="$PROJECT_DIR$" />
-        <option name="gradleJvm" value="1.8 (2)" />
+        <option name="gradleJvm" value="Embedded JDK" />
         <option name="modules">
           <set>
             <option value="$PROJECT_DIR$" />

+ 5 - 0
.idea/jarRepositories.xml

@@ -46,5 +46,10 @@
       <option name="name" value="maven2" />
       <option name="url" value="https://artifact.bytedance.com/repository/pangle" />
     </remote-repository>
+    <remote-repository>
+      <option name="id" value="maven" />
+      <option name="name" value="maven" />
+      <option name="url" value="https://www.jitpack.io" />
+    </remote-repository>
   </component>
 </project>

+ 1 - 1
.idea/misc.xml

@@ -347,7 +347,7 @@
       </value>
     </option>
   </component>
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8 (2)" project-jdk-type="JavaSDK">
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="11" project-jdk-type="JavaSDK">
     <output url="file://$PROJECT_DIR$/build/classes" />
   </component>
   <component name="ProjectType">

+ 9 - 2
DialogX/build.gradle

@@ -3,6 +3,13 @@ apply plugin: 'com.android.library'
 group = "com.kongzue.dialogx"
 version = BUILD_VERSION
 
+ext {
+    PUBLISH_GROUP_ID = "com.kongzue.dialogx"		//项目包名
+    PUBLISH_ARTIFACT_ID = 'DialogX'			//项目名
+    PUBLISH_VERSION = BUILD_VERSION					//版本号
+}
+apply from: "${rootProject.projectDir}/publish-mavencentral.gradle"
+
 android {
     compileSdkVersion 30
 
@@ -30,8 +37,8 @@ artifacts {
     archives sourcesJar
 }
 dependencies {
-    implementation 'androidx.appcompat:appcompat:1.3.0+'
-    implementation 'androidx.constraintlayout:constraintlayout:2.0.4+'
+    implementation 'androidx.appcompat:appcompat:1.3.0'
+    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
     compileOnly files('libs\\androidx-rs.jar')
     api files('libs\\DialogXInterface.jar')
 }

+ 8 - 0
DialogXIOSStyle/build.gradle

@@ -3,6 +3,14 @@ apply plugin: 'com.android.library'
 group = "com.kongzue.dialogx.style.ios"
 version = BUILD_VERSION
 
+
+ext {
+    PUBLISH_GROUP_ID = "com.kongzue.dialogx.style"		//项目包名
+    PUBLISH_ARTIFACT_ID = 'DialogXIOSStyle'			//项目名
+    PUBLISH_VERSION = BUILD_VERSION					//版本号
+}
+apply from: "${rootProject.projectDir}/publish-mavencentral.gradle"
+
 android {
     compileSdkVersion 30
 

+ 2 - 0
DialogXInterface/build.gradle

@@ -1,5 +1,7 @@
 apply plugin: 'java-library'
 
+
+
 dependencies {
     //implementation fileTree(dir: 'libs', include: ['*.jar'])
     compileOnly files('libs\\android.jar')

+ 7 - 0
DialogXKongzueStyle/build.gradle

@@ -3,6 +3,13 @@ apply plugin: 'com.android.library'
 group = "com.kongzue.dialogx.style.kongzue"
 version = BUILD_VERSION
 
+ext {
+    PUBLISH_GROUP_ID = "com.kongzue.dialogx.style"		//项目包名
+    PUBLISH_ARTIFACT_ID = 'DialogXKongzueStyle'			//项目名
+    PUBLISH_VERSION = BUILD_VERSION					//版本号
+}
+apply from: "${rootProject.projectDir}/publish-mavencentral.gradle"
+
 android {
     compileSdkVersion 30
 

+ 6 - 0
DialogXMIUIStyle/build.gradle

@@ -2,6 +2,12 @@ apply plugin: 'com.android.library'
 
 group = "com.kongzue.dialogx.style.miui"
 version = BUILD_VERSION
+ext {
+    PUBLISH_GROUP_ID = "com.kongzue.dialogx.style"		//项目包名
+    PUBLISH_ARTIFACT_ID = 'DialogXMIUIStyle'			//项目名
+    PUBLISH_VERSION = BUILD_VERSION					//版本号
+}
+apply from: "${rootProject.projectDir}/publish-mavencentral.gradle"
 
 android {
     compileSdkVersion 30

+ 8 - 1
DialogXMaterialYou/build.gradle

@@ -2,6 +2,13 @@ plugins {
     id 'com.android.library'
 }
 
+ext {
+    PUBLISH_GROUP_ID = "com.kongzue.dialogx.style"		//项目包名
+    PUBLISH_ARTIFACT_ID = 'DialogXMaterialYouStyle'			//项目名
+    PUBLISH_VERSION = BUILD_VERSION					//版本号
+}
+apply from: "${rootProject.projectDir}/publish-mavencentral.gradle"
+
 android {
     compileSdkVersion 30
 
@@ -28,6 +35,6 @@ android {
 
 dependencies {
     implementation project(path: ':DialogX')
-    implementation 'com.google.android.material:material:1.3.0+'
+    implementation 'com.google.android.material:material:1.3.0'
     compileOnly project(path: ':DialogXInterface')
 }

+ 30 - 0
README.md

@@ -127,6 +127,36 @@ DialogX 采用了主题分离结构,主框架仅包含 Material 设计风格
 
 ### 📥引入
 
+#### mavenCenter 源
+
+<div>
+<b>最新版本:</b>
+<a href="https://github.com/kongzue/DialogX/releases"><img src="https://img.shields.io/github/v/release/kongzue/DialogX?color=green" alt="查看最新编译版本"></a> 
+</div>
+
+1) 在 project 的 build.gradle 文件中找到 `allprojects{}` 代码块添加以下代码:
+
+```
+allprojects {
+    repositories {
+        google()
+        jcenter()
+        mavenCentral()      //增加 mavenCentral 仓库
+    }
+}
+```
+
+⚠️请注意,使用 Android Studio 北极狐版本(Arctic Fox)创建的项目,需要您前往 settings.gradle 添加上述 jitpack 仓库配置。
+
+2) 在 app 的 build.gradle 文件中找到 `dependencies{}` 代码块,并在其中加入以下语句:
+
+```
+def dialogx_version = "0.0.47.beta13"
+implementation "com.kongzue.dialogx:DialogX::${dialogx_version}"
+```
+
+#### Jitpack 源
+
 <div>
 <b>最新版本:</b>
 <a href="https://jitpack.io/#kongzue/DialogX"><img src="https://jitpack.io/v/kongzue/DialogX.svg" alt="Jitpack.io"></a> <a href="https://github.com/kongzue/DialogX/releases"><img src="https://img.shields.io/github/v/release/kongzue/DialogX?color=green" alt="查看最新编译版本"></a> 

+ 2 - 0
build.gradle

@@ -3,6 +3,7 @@ buildscript {
     repositories {
         google()
         jcenter()
+        mavenCentral()
         maven{
             url 'https://jitpack.io'
         }
@@ -20,6 +21,7 @@ allprojects {
     repositories {
         google()
         jcenter()
+        mavenCentral()
         maven{
             url 'https://jitpack.io'
         }

+ 3 - 3
gradle/wrapper/gradle-wrapper.properties

@@ -1,6 +1,6 @@
-#Tue Jan 26 19:13:49 CST 2021
+#Thu Dec 22 18:17:29 CST 2022
 distributionBase=GRADLE_USER_HOME
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
 distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
+zipStoreBase=GRADLE_USER_HOME

+ 105 - 0
publish-mavencentral.gradle

@@ -0,0 +1,105 @@
+apply plugin: 'maven-publish'
+apply plugin: 'signing'
+
+task androidSourcesJar(type: Jar) {
+    classifier = 'sources'
+    from android.sourceSets.main.java.source
+}
+
+ext["signing.keyId"] = ''
+ext["signing.password"] = ''
+ext["signing.secretKeyRingFile"] = ''
+ext["ossrhUsername"] = ''
+ext["ossrhPassword"] = ''
+
+File secretPropsFile = project.rootProject.file('local.properties')
+if (secretPropsFile.exists()) {
+    println "Found secret props file, loading props"
+    Properties p = new Properties()
+    p.load(new FileInputStream(secretPropsFile))
+    p.each { name, value ->
+        ext[name] = value
+    }
+} else {
+    println "No props file, loading env vars"
+}
+publishing {
+    publications {
+        release(MavenPublication) {
+            // The coordinates of the library, being set from variables that
+            // we'll set up in a moment
+            groupId PUBLISH_GROUP_ID
+            artifactId PUBLISH_ARTIFACT_ID
+            version PUBLISH_VERSION
+
+            // Two artifacts, the `aar` and the sources
+            artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
+            artifact androidSourcesJar
+
+            // Self-explanatory metadata for the most part
+            pom {
+                name = PUBLISH_ARTIFACT_ID
+                description = 'Kongzue DialogX'
+                // If your project has a dedicated site, use its URL here
+                url = 'https://github.com/kongzue/DialogX/'
+                licenses {
+                    license {
+                        //协议类型,一般默认Apache License2.0的话不用改:
+                        name = 'The Apache License, Version 2.0'
+                        url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+                    }
+                }
+                developers {
+                    developer {
+                        id = 'kongzue'
+                        name = 'kongzue'
+                        email = 'myzcxhh@live.cn'
+                    }
+                }
+                // Version control info, if you're using GitHub, follow the format as seen here
+                scm {
+                    //修改成你的Git地址:
+                    connection = 'scm:git:github.com/kongzue/DialogX.git'
+                    developerConnection = 'scm:git:ssh://github.com/kongzue/DialogX.git'
+                    //分支地址:
+                    url = 'https://github.com/kongzue/DialogX/tree/master'
+                }
+                // A slightly hacky fix so that your POM will include any transitive dependencies
+                // that your library builds upon
+                withXml {
+                    def dependenciesNode = asNode().appendNode('dependencies')
+
+                    project.configurations.implementation.allDependencies.each {
+                        def dependencyNode = dependenciesNode.appendNode('dependency')
+                        dependencyNode.appendNode('groupId', it.group)
+                        dependencyNode.appendNode('artifactId', it.name)
+                        dependencyNode.appendNode('version', it.version)
+                    }
+                }
+            }
+        }
+    }
+    repositories {
+        // The repository to publish to, Sonatype/MavenCentral
+        maven {
+            // This is an arbitrary name, you may also use "mavencentral" or
+            // any other name that's descriptive for you
+            name = "DialogX"
+
+            def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
+            def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
+            // You only need this if you want to publish snapshots, otherwise just set the URL
+            // to the release repo directly
+            url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
+
+            // The username and password we've fetched earlier
+            credentials {
+                username ossrhUsername
+                password ossrhPassword
+            }
+        }
+    }
+}
+signing {
+    sign publishing.publications
+}