Merge pull request #27 from deathbaba/build-system-update

Build system update
This commit is contained in:
Viktor Govako 2013-09-26 10:22:12 -07:00
commit 3b150695cf
21 changed files with 276 additions and 118 deletions

3
.gitignore vendored
View file

@ -2,6 +2,9 @@
*.pro.user
*~
build-*
build/
.gradle/
.gradle*
project.xcworkspace
xcuserdata

View file

@ -2,4 +2,7 @@
package="com.mapwithme.maps.api"
android:versionCode="1"
android:versionName="1.0" >
<application />
</manifest>

34
3rdparty/android-mwm/build.gradle vendored Normal file
View file

@ -0,0 +1,34 @@
apply plugin: 'android-library'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 18
buildToolsVersion "18.1.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}

1
android/.gitignore vendored
View file

@ -1,5 +1,6 @@
bin/
gen/
build/
.settings/
resbuilder/
spoon-output/

View file

@ -4,6 +4,10 @@
android:versionCode="2"
android:versionName="1.1" >
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="15"/>
<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="15" />
<application />
</manifest>

View file

@ -0,0 +1,35 @@
apply plugin: 'android-library'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':3rdparty:play_licensing')
}
android {
compileSdkVersion 18
buildToolsVersion "18.1.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project
<!--
Copyright (C) 2010 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -16,9 +17,16 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.vending.licensing"
android:versionCode="2"
android:versionName="1.5">
android:versionName="1.5" >
<!-- Devices >= 3 have version of Android Market that supports licensing. -->
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="15" />
<uses-sdk
android:minSdkVersion="3"
android:targetSdkVersion="15" />
<!-- Required permission to check licensing. -->
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
</manifest>
<uses-permission
android:name="com.android.vending.CHECK_LICENSE" />
<application />
</manifest>

View file

@ -0,0 +1,34 @@
apply plugin: 'android-library'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 18
buildToolsVersion "18.1.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.guidewithme.uk"
package="com.guidewithme"
android:installLocation="preferExternal"
android:versionCode="3"
android:versionName="1.0.2" >
@ -9,7 +9,8 @@
android:minSdkVersion="9"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:name="android.hardware.location.gps"
@ -22,22 +23,28 @@
android:required="false" />
<!-- Required to access Google Play Licensing -->
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
<uses-permission
android:name="com.android.vending.CHECK_LICENSE" />
<!-- Required to download files from Google Play -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission
android:name="android.permission.INTERNET" />
<!-- Required to keep CPU alive while downloading files (NOT to keep screen awake) -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission
android:name="android.permission.WAKE_LOCK" />
<!-- Required to poll the state of the network connection and respond to changes -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Required to check whether Wi-Fi is enabled -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission
android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- Required to read and write the expansion files on shared storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
@ -66,15 +73,19 @@
android:label="@string/app_name"
android:noHistory="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action
android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="com.guidewithme.expansion.ExpansionService" />
<service
android:name="com.guidewithme.expansion.ExpansionService" />
<receiver android:name="com.guidewithme.expansion.DownloadBroadcastReceiver" />
<receiver
android:name="com.guidewithme.expansion.DownloadBroadcastReceiver" />
</application>
</manifest>

107
android/build.gradle Normal file
View file

@ -0,0 +1,107 @@
buildscript {
repositories { mavenCentral() }
dependencies { classpath 'com.android.tools.build:gradle:0.5.7' }
}
// need it for :clean
apply plugin:'base'
task ndkBuild(type:Exec) {
clParts = (['ndk-build', '-j', Runtime.runtime.availableProcessors() + 1] + GWMndkFlags.split(' ')).flatten()
println(clParts.join(" "))
commandLine clParts
}
task ndkBuildClean(type:Exec) {
commandLine 'ndk-build','clean'
}
task copyNativeLibs(type: Copy, dependsOn: 'ndkBuild') {
from(new File('libs')) { include '**/*.so' }
into new File(buildDir, 'native-libs')
}
tasks.withType(Compile) { compileTask -> compileTask.dependsOn ndkBuild }
tasks.withType(Compile) { compileTask -> compileTask.dependsOn copyNativeLibs }
clean.dependsOn 'cleanCopyNativeLibs'
clean.dependsOn 'ndkBuildClean'
tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
pkgTask.jniDir new File(buildDir, 'native-libs')
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':android-mwm')
compile project(':3rdparty:expansion_downloader')
}
android {
compileSdkVersion 18
buildToolsVersion "18.1.0"
project.archivesBaseName = GWMapk
signingConfigs {
guidewithme {
storeFile file("debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
}
buildTypes {
debug {
jniDebugBuild true
packageNameSuffix ".debug"
}
release {
signingConfig signingConfigs.guidewithme
}
}
defaultConfig {
versionCode = GWMvc
versionName = GWMvn
packageName = GWMpn
minSdkVersion 9
targetSdkVersion 18
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
// replace app name
android.applicationVariants.all { variant ->
variant.mergeResources.doLast {
File valuesFile = file("${buildDir}/res/all/${variant.dirName}/values/values.xml")
println "Replacing app name in " + valuesFile
println "App name = " + GWMappName
String content = valuesFile.getText('UTF-8')
content = content.replaceAll(/\(app_name\)/, GWMappName)
valuesFile.write(content, 'UTF-8')
}
}

View file

@ -1,92 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="TravelGuide" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="ant.properties" />
<!-- if sdk.dir was not set from one of the property file, then
get it from the ANDROID_HOME env var.
This must be done before we load project.properties since
the proguard config can use sdk.dir -->
<property environment="env" />
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
<isset property="env.ANDROID_HOME" />
</condition>
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
unless="sdk.dir"
/>
<!--
Import per project custom build rules if present at the root of the project.
This is the place to put custom intermediary targets such as:
-pre-build
-pre-compile
-post-compile (This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir})
-post-package
-post-build
-pre-clean
-->
<import file="custom_rules.xml" optional="true" />
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>

View file

@ -0,0 +1,6 @@
GWMvc=3
GWMvn=1.0.2
GWMpn=com.guidewithme.any
GWMapk=Any_Guide_With_Me
GWMappName=Any Guide With Me
GWMndkFlags=propNdkFlags=V=0 NDK_DEBUG=0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">UK Guide With Me</string>
<string name="app_name">(app_name)</string>
<string name="title_articleinfo_detail">ArticleInfo Detail</string>
<string name="loading">Loading ...</string>
<string name="searching">Searching ...</string>

4
android/settings.gradle Normal file
View file

@ -0,0 +1,4 @@
include ':3rdparty:play_licensing'
include ':3rdparty:expansion_downloader'
include ':android-mwm'
project(':android-mwm').projectDir = new File(settingsDir, '../3rdparty/android-mwm')

View file

@ -5,7 +5,7 @@ import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;
import com.guidewithme.uk.R;
import com.guidewithme.R;
/**
* An activity representing a single ArticleInfo detail screen. This activity is

View file

@ -24,7 +24,7 @@ import com.guidewithme.article.ArticleInfo;
import com.guidewithme.article.ArticlePathFinder;
import com.guidewithme.article.ObbPathFinder;
import com.guidewithme.cpp.Storage;
import com.guidewithme.uk.R;
import com.guidewithme.R;
import com.guidewithme.util.Utils;
import com.mapswithme.maps.api.MapsWithMeApi;

View file

@ -11,7 +11,7 @@ import com.guidewithme.article.ArticleInfo;
import com.guidewithme.cpp.Storage;
import com.mapswithme.maps.api.MWMPoint;
import com.mapswithme.maps.api.MWMResponse;
import com.guidewithme.uk.R;
import com.guidewithme.R;
/**
* An activity representing a list of ArticleInfos. This activity has different

View file

@ -30,7 +30,7 @@ import android.widget.TextView;
import com.guidewithme.article.ArticleInfo;
import com.guidewithme.async.QueryResultLoader;
import com.guidewithme.cpp.Storage;
import com.guidewithme.uk.R;
import com.guidewithme.R;
import com.guidewithme.util.Utils;
import com.guidewithme.widget.StorageArticleInfoAdapter;
import com.mapswithme.maps.api.MWMPoint;

View file

@ -22,7 +22,7 @@ import com.google.android.vending.expansion.downloader.IStub;
import com.guidewithme.expansion.ExpansionService;
import com.guidewithme.util.Expansion;
import com.guidewithme.util.Utils;
import com.guidewithme.uk.R;
import com.guidewithme.R;
public class ExpansionActivity extends Activity
implements IDownloaderClient, OnClickListener

View file

@ -12,7 +12,7 @@ import com.guidewithme.article.ArticleInfo;
import com.guidewithme.cpp.Storage;
import com.guidewithme.thumb.ObbThumbnailProvider;
import com.guidewithme.thumb.ThumbnailsProvider;
import com.guidewithme.uk.R;
import com.guidewithme.R;
public class StorageArticleInfoAdapter extends BaseAdapter
implements ObbThumbnailProvider.MountStateChangedListener