mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-23 09:22:53 +08:00
refactor: gradle cleanup (#1253)
* refactor: move androidx.webkit version to cdv-gradle-config-defaults * chore: remove unnecessary cordova.gradle apply * refactor: maven publish to use version info from package.json * refactor: separate framwork publishing outside of app dev scope
This commit is contained in:
parent
facffb0809
commit
e8cbeaaa1b
@ -16,10 +16,6 @@
|
|||||||
under the License.
|
under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ext {
|
|
||||||
apply from: 'cordova.gradle'
|
|
||||||
}
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
apply from: 'cordova.gradle'
|
apply from: 'cordova.gradle'
|
||||||
apply from: 'repositories.gradle'
|
apply from: 'repositories.gradle'
|
||||||
@ -38,7 +34,6 @@ allprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.android.library'
|
apply plugin: 'com.android.library'
|
||||||
apply plugin: 'maven-publish'
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion cordovaConfig.SDK_VERSION
|
compileSdkVersion cordovaConfig.SDK_VERSION
|
||||||
@ -74,59 +69,17 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task sourcesJar(type: Jar) {
|
|
||||||
from android.sourceSets.main.java.srcDirs
|
|
||||||
classifier = 'sources'
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
Cordova(MavenPublication) {
|
|
||||||
groupId = 'org.apache.cordova'
|
|
||||||
artifactId = 'framework'
|
|
||||||
version = '10.0.0-dev'
|
|
||||||
|
|
||||||
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'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
developers {
|
|
||||||
developer {
|
|
||||||
id = 'stevengill'
|
|
||||||
name = 'Steve Gill'
|
|
||||||
}
|
|
||||||
developer {
|
|
||||||
id = 'erisu'
|
|
||||||
name = 'Bryan Ellis'
|
|
||||||
email = 'erisu@apache.org'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
scm {
|
|
||||||
connection = 'scm:git:https://github.com/apache/cordova-android.git'
|
|
||||||
developerConnection = 'scm:git:git@github.com:apache/cordova-android.git'
|
|
||||||
url = 'https://github.com/apache/cordova-android'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "androidx.appcompat:appcompat:${cordovaConfig.ANDROIDX_APP_COMPAT_VERSION}"
|
implementation "androidx.appcompat:appcompat:${cordovaConfig.ANDROIDX_APP_COMPAT_VERSION}"
|
||||||
|
implementation "androidx.webkit:webkit:${cordovaConfig.ANDROIDX_WEBKIT_VERSION}"
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
/**
|
||||||
implementation 'androidx.webkit:webkit:1.3.0'
|
* In a project created though CLI, the `cordova-publish.gradle` file is not copied to the `framework` dir.
|
||||||
|
* App development (CLI) projects can not and should not publish our framework.
|
||||||
|
* In this case, there is no need for the gradle build process to know about the publish process.
|
||||||
|
*/
|
||||||
|
def cordovaPublishGradle = './cordova-publish.gradle'
|
||||||
|
if(file(cordovaPublishGradle).exists()) {
|
||||||
|
apply from: cordovaPublishGradle
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
"AGP_VERSION": "4.2.1",
|
"AGP_VERSION": "4.2.1",
|
||||||
"KOTLIN_VERSION": "1.4.32",
|
"KOTLIN_VERSION": "1.4.32",
|
||||||
"ANDROIDX_APP_COMPAT_VERSION": "1.2.0",
|
"ANDROIDX_APP_COMPAT_VERSION": "1.2.0",
|
||||||
|
"ANDROIDX_WEBKIT_VERSION": "1.3.0",
|
||||||
"GRADLE_PLUGIN_GOOGLE_SERVICES_VERSION": "4.3.5",
|
"GRADLE_PLUGIN_GOOGLE_SERVICES_VERSION": "4.3.5",
|
||||||
"IS_GRADLE_PLUGIN_GOOGLE_SERVICES_ENABLED": false,
|
"IS_GRADLE_PLUGIN_GOOGLE_SERVICES_ENABLED": false,
|
||||||
"IS_GRADLE_PLUGIN_KOTLIN_ENABLED": false
|
"IS_GRADLE_PLUGIN_KOTLIN_ENABLED": false
|
||||||
|
79
framework/cordova-publish.gradle
Normal file
79
framework/cordova-publish.gradle
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
distributed with this work for additional information
|
||||||
|
regarding copyright ownership. The ASF licenses this file
|
||||||
|
to you under the Apache License, Version 2.0 (the
|
||||||
|
"License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the License is distributed on an
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations
|
||||||
|
under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
|
String getCordovaAndroidVersion() {
|
||||||
|
// Fetch Data from Cordova-Android package.json (Used only by framework build/publishing)
|
||||||
|
def cordovaAndroidRepoPackageJson = "$projectDir/../package.json"
|
||||||
|
if(file(cordovaAndroidRepoPackageJson).exists()) {
|
||||||
|
def packageJsonFile = new File(cordovaAndroidRepoPackageJson)
|
||||||
|
def packageJson = new groovy.json.JsonSlurper().parseText(packageJsonFile.text)
|
||||||
|
return packageJson.version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task sourcesJar(type: Jar) {
|
||||||
|
from android.sourceSets.main.java.srcDirs
|
||||||
|
classifier = 'sources'
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
Cordova(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'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
developers {
|
||||||
|
developer {
|
||||||
|
id = 'stevengill'
|
||||||
|
name = 'Steve Gill'
|
||||||
|
}
|
||||||
|
developer {
|
||||||
|
id = 'erisu'
|
||||||
|
name = 'Bryan Ellis'
|
||||||
|
email = 'erisu@apache.org'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
scm {
|
||||||
|
connection = 'scm:git:https://github.com/apache/cordova-android.git'
|
||||||
|
developerConnection = 'scm:git:git@github.com:apache/cordova-android.git'
|
||||||
|
url = 'https://github.com/apache/cordova-android'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user