mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Change tw.DDNet
package name to org.ddnet.client
This commit is contained in:
parent
664b0e98bb
commit
51e4e41805
|
@ -14,6 +14,7 @@ export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/$ANDROID_NDK_VERSION"
|
|||
|
||||
_DEFAULT_ANDROID_BUILD=x86
|
||||
_DEFAULT_GAME_NAME=DDNet
|
||||
_DEFAULT_PACKAGE_NAME=org.ddnet.client
|
||||
_DEFAULT_BUILD_TYPE=Debug
|
||||
_DEFAULT_BUILD_FOLDER=build-android
|
||||
_ANDROID_API_LEVEL=34
|
||||
|
@ -37,17 +38,24 @@ else
|
|||
fi
|
||||
|
||||
if [ -z ${3+x} ]; then
|
||||
printf "\e[31m%s\e[30m\n" "Did not pass build type, using default: ${_DEFAULT_BUILD_TYPE}"
|
||||
printf "\e[31m%s\e[30m\n" "Did not pass package name, using default: ${_DEFAULT_PACKAGE_NAME}"
|
||||
_SHOW_USAGE_INFO=1
|
||||
else
|
||||
_DEFAULT_BUILD_TYPE=$3
|
||||
_DEFAULT_PACKAGE_NAME=$3
|
||||
fi
|
||||
|
||||
if [ -z ${4+x} ]; then
|
||||
printf "\e[31m%s\e[30m\n" "Did not pass build type, using default: ${_DEFAULT_BUILD_TYPE}"
|
||||
_SHOW_USAGE_INFO=1
|
||||
else
|
||||
_DEFAULT_BUILD_TYPE=$4
|
||||
fi
|
||||
|
||||
if [ -z ${5+x} ]; then
|
||||
printf "\e[31m%s\e[30m\n" "Did not pass build folder, using default: ${_DEFAULT_BUILD_FOLDER}"
|
||||
_SHOW_USAGE_INFO=1
|
||||
else
|
||||
_DEFAULT_BUILD_FOLDER=$4
|
||||
_DEFAULT_BUILD_FOLDER=$5
|
||||
fi
|
||||
|
||||
_ANDROID_JAR_KEY_NAME=~/.android/debug.keystore
|
||||
|
@ -92,10 +100,10 @@ fi
|
|||
|
||||
export TW_VERSION_NAME=$_ANDROID_VERSION_NAME
|
||||
|
||||
printf "\e[31m%s\e[1m\n" "Building with setting, for arch: ${_DEFAULT_ANDROID_BUILD}, with build type: ${_DEFAULT_BUILD_TYPE}, with name: ${_DEFAULT_GAME_NAME}"
|
||||
printf "\e[31m%s\e[1m\n" "Building with setting, for arch: ${_DEFAULT_ANDROID_BUILD}, with build type: ${_DEFAULT_BUILD_TYPE}, with name: ${_DEFAULT_GAME_NAME} (${_DEFAULT_PACKAGE_NAME})"
|
||||
|
||||
if [ $_SHOW_USAGE_INFO == 1 ]; then
|
||||
printf "\e[31m%s\e[1m\n" "Usage: ./cmake_android.sh <x86/x86_64/arm/arm64/all> <Game name> <Debug/Release>"
|
||||
printf "\e[31m%s\e[1m\n" "Usage: ./cmake_android.sh <x86/x86_64/arm/arm64/all> <Game name> <Package name> <Debug/Release> <Build folder>"
|
||||
fi
|
||||
|
||||
printf "\e[33mBuilding cmake\e[0m\n"
|
||||
|
@ -238,15 +246,12 @@ printf "\e[0m"
|
|||
|
||||
echo "Building..."
|
||||
|
||||
rm -R src/main/java/tw
|
||||
mkdir -p src/main/java/tw/DDNet
|
||||
cp ../scripts/android/files/java/tw/DDNet/NativeMain.java src/main/java/tw/DDNet/NativeMain.java
|
||||
|
||||
rm -R src/main/java/org
|
||||
mkdir -p src/main/java
|
||||
cp -R ../scripts/android/files/java/org src/main/java/
|
||||
cp -R ../ddnet-libs/sdl/java/org src/main/java/
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source ./build.sh "$ANDROID_HOME" "$_DEFAULT_GAME_NAME" "$_DEFAULT_BUILD_TYPE"
|
||||
source ./build.sh "$_DEFAULT_GAME_NAME" "$_DEFAULT_PACKAGE_NAME" "$_DEFAULT_BUILD_TYPE"
|
||||
|
||||
cd ..
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||
<activity
|
||||
android:name=".NativeMain"
|
||||
android:name="org.ddnet.client.NativeMain"
|
||||
android:exported="true"
|
||||
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"
|
||||
android:screenOrientation="landscape">
|
||||
|
|
|
@ -25,8 +25,8 @@ android {
|
|||
compileSdkVersion 34
|
||||
ndkVersion "TW_NDK_VERSION"
|
||||
defaultConfig {
|
||||
applicationId "tw.DDNet"
|
||||
namespace("tw.DDNet")
|
||||
applicationId "org.ddnet.client"
|
||||
namespace("org.ddnet.client")
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 34
|
||||
versionCode TW_VERSION_CODE
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
[ "$1" == "" ] && {
|
||||
printf '\e[31mDid not pass ANDROID_SDK_ROOT to build script\e[30m\n'
|
||||
printf '\e[31mDid not pass APK name to build script\e[30m\n'
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ "$2" == "" ] && {
|
||||
printf '\e[31mDid not pass APK name to build script\e[30m\n'
|
||||
printf '\e[31mDid not pass package name to build script\e[30m\n'
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -15,13 +15,15 @@
|
|||
exit 1
|
||||
}
|
||||
|
||||
_APK_BASENAME="$2"
|
||||
_APK_BASENAME="$1"
|
||||
_APK_PACKAGE_NAME="$2"
|
||||
_APK_BUILD_TYPE="$3"
|
||||
|
||||
sed -i "s/DDNet/${2}/g" settings.gradle
|
||||
_APK_PACKAGE_FOLDER=$(echo "$_APK_PACKAGE_NAME"|sed 's/\./\//g')
|
||||
|
||||
_REPLACE_PACKAGE_NAME_STR="tw.${2,,}"
|
||||
sed -i "s/DDNet/${_APK_BASENAME}/g" settings.gradle
|
||||
|
||||
sed -i "s/tw.DDNet/${_REPLACE_PACKAGE_NAME_STR}/g" build.gradle
|
||||
sed -i "s/org.ddnet.client/${_APK_PACKAGE_NAME}/g" build.gradle
|
||||
|
||||
TW_KEY_NAME_ESCAPED=$(echo "$TW_KEY_NAME"|sed 's/\//\\\//g')
|
||||
TW_KEY_PW_ESCAPED=$(echo "$TW_KEY_PW"|sed 's/\//\\\//g')
|
||||
|
@ -31,35 +33,35 @@ sed -i "s/TW_KEY_NAME/${TW_KEY_NAME_ESCAPED}/g" build.gradle
|
|||
sed -i "s/TW_KEY_PW/${TW_KEY_PW_ESCAPED}/g" build.gradle
|
||||
sed -i "s/TW_KEY_ALIAS/${TW_KEY_ALIAS_ESCAPED}/g" build.gradle
|
||||
|
||||
sed -i "s/DDNet/${2}/g" src/main/res/values/strings.xml
|
||||
|
||||
sed -i "s/\"DDNet\"/\"${2}\"/g" src/main/AndroidManifest.xml
|
||||
sed -i "s/tw.DDNet/${_REPLACE_PACKAGE_NAME_STR}/g" src/main/AndroidManifest.xml
|
||||
|
||||
sed -i "s/TW_NDK_VERSION/${ANDROID_NDK_VERSION}/g" build.gradle
|
||||
sed -i "s/TW_VERSION_CODE/${TW_VERSION_CODE}/g" build.gradle
|
||||
sed -i "s/TW_VERSION_NAME/${TW_VERSION_NAME}/g" build.gradle
|
||||
|
||||
mv src/main/java/tw/DDNet src/main/java/tw/"${2}"
|
||||
sed -i "s/DDNet/${_APK_BASENAME}/g" src/main/res/values/strings.xml
|
||||
|
||||
sed -i "s/tw.DDNet/${_REPLACE_PACKAGE_NAME_STR}/g" src/main/java/tw/"${2}"/NativeMain.java
|
||||
sed -i "s/tw.DDNet/${_REPLACE_PACKAGE_NAME_STR}/g" proguard-rules.pro
|
||||
sed -i "s/\"DDNet\"/\"${_APK_BASENAME}\"/g" src/main/AndroidManifest.xml
|
||||
sed -i "s/org.ddnet.client/${_APK_PACKAGE_NAME}/g" src/main/AndroidManifest.xml
|
||||
|
||||
mv src/main/java/org/ddnet/client src/main/java/"${_APK_PACKAGE_FOLDER}"
|
||||
|
||||
sed -i "s/org.ddnet.client/${_APK_PACKAGE_NAME}/g" src/main/java/"${_APK_PACKAGE_FOLDER}"/NativeMain.java
|
||||
sed -i "s/org.ddnet.client/${_APK_PACKAGE_NAME}/g" proguard-rules.pro
|
||||
|
||||
# disable hid manager for now
|
||||
sed -i "s/mHIDDeviceManager = HIDDeviceManager.acquire(this);/mHIDDeviceManager=null;/g" src/main/java/org/libsdl/app/SDLActivity.java
|
||||
|
||||
if [[ "${3}" == "Debug" ]]; then
|
||||
if [[ "${_APK_BUILD_TYPE}" == "Debug" ]]; then
|
||||
sed -i "s/android.enableR8.fullMode=true/android.enableR8.fullMode=false/g" gradle.properties
|
||||
fi
|
||||
|
||||
if [[ -z ${GE_NO_APK_BUILD} || "${GE_NO_APK_BUILD}" != "1" ]]; then
|
||||
_RELEASE_TYPE_NAME=debug
|
||||
_RELEASE_TYPE_APK_NAME=
|
||||
if [[ "${3}" == "Debug" ]]; then
|
||||
if [[ "${_APK_BUILD_TYPE}" == "Debug" ]]; then
|
||||
_RELEASE_TYPE_NAME=debug
|
||||
fi
|
||||
|
||||
if [[ "${3}" == "Release" ]]; then
|
||||
if [[ "${_APK_BUILD_TYPE}" == "Release" ]]; then
|
||||
_RELEASE_TYPE_NAME=release
|
||||
_RELEASE_TYPE_APK_NAME=
|
||||
fi
|
||||
|
@ -67,7 +69,7 @@ if [[ -z ${GE_NO_APK_BUILD} || "${GE_NO_APK_BUILD}" != "1" ]]; then
|
|||
APP_BASE_NAME=Gradle
|
||||
CLASSPATH=gradle-wrapper.jar
|
||||
java "-Dorg.gradle.appname=${APP_BASE_NAME}" -classpath "${CLASSPATH}" org.gradle.wrapper.GradleWrapperMain --warning-mode all
|
||||
if [[ "${3}" == "Debug" ]]; then
|
||||
if [[ "${_APK_BUILD_TYPE}" == "Debug" ]]; then
|
||||
java "-Dorg.gradle.appname=${APP_BASE_NAME}" -classpath "${CLASSPATH}" org.gradle.wrapper.GradleWrapperMain --warning-mode all builddebug
|
||||
java "-Dorg.gradle.appname=${APP_BASE_NAME}" -classpath "${CLASSPATH}" org.gradle.wrapper.GradleWrapperMain --warning-mode all assembleDebug
|
||||
else
|
||||
|
@ -77,7 +79,7 @@ if [[ -z ${GE_NO_APK_BUILD} || "${GE_NO_APK_BUILD}" != "1" ]]; then
|
|||
cp build/outputs/apk/"$_RELEASE_TYPE_NAME"/"$_APK_BASENAME"-"$_RELEASE_TYPE_NAME""$_RELEASE_TYPE_APK_NAME".apk "$_APK_BASENAME".apk
|
||||
|
||||
|
||||
if [[ "${3}" == "Release" ]]; then
|
||||
if [[ "${_APK_BUILD_TYPE}" == "Release" ]]; then
|
||||
java "-Dorg.gradle.appname=${APP_BASE_NAME}" -classpath "${CLASSPATH}" org.gradle.wrapper.GradleWrapperMain --warning-mode all bundleRelease
|
||||
|
||||
cp build/outputs/bundle/"$_RELEASE_TYPE_NAME"/"$_APK_BASENAME"-"$_RELEASE_TYPE_NAME""$_RELEASE_TYPE_APK_NAME".aab "$_APK_BASENAME".aab
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
package tw.DDNet;
|
||||
package org.ddnet.client;
|
||||
|
||||
import android.app.NativeActivity;
|
||||
import org.libsdl.app.SDLActivity;
|
||||
import android.os.Bundle;
|
||||
|
@ -12,7 +13,7 @@ public class NativeMain extends SDLActivity {
|
|||
@Override
|
||||
protected String[] getLibraries() {
|
||||
return new String[] {
|
||||
// disable hid API for now
|
||||
// disable hid API for now
|
||||
// "hidapi",
|
||||
// "SDL2",
|
||||
"DDNet",
|
2
scripts/android/files/proguard-rules.pro
vendored
2
scripts/android/files/proguard-rules.pro
vendored
|
@ -16,7 +16,7 @@
|
|||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
-keepclassmembers, allowoptimization public class tw.DDNet.NativeMain {
|
||||
-keepclassmembers, allowoptimization public class org.ddnet.client.NativeMain {
|
||||
*;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue