Merge pull request #1500 from player-03/DeprecatedGradleFeatures

Fix warnings and errors in the Android build process
This commit is contained in:
player-03
2022-12-29 19:26:54 -05:00
committed by GitHub
10 changed files with 63 additions and 52 deletions

View File

@@ -1,16 +1,22 @@
import groovy.swing.SwingBuilder
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import javax.swing.border.EmptyBorder;
import java.awt.GridBagLayout
import java.awt.GridBagConstraints
import javax.swing.border.EmptyBorder
apply plugin: 'com.android.application'
System.setProperty('java.awt.headless','false')
//Uncomment to debug deprecation warnings.
/* tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
} */
android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
::if (ANDROID_GRADLE_PLUGIN>="4.0")::ndkPath '::ANDROID_NDK_ROOT_ESCAPED::'::end::
defaultConfig {
applicationId "::META_PACKAGE_NAME::"
minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
@@ -19,7 +25,7 @@ android {
versionName project.VERSION_NAME
::if (languages != null)::resConfigs ::foreach languages::"::__current__::", ::end::""::end::
}
::if KEY_STORE::
signingConfigs {
if (project.KEY_STORE_PASSWORD == 'null') {
@@ -27,11 +33,11 @@ android {
keyStoreFile = keyStoreFile[keyStoreFile.length - 1]
project.KEY_STORE_PASSWORD = getPassword('\nPlease enter key password for ' + keyStoreFile + ':');
}
if (project.KEY_STORE_ALIAS_PASSWORD == 'null') {
project.KEY_STORE_ALIAS_PASSWORD = getPassword("\nPlease enter key alias password for alias " + project.KEY_STORE_ALIAS + ":")
}
release {
storeFile file(project.KEY_STORE)
storePassword project.KEY_STORE_PASSWORD
@@ -44,7 +50,7 @@ android {
if(signingFile.exists()) {
Properties signing = new Properties()
signing.load(new FileInputStream(signingFile))
signingConfigs {
release {
storeFile file(signing["KEY_STORE"])
@@ -59,14 +65,14 @@ android {
}
}
::end::
buildTypes {
release {
minifyEnabled false
signingConfig signingConfigs.release
}
}
android.applicationVariants.all { variant ->
variant.outputs.all { output ->
if (outputFileName != null && outputFileName.endsWith('.apk')) {
@@ -77,8 +83,8 @@ android {
}
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
::if (ANDROID_LIBRARY_PROJECTS)::::foreach (ANDROID_LIBRARY_PROJECTS)::api project(':deps:::name::')
implementation fileTree(dir: 'libs', include: ['*.jar'])
::if (ANDROID_LIBRARY_PROJECTS)::::foreach (ANDROID_LIBRARY_PROJECTS)::implementation project(':deps:::name::')
::end::::end::
}
@@ -97,11 +103,11 @@ def getPassword(message) {
show: true
) {
lookAndFeel('system')
panel(border: new EmptyBorder(10, 10, 10, 10)) {
gridBagLayout()
def gbc = new GridBagConstraints();
gbc.gridx = 0
gbc.gridy = 0
gbc.fill = GridBagConstraints.HORIZONTAL
@@ -113,10 +119,10 @@ def getPassword(message) {
'</body>' +
'</html>',
constraints: gbc)
gbc.gridy = 1
input = passwordField(constraints: gbc)
gbc.gridy = 2
gbc.fill = GridBagConstraints.NONE
gbc.insets = [0, 0, 0, 0]

View File

@@ -1,15 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="::APP_PACKAGE::" android:versionCode="::APP_BUILD_NUMBER::" android:versionName="::APP_VERSION::" android:installLocation="::ANDROID_INSTALL_LOCATION::">
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
::if (ANDROID_PERMISSIONS != null)::::foreach ANDROID_PERMISSIONS::<uses-permission android:name="::__current__::" />
::end::::end::
<uses-sdk android:minSdkVersion="::ANDROID_MINIMUM_SDK_VERSION::" android:targetSdkVersion="::ANDROID_TARGET_SDK_VERSION::"/>
<application android:label="::APP_TITLE::" ::if (HAS_ICON):: android:icon="@drawable/icon"::end:: android:allowBackup="true" android:theme="@android:style/Theme.NoTitleBar::if (WIN_FULLSCREEN)::.Fullscreen::end::" android:hardwareAccelerated="true">
<application android:label="::APP_TITLE::" ::if (HAS_ICON):: android:icon="@drawable/icon"::end:: android:allowBackup="true" android:theme="@android:style/Theme.NoTitleBar::if (WIN_FULLSCREEN)::.Fullscreen::end::" android:hardwareAccelerated="true" ::if (ANDROID_TARGET_SDK_VERSION>=30):: android:allowNativeHeapPointerTagging="false" ::end::>
::if (WIN_ORIENTATION=="portrait")::
<meta-data android:name="SDL_ENV.SDL_IOS_ORIENTATIONS" android:value= "Portrait PortraitUpsideDown" />
@@ -20,17 +18,17 @@
::end::
<activity android:name="MainActivity" android:exported="true" android:launchMode="singleTask" android:label="::APP_TITLE::" android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|uiMode"::if (WIN_ORIENTATION=="portrait"):: android:screenOrientation="sensorPortrait"::end::::if (WIN_ORIENTATION=="landscape"):: android:screenOrientation="sensorLandscape"::end::>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="tv.ouya.intent.category.GAME" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -2,12 +2,12 @@
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:::ANDROID_GRADLE_PLUGIN::'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
@@ -15,7 +15,7 @@ buildscript {
allprojects {
repositories {
jcenter()
mavenCentral()
google()
}::if ANDROID_GRADLE_BUILD_DIRECTORY::
buildDir = "::ANDROID_GRADLE_BUILD_DIRECTORY::/::APP_FILE::/${project.name}"::end::
@@ -32,21 +32,22 @@ wrapper {
configure(subprojects.findAll {!it.file('build.gradle').exists() && it.file('build.xml').exists()}) {
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:::ANDROID_GRADLE_PLUGIN::'
}
}
apply plugin: 'android-library'
android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
::if (ANDROID_GRADLE_PLUGIN>="4.0")::ndkPath '::ANDROID_NDK_ROOT_ESCAPED::'::end::
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
@@ -55,9 +56,8 @@ configure(subprojects.findAll {!it.file('build.gradle').exists() && it.file('bui
}
}
}
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
api project(':deps:extension-api')
implementation project(':deps:extension-api')
}
}

View File

@@ -20,7 +20,10 @@ ANDROID_BUILD_TARGET_SDK_VERSION=::ANDROID_TARGET_SDK_VERSION::
ANDROID_BUILD_MIN_SDK_VERSION=::ANDROID_MINIMUM_SDK_VERSION::
ANDROID_BUILD_SDK_VERSION=::ANDROID_TARGET_SDK_VERSION::
ANDROID_BUILD_TOOLS_VERSION=::ANDROID_BUILD_TOOLS_VERSION::
::if (ANDROID_TARGET_SDK_VERSION>=28)::
android.useAndroidX=::ANDROID_USE_ANDROIDX::
android.enableJetifier=::ANDROID_ENABLE_JETIFIER::
::end::
::if KEY_STORE::
KEY_STORE=::KEY_STORE::
KEY_STORE_PASSWORD=::KEY_STORE_PASSWORD::

View File

@@ -4,4 +4,6 @@
# Location of the SDK. This is only used by Gradle.
#
sdk.dir=::ANDROID_SDK_ESCAPED::
::if (ANDROID_GRADLE_PLUGIN<"4.0")::
ndk.dir=::ANDROID_NDK_ROOT_ESCAPED::
::end::

View File

@@ -1,9 +1,9 @@
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:::::if (1 == 1)::ANDROID_GRADLE_PLUGIN::end::::'
}
@@ -17,5 +17,5 @@ android {
}
dependencies {
api project(':deps:extension-api')
implementation project(':deps:extension-api')
}