This is an automated email from the ASF dual-hosted git repository.

erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-android.git


The following commit(s) were added to refs/heads/master by this push:
     new 80f232aa fix: correctly flag API dependency on AppCompat for Maven 
(#1505)
80f232aa is described below

commit 80f232aa79a8583da471256c92d4bfd6a0b66e52
Author: Darryl Pogue <[email protected]>
AuthorDate: Fri Oct 14 21:39:47 2022 -0700

    fix: correctly flag API dependency on AppCompat for Maven (#1505)
    
    * Correctly flag API dependency on AppCompat for Maven
    
    Currently when cordova-android is published to Maven, it lists no
    dependencies. However, `CordovaActivity` extends `AppCompatActivity`
    which requires that the AndroidX AppCompat library be available.
    
    Marking this as an API dependency (rather than an implementation/compile
    dependency) should cause the AndroidX AppCompat library to be installed
    when the cordova-android framework is added to the build.gradle of an
    existing Android application.
    
    * Publish to Maven with proper metadata
    
    This allows the Maven publish to pick up information from the android
    library component and include things like dependencies in the pom.xml
    file.
---
 framework/build.gradle           |   8 ++-
 framework/cordova-publish.gradle | 102 +++++++++++++++++++--------------------
 2 files changed, 56 insertions(+), 54 deletions(-)

diff --git a/framework/build.gradle b/framework/build.gradle
index 8fcf4b59..05b0f7ae 100644
--- a/framework/build.gradle
+++ b/framework/build.gradle
@@ -75,10 +75,16 @@ android {
         exclude 'META-INF/DEPENDENCIES'
         exclude 'META-INF/NOTICE'
     }
+
+    publishing {
+        singleVariant('release') {
+            withSourcesJar()
+        }
+    }
 }
 
 dependencies {
-    implementation 
"androidx.appcompat:appcompat:${cordovaConfig.ANDROIDX_APP_COMPAT_VERSION}"
+    api 
"androidx.appcompat:appcompat:${cordovaConfig.ANDROIDX_APP_COMPAT_VERSION}"
     implementation 
"androidx.webkit:webkit:${cordovaConfig.ANDROIDX_WEBKIT_VERSION}"
     implementation 
"androidx.core:core-splashscreen:${cordovaConfig.ANDROIDX_CORE_SPLASHSCREEN_VERSION}"
 }
diff --git a/framework/cordova-publish.gradle b/framework/cordova-publish.gradle
index 30d9e4e0..99163cc2 100644
--- a/framework/cordova-publish.gradle
+++ b/framework/cordova-publish.gradle
@@ -46,73 +46,69 @@ if (project.hasProperty('signEnabled')) {
     }
 }
 
-task sourcesJar(type: Jar) {
-    from android.sourceSets.main.java.srcDirs
-    classifier = 'sources'
-}
-
-publishing {
-    publications {
-        mavenJava(MavenPublication) {
-            groupId = 'org.apache.cordova'
-            artifactId = 'framework'
-            version = getCordovaAndroidVersion()
-
-            artifact(sourcesJar)
-            artifact("$buildDir/outputs/aar/framework-release.aar")
-
-            pom {
-                name = 'Cordova'
-                description = 'A library to build Cordova-based projects for 
the Android platform.'
-                url = 'https://cordova.apache.org'
-
-                licenses {
-                    license {
-                        name = 'Apache License, Version 2.0'
-                        url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
+afterEvaluate {
+    publishing {
+        publications {
+            mavenJava(MavenPublication) {
+                groupId = 'org.apache.cordova'
+                artifactId = 'framework'
+                version = getCordovaAndroidVersion()
+
+                from components.release
+
+                pom {
+                    name = 'Cordova'
+                    description = 'A library to build Cordova-based projects 
for the Android platform.'
+                    url = 'https://cordova.apache.org'
+
+                    licenses {
+                        license {
+                            name = 'Apache License, Version 2.0'
+                            url = 
'https://www.apache.org/licenses/LICENSE-2.0.txt'
+                        }
                     }
-                }
 
-                developers {
-                    developer {
-                        id = 'stevengill'
-                        name = 'Steve Gill'
+                    developers {
+                        developer {
+                            id = 'stevengill'
+                            name = 'Steve Gill'
+                        }
+                        developer {
+                            id = 'erisu'
+                            name = 'Bryan Ellis'
+                            email = '[email protected]'
+                        }
                     }
-                    developer {
-                        id = 'erisu'
-                        name = 'Bryan Ellis'
-                        email = '[email protected]'
-                    }
-                }
 
-                scm {
-                    connection = 
'scm:git:https://github.com/apache/cordova-android.git'
-                    developerConnection = 
'scm:git:[email protected]:apache/cordova-android.git'
-                    url = 'https://github.com/apache/cordova-android'
+                    scm {
+                        connection = 
'scm:git:https://github.com/apache/cordova-android.git'
+                        developerConnection = 
'scm:git:[email protected]:apache/cordova-android.git'
+                        url = 'https://github.com/apache/cordova-android'
+                    }
                 }
             }
         }
-    }
 
-    repositories {
-        maven {
-            def releasesRepoUrl = 
'https://repository.apache.org/content/repositories/releases'
-            def snapshotsRepoUrl = 
'https://repository.apache.org/content/repositories/snapshots'
+        repositories {
+            maven {
+                def releasesRepoUrl = 
'https://repository.apache.org/content/repositories/releases'
+                def snapshotsRepoUrl = 
'https://repository.apache.org/content/repositories/snapshots'
 
-            url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : 
releasesRepoUrl
+                url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : 
releasesRepoUrl
 
-            credentials {
-                if (project.hasProperty('apacheUsername') && 
project.hasProperty('apachePassword')) {
-                    username apacheUsername
-                    password apachePassword
+                credentials {
+                    if (project.hasProperty('apacheUsername') && 
project.hasProperty('apachePassword')) {
+                        username apacheUsername
+                        password apachePassword
+                    }
                 }
             }
         }
-    }
 
-    signing {
-        if (Boolean.valueOf(cdvEnableSigning)) {
-            sign publishing.publications.mavenJava
+        signing {
+            if (Boolean.valueOf(cdvEnableSigning)) {
+                sign publishing.publications.mavenJava
+            }
         }
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to