SDL: updated Google Play Games build scripts, removed Google+ stuff

This commit is contained in:
Sergii Pylypenko
2016-08-15 21:53:43 +03:00
parent fe7c6be644
commit c8f0ab02c8
8 changed files with 158 additions and 33 deletions

107
aar2jar.py Executable file
View File

@@ -0,0 +1,107 @@
#!/usr/bin/python
# aar2jar.py (c) kak2 <doanngocbao@gmail.com>
# https://github.com/kak2/aar2jar
import sys, getopt, os
import shutil
import zipfile
mswindows = (sys.platform == "win32")
def main(argv):
project_name = ''
output_dir = ''
if len(argv) == 0:
help()
sys.exit(2)
try:
opts, args = getopt.getopt(argv,"hi:o:",["iname=","odir="])
except getopt.GetoptError:
help()
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
help()
sys.exit()
elif opt in ("-i", "--iname"):
project_name = arg
elif opt in ("-o", "--odir"):
output_dir = arg
convert(project_name, output_dir)
def help():
print 'convert.py -i <your-project-name-without-aar> -o <output-dir>'
def convert(project_name, output_dir):
if not existProject(project_name):
print project_name, " is not existed in current directory"
sys.exit(2)
createOrCleanOutputDir(output_dir)
# Convert your project first
convert_project(project_name, output_dir)
# Move all jar and convert other aar files
files = os.listdir(os.curdir)
for file in files:
file_name, extension = os.path.splitext(file)
print file_name, extension
if extension == '.jar':
shutil.move(file, os.path.join(output_dir, project_name, 'libs', file))
elif extension == '.aar':
if file_name != project_name:
convert_project(file_name, output_dir)
def convert_project(project_name, output_dir):
# Extract your project's file
your_file_dest_path = os.path.join(output_dir, project_name)
os.makedirs(your_file_dest_path)
with zipfile.ZipFile(project_name + '.aar' , "r") as z:
z.extractall(your_file_dest_path)
#
# Make it into ant library project
#
if not os.path.exists(os.path.join(your_file_dest_path, 'src')):
os.makedirs(os.path.join(your_file_dest_path, 'src')) # Make src directory in project, but leave it empty
if not os.path.exists(os.path.join(your_file_dest_path, 'libs')):
os.makedirs(os.path.join(your_file_dest_path, 'libs')) # Make lib directory in project if it does not exists
# Rename classes.jar to project_name.jar and move it into libs directory
os.rename(os.path.join(your_file_dest_path, 'classes.jar'), os.path.join(your_file_dest_path, project_name + '.jar'))
shutil.move(os.path.join(your_file_dest_path, project_name + '.jar'), os.path.join(your_file_dest_path, 'libs/' + project_name + '.jar'))
# Call android update. So we have to install android first, then add it into PATH
command = "android update lib-project -p " + os.path.join(output_dir, project_name) + " -t 10"
os.system(command)
# Update project.properties file
with open(os.path.join(output_dir, project_name, 'project.properties'), "a") as myfile:
myfile.write("android.library=true\n")
def createOrCleanOutputDir(output_dir):
files = os.listdir(os.curdir)
if os.path.exists(output_dir):
deleteDir(output_dir)
os.makedirs(output_dir)
def remove_readonly(fn, path, excinfo):
#removes readonly tag from files/folders so they can be deleted
if fn is os.rmdir:
os.chmod(path, stat.S_IWRITE)
os.rmdir(path)
elif fn is os.remove:
os.chmod(path, stat.S_IWRITE)
os.remove(path)
def deleteDir(directory):
shutil.rmtree(directory, onerror=remove_readonly)
def existProject(project_name):
project_file = project_name + ".aar"
files = os.listdir(os.curdir)
try:
files.index(project_file)
return True
except ValueError:
return False
if __name__ == "__main__":
main(sys.argv[1:])

View File

@@ -945,7 +945,7 @@ if [ "$GooglePlayGameServicesId" = "n" -o -z "$GooglePlayGameServicesId" ] ; the
$SEDI "/==GOOGLEPLAYGAMESERVICES==/ d" project/AndroidManifest.xml
GooglePlayGameServicesId=""
grep 'google-play-services' project/local.properties > /dev/null && {
$SEDI 's/.*google-play-services.*//g' project/local.properties
$SEDI 's/.*android.library.reference.*//g' project/local.properties
rm -f project/libs/android-support-v4.jar
rm -f project/libs/play-services-games.jar
}
@@ -956,16 +956,38 @@ else
echo '// DO NOT EDIT THIS FILE - it is automatically generated, edit file under $JAVA_SRC_PATH dir' > project/src/$OUT
cat $F | sed "s/^package .*;/package $AppFullName;/" >> project/src/$OUT
done
PLAY_SERVICES_VER=9.4.0
rm -rf project/play-services
CURDIR=`pwd`
cd $SDK_DIR/extras/google/m2repository/com/google/android/gms/play-services-games/$PLAY_SERVICES_VER || exit 1
$CURDIR/aar2jar.py -o $CURDIR/project/play-services/games -i play-services-games-$PLAY_SERVICES_VER || exit 1
cd $SDK_DIR/extras/google/m2repository/com/google/android/gms/play-services-drive/$PLAY_SERVICES_VER || exit 1
$CURDIR/aar2jar.py -o $CURDIR/project/play-services/drive -i play-services-drive-$PLAY_SERVICES_VER || exit 1
cd $SDK_DIR/extras/google/m2repository/com/google/android/gms/play-services-base/$PLAY_SERVICES_VER || exit 1
$CURDIR/aar2jar.py -o $CURDIR/project/play-services/base -i play-services-base-$PLAY_SERVICES_VER || exit 1
cd $SDK_DIR/extras/google/m2repository/com/google/android/gms/play-services-tasks/$PLAY_SERVICES_VER || exit 1
$CURDIR/aar2jar.py -o $CURDIR/project/play-services/tasks -i play-services-tasks-$PLAY_SERVICES_VER || exit 1
cd $SDK_DIR/extras/google/m2repository/com/google/android/gms/play-services-basement/$PLAY_SERVICES_VER || exit 1
$CURDIR/aar2jar.py -o $CURDIR/project/play-services/basement -i play-services-basement-$PLAY_SERVICES_VER || exit 1
cd $CURDIR
$SEDI "s/==GOOGLEPLAYGAMESERVICES_APP_ID==/$GooglePlayGameServicesId/g" project/res/values/strings.xml
grep 'google-play-services' project/local.properties > /dev/null || {
# Ant is way too smart, and adds current project path in front of the ${sdk.dir}
echo 'android.library.reference.1=../../../../../../../../../../../../../../${sdk.dir}/extras/google/google_play_services/libproject/google-play-services_lib' >> project/local.properties
echo 'android.library.reference.2=../../../../../../../../../../../../../../${sdk.dir}/extras/android/compatibility/v7/mediarouter' >> project/local.properties
echo 'android.library.reference.3=../../../../../../../../../../../../../../${sdk.dir}/extras/android/compatibility/v7/appcompat' >> project/local.properties
echo 'android.library.reference.4=../../../../../../../../../../../../../../${sdk.dir}/extras/android/compatibility/v7/palette' >> project/local.properties
echo "android.library.reference.1=play-services/games/play-services-games-$PLAY_SERVICES_VER" >> project/local.properties
echo "android.library.reference.2=play-services/drive/play-services-drive-$PLAY_SERVICES_VER" >> project/local.properties
echo "android.library.reference.3=play-services/base/play-services-base-$PLAY_SERVICES_VER" >> project/local.properties
echo "android.library.reference.4=play-services/tasks/play-services-tasks-$PLAY_SERVICES_VER" >> project/local.properties
echo "android.library.reference.5=play-services/basement/play-services-basement-$PLAY_SERVICES_VER" >> project/local.properties
#echo 'android.library.reference.6=../../../../../../../../../../../../../../${sdk.dir}/extras/android/compatibility/v7/mediarouter' >> project/local.properties
#echo 'android.library.reference.7=../../../../../../../../../../../../../../${sdk.dir}/extras/android/compatibility/v7/appcompat' >> project/local.properties
#echo 'android.library.reference.8=../../../../../../../../../../../../../../${sdk.dir}/extras/android/compatibility/v7/palette' >> project/local.properties
echo 'proguard.config=proguard.cfg;proguard-local.cfg' >> project/local.properties
ln -s -f $SDK_DIR/extras/android/compatibility/v4/android-support-v4.jar project/libs
}
if false; then
[ -e $SDK_DIR/extras/google/google_play_services/libproject/google-play-services_lib/build.xml ] || \
android update project -t android-23 -p $SDK_DIR/extras/google/google_play_services/libproject/google-play-services_lib
[ -e $SDK_DIR/extras/android/compatibility/v7/mediarouter/build.xml ] || { \
@@ -977,6 +999,7 @@ else
[ -e $SDK_DIR/extras/android/compatibility/v7/palette/build.xml ] || \
android update project -t android-23 -p $SDK_DIR/extras/android/compatibility/v7/palette && \
mkdir -p $SDK_DIR/extras/android/compatibility/v7/palette/src
fi
fi
if [ -e project/jni/application/src/project.patch ]; then patch -p1 --dry-run -f -R < project/jni/application/src/project.patch > /dev/null 2>&1 || patch -p1 --no-backup-if-mismatch < project/jni/application/src/project.patch || exit 1 ; fi

View File

@@ -28,9 +28,6 @@ import java.util.Random;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.auth.GoogleAuthException;
import com.google.android.gms.auth.GoogleAuthUtil;
import com.google.android.gms.auth.UserRecoverableAuthException;
import com.google.android.gms.common.Scopes;
import com.google.android.gms.games.Games;
import com.google.android.gms.games.GamesStatusCodes;

View File

@@ -41,8 +41,8 @@ import com.google.android.gms.games.multiplayer.Invitation;
import com.google.android.gms.games.multiplayer.Multiplayer;
import com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch;
import com.google.android.gms.games.request.GameRequest;
import com.google.android.gms.plus.Plus;
import com.google.android.gms.plus.Plus.PlusOptions;
//import com.google.android.gms.plus.Plus;
//import com.google.android.gms.plus.Plus.PlusOptions;
public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener {
@@ -112,7 +112,7 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
// Api options to use when adding each API, null for none
GamesOptions mGamesApiOptions = GamesOptions.builder().build();
PlusOptions mPlusApiOptions = null;
//PlusOptions mPlusApiOptions = null;
NoOptions mAppStateApiOptions = null;
// Google API client object we manage.
@@ -121,10 +121,10 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
// Client request flags
public final static int CLIENT_NONE = 0x00;
public final static int CLIENT_GAMES = 0x01;
public final static int CLIENT_PLUS = 0x02;
//public final static int CLIENT_PLUS = 0x02;
public final static int CLIENT_APPSTATE = 0x04;
public final static int CLIENT_SNAPSHOT = 0x05;
public final static int CLIENT_ALL = CLIENT_GAMES | CLIENT_PLUS
public final static int CLIENT_ALL = CLIENT_GAMES //| CLIENT_PLUS
| CLIENT_APPSTATE | CLIENT_SNAPSHOT;
// What clients were requested? (bit flags)
@@ -256,10 +256,10 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
* Sets the options to pass when setting up the Plus API. Call before
* setup().
*/
public void setPlusApiOptions(PlusOptions options) {
doApiOptionsPreCheck();
mPlusApiOptions = options;
}
//public void setPlusApiOptions(PlusOptions options) {
// doApiOptionsPreCheck();
// mPlusApiOptions = options;
//}
/**
* Creates a GoogleApiClient.Builder for use with @link{#setup}. Normally,
@@ -283,10 +283,10 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
builder.addScope(Games.SCOPE_GAMES);
}
if (0 != (mRequestedClients & CLIENT_PLUS)) {
builder.addApi(Plus.API);
builder.addScope(Plus.SCOPE_PLUS_LOGIN);
}
//if (0 != (mRequestedClients & CLIENT_PLUS)) {
// builder.addApi(Plus.API);
// builder.addScope(Plus.SCOPE_PLUS_LOGIN);
//}
if (0 != (mRequestedClients & CLIENT_SNAPSHOT)) {
builder.addScope(Drive.SCOPE_APPFOLDER);
@@ -534,10 +534,10 @@ public class GameHelper implements GoogleApiClient.ConnectionCallbacks,
// for Plus, "signing out" means clearing the default account and
// then disconnecting
if (0 != (mRequestedClients & CLIENT_PLUS)) {
debugLog("Clearing default account on PlusClient.");
Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
}
//if (0 != (mRequestedClients & CLIENT_PLUS)) {
// debugLog("Clearing default account on PlusClient.");
// Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
//}
// For the games client, signing out means calling signOut and
// disconnecting

View File

@@ -7,10 +7,10 @@ AppName="SuperTux"
AppFullName=org.lethargik.supertux2
# Application version code (integer)
AppVersionCode=04015
AppVersionCode=04016
# Application user-visible version name (string)
AppVersionName="0.4.0.15"
AppVersionName="0.4.0.16"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu
@@ -21,7 +21,7 @@ AppVersionName="0.4.0.15"
AppDataDownloadUrl="!SSL certificates|:ca-certificates.crt:ca-certificates.crt"
# Reset SDL config when updating application to the new version (y) / (n)
ResetSdlConfigForThisVersion=n
ResetSdlConfigForThisVersion=y
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
DeleteFilesOnUpgrade="data.zip"
@@ -141,7 +141,7 @@ AppNeedsArrowKeys=y
FloatingScreenJoystick=n
# Application needs text input (y) or (n), enables button for text input on screen
AppNeedsTextInput=y
AppNeedsTextInput=n
# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1
# This will disable AppNeedsArrowKeys option

View File

@@ -13,8 +13,6 @@ TODO, which will get actually done
- OpenArena: Option for the second tap to stop shooting in tap to shoot mode,
- SuperTux: Light and Magic level is broken
- USB Keyboard: options for camera feed size and for redefining remote menu hotkey.
- UQM HD: add fonts from http://mosc-portal.bursa.ru/showthread.php?t=206 and switch back to joystick controls, set 4:3 aspect ratio as default.