Pasteque Android is a POS (point of sale) project under the GNU General Public License v3. Our environment is the combination of Gradle, its Android plugin, and the Android SDK
Download the project.
$ git clone https://github.com/ScilCoop/pasteque-android-gradle.git pasteque-android
$ cd pasteque-android
Make sure you have installed:
Specify the path to your Android SDK in the ANDROID_HOME variable
$ export ANDROID_HOME='your path'
You can know use Gradle to assemble and install the project on your pluged device with
$ gradle installVanillaDebug
Our project holds independent customisations and features for different APKs in the same build.
Everything works with the Build Variants feature of the Android plugin. Run gradle -q flavors
to get the list of all the product flavors
Build Type + Product Flavor = Build Variant
Quick Start exemple: Debug + Vanilla = VanillaDebug
You can build the project by: build type, product flavor or build variant with:
gradle assemble<Variant Name>
gradle assemble<Build Type Name>
gradle assemble<Product Flavor Name>
But you can only install build variants on your device with:
$ gradle install<VariantName>
Our current project holds:
Build Type | productFlavor |
---|---|
Debug | Vanilla |
Release* | Bnp |
Wcr |
(*) release not available right now
Our repository hold a master gradle: ./build.gradle
and a subproject, which is the application: ./app/build.gradle
.
You mostly have to edit the app subproject's gradle.
You can list all the available tasks with: gradle tasks
. Every informations can be found in the android's plugins reference
##Add a flavor To add a flavor, you have to create a new folder with the basic files of Vanilla.
cp -r app/src/vanilla app/src/yourFlavorName
and add the flavor's packageName in app/build.gradle
ext {
flavors = [
...
"YourFlavorName": [packageName: "your.flavor.packagename"],
...
]
}
Flavors attributes are:
- packageName: the Android 'applicationID' (required)
- applicationName: the 'app_name' of your application (optionnal)
##Architecture There are 2 kinds of tests:
-
Instrumental, for tests that requires a device/emulator Placed in the folder
app/src/androidTest
, you can run them with:gradle connectedAndroidTest
/gradle connectedAndroidTest<VariantName>
-
Unit, for simple java unit tests Placed in the folder
app/src/test
, you can run them with:gradle test
/gradle test<VariantName>
You might want to read Testing Fundamentals for Android tests explinations and the Testing section of Gradle's Android plugin's documentation for the gradle's behavior.
##Development
Our tests are powered by Junit 4.12 with EasyMock and his PowerMock extension.
You might want to read some EasyMock Samples and the Android good practice section to get some examples.