From 1d94b42073e8cc2dd18b386da76fa6da92ae580b Mon Sep 17 00:00:00 2001 From: luotinghui Date: Wed, 8 Dec 2021 02:08:51 +0800 Subject: [PATCH] update maven --- build.gradle | 8 +++-- iconfont-app/build.gradle | 7 ++-- iconfont-assets/build.gradle | 19 +++++++++-- .../open.source.iconfont.assets.properties | 1 - iconfont/build.gradle | 34 +++++++++++++++++-- 5 files changed, 58 insertions(+), 11 deletions(-) delete mode 100644 iconfont-assets/src/main/java/resources/META-INF/gradle-plugins/open.source.iconfont.assets.properties diff --git a/build.gradle b/build.gradle index e4da491..fe8bc72 100644 --- a/build.gradle +++ b/build.gradle @@ -9,10 +9,12 @@ buildscript { dependencies { classpath "com.android.tools.build:gradle:4.1.1" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } + ext { + groupId = 'open.source.iconfont' + } } allprojects { @@ -25,4 +27,6 @@ allprojects { task clean(type: Delete) { delete rootProject.buildDir -} \ No newline at end of file +} + + diff --git a/iconfont-app/build.gradle b/iconfont-app/build.gradle index 67f211d..2459bac 100644 --- a/iconfont-app/build.gradle +++ b/iconfont-app/build.gradle @@ -1,7 +1,6 @@ -plugins { - id 'com.android.application' - id 'kotlin-android' -} +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +//apply plugin: 'open.source.iconfont.assets' android { compileSdkVersion 30 diff --git a/iconfont-assets/build.gradle b/iconfont-assets/build.gradle index e3250f0..5b6b216 100644 --- a/iconfont-assets/build.gradle +++ b/iconfont-assets/build.gradle @@ -1,8 +1,9 @@ apply plugin: 'java-gradle-plugin' apply plugin: 'groovy' apply plugin: 'maven' -version = '1.0.0' -group = 'open.source.iconfont' +apply plugin: 'maven-publish' +def NAME = 'iconfont-assets' +def VERSION = '1.0' java { sourceCompatibility = JavaVersion.VERSION_1_7 @@ -14,3 +15,17 @@ dependencies { implementation 'com.google.code.gson:gson:2.8.6' implementation 'com.squareup.retrofit2:converter-gson:2.9.0' } + +afterEvaluate { + publishing { + publications { + // Creates a Maven publication called "release". + release(MavenPublication) { + from components.java + groupId = rootProject.ext.groupId + artifactId = NAME + version = VERSION + } + } + } +} \ No newline at end of file diff --git a/iconfont-assets/src/main/java/resources/META-INF/gradle-plugins/open.source.iconfont.assets.properties b/iconfont-assets/src/main/java/resources/META-INF/gradle-plugins/open.source.iconfont.assets.properties deleted file mode 100644 index eb95f41..0000000 --- a/iconfont-assets/src/main/java/resources/META-INF/gradle-plugins/open.source.iconfont.assets.properties +++ /dev/null @@ -1 +0,0 @@ -implementation-class=open.source.iconfont.assets.GenAssetsPlugin \ No newline at end of file diff --git a/iconfont/build.gradle b/iconfont/build.gradle index 78b2868..924b635 100644 --- a/iconfont/build.gradle +++ b/iconfont/build.gradle @@ -1,8 +1,12 @@ plugins { id 'com.android.library' id 'kotlin-android' + id 'maven-publish' } +def NAME = 'iconfont' +def VERSION = '1.0' + android { compileSdkVersion 30 buildToolsVersion "30.0.3" @@ -33,10 +37,36 @@ android { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation 'androidx.appcompat:appcompat:1.1.0' testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' -} \ No newline at end of file +} + + +afterEvaluate { + publishing { + publications { + // Creates a Maven publication called "release". + release(MavenPublication) { + // Applies the component for the release build variant. + from components.release + + // You can then customize attributes of the publication as shown below. + groupId = rootProject.ext.groupId + artifactId = NAME + version = VERSION + } + // Creates a Maven publication called “debug”. + debug(MavenPublication) { + // Applies the component for the debug build variant. + from components.debug + + groupId = rootProject.ext.groupId + artifactId = NAME + '-debug' + version = VERSION + } + } + } +}