-
Notifications
You must be signed in to change notification settings - Fork 2
Getting started
First things first, you need to create a new gradle project, when prompt for GroupId and ArifactId fill with whatever. Once project is created you have to edit your build.gradle file to apply Flair plugin. Plugin can be donwloaded from jcenter or maven repositories, replace all file content with these lines:
buildscript {
repositories {
jcenter()
//or "mavenCentral()" as you wish
}
dependencies {
classpath "com.github.samystudio.flair:flair-gradle-plugin:0.8.2"
}
}
Then you may apply plugin depending on your needs:
apply plugin: "flair.ios" // only if your project need to target ios devices
apply plugin: "flair.android" // only if your project need to target android devices
apply plugin: "flair.desktop" // only if your project need to target desktop
apply plugin: "flair.texturepacker" // only if you want to use TexturePacker with your project
apply plugin: "flair.idea" // only if you are using IntelliJ IDEA
apply plugin: "flair.fdt" // only if you are using FDT
To use TexturePacker plugin make sure you have command line tool installed, see TexturePacker page for more details.
You may as well use these shortcuts:
apply plugin: "flair.mobile" // ios + android
apply plugin: "flair.all" // ios + android + desktop
Note using flair.all adds all platform plugins, you still have to add TexturePacker and IDE plugins if you need them.
Refresh your gradle script from gradle panel and synchronize your project tree to see local.properties file added to your project root, then edit it with a valid AIR SDK path (FLEX SDK is ok if you've merged a AIR SDK with it but only AIR SDK is required). Note if you are using a cvs you should exclude local.properties file since it contains information from your environment.
Finally you need to set your sources package root, adding these lines to your build.gradle file:
flair {
packageName "com.hello.world" // set your package root here
}
Your build.gradle file may looks like this:
buildscript {
repositories {
jcenter( )
}
dependencies {
classpath "com.github.samystudio.flair:flair-gradle-plugin:0.8.2"
}
}
apply plugin: "flair.mobile"
flair {
packageName "com.hello.world"
}
Refresh build script and project tree if needed
You should see a new folder app from your project tree with all files to get started with your project.
If you added IDEA plugin and your app folder is not linked to a flash project (F symbol over your app folder
), go to File>New>Module from Existing Sources...> and browse to your app folder, then select app.iml file.
Note you may change your root app folder name using following Flair property:
flair {
moduleName "app" // change your root folder here
packageName "com.hello.world"
}
This need to be done before Flair is initialized, once Flair is initialized and you have start working on your project you should never change this property! If you want to change it now since you haven't start working on your project you may set this property as you wish and then delete your app folder. Once build script and project tree are refreshed you should see your new project root with the name you've chosen.
From here you may learn more about generated structure under app folder.