mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 07:02:51 +08:00
80f232aa79
* 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.
101 lines
3.1 KiB
Groovy
101 lines
3.1 KiB
Groovy
/* 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.
|
|
*/
|
|
|
|
buildscript {
|
|
apply from: 'cordova.gradle'
|
|
apply from: 'repositories.gradle'
|
|
|
|
repositories repos
|
|
|
|
dependencies {
|
|
// Android Gradle Plugin (AGP) Build Tools
|
|
classpath "com.android.tools.build:gradle:${cordovaConfig.AGP_VERSION}"
|
|
}
|
|
|
|
cdvHelpers.verifyCordovaConfigForBuild()
|
|
}
|
|
|
|
allprojects {
|
|
def hasRepositoriesGradle = file('repositories.gradle').exists()
|
|
if (hasRepositoriesGradle) {
|
|
apply from: 'repositories.gradle'
|
|
} else {
|
|
apply from: "${project.rootDir}/repositories.gradle"
|
|
}
|
|
|
|
repositories repos
|
|
}
|
|
|
|
apply plugin: 'com.android.library'
|
|
|
|
android {
|
|
compileSdkVersion cordovaConfig.COMPILE_SDK_VERSION
|
|
buildToolsVersion cordovaConfig.BUILD_TOOLS_VERSION
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
}
|
|
|
|
// For the Android Cordova Lib, we allow changing the minSdkVersion, but it is at the users own risk
|
|
defaultConfig {
|
|
minSdkVersion cordovaConfig.MIN_SDK_VERSION
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
manifest.srcFile 'AndroidManifest.xml'
|
|
java.srcDirs = ['src']
|
|
resources.srcDirs = ['src']
|
|
aidl.srcDirs = ['src']
|
|
renderscript.srcDirs = ['src']
|
|
res.srcDirs = ['res']
|
|
assets.srcDirs = ['assets']
|
|
}
|
|
}
|
|
|
|
packagingOptions {
|
|
exclude 'META-INF/LICENSE'
|
|
exclude 'META-INF/LICENSE.txt'
|
|
exclude 'META-INF/DEPENDENCIES'
|
|
exclude 'META-INF/NOTICE'
|
|
}
|
|
|
|
publishing {
|
|
singleVariant('release') {
|
|
withSourcesJar()
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
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}"
|
|
}
|
|
|
|
/**
|
|
* 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
|
|
}
|