sigh... (about GYP) who thought using JSON as the build description format was a good idea? It's almost as bad as using XML. Such nested blocks should not be necessary.
My favourite build tool at the moment is Gradle, it is slow to invoke though (they're trying to improve it with a background daemon). Unfortunately it's heavily targeted at JVM language compilation/packaging... even trying to handle a JNI project is painful.
For my non-JVM projects I almost always try out a new build tool (at the moment I'm trying ftjam and bam) but almost always end up realising it's not worth the effort and fallback on using make. Btw, I really hate CMake... not sure what everyone likes about it.
The daemon is used to speed up builds. While not perfect, it allows for gradle to watch for changes in stead of scanning everything. Then when you run the build command, it knows everything is up to date.
./gradlew --daemon # Start the daemon ./gradlew --stop # Stops the daemon
http://www.gradle.org/docs/current/userguide/gradle_daemon.html
Make sure you fully understand what you're doing before using any of the tricks yourself, otherwise you might end up with broken .apks.
For example, in the last step, he suggests splitting the project into modules, and using the parallel=true option. However, most modularized projects are coupled, and that doesn't play very nice with the gradle parallel feature.
When your build.gradle file says:
compile 'group:name:version'
reverting to any version is trivial, as it tells you right there which one you're using.
This becomes really important if you have dependencies that have their own dependencies. Using foo-1.0.jar that depends on bar-2.3.4.jar is one thing but when another library depends on bar-3.1.4.jar when it's a mess.
Using proper dependency management helps you figure things out. so use maven artifacts, and try
./gradlew module:dependencies --configuration compile
and you'll see all the dependencies, direct and transitive, which version is used by what library, and which version ended up being selected.
And if the selected one is not good for you, you can override it, or tweak the resolution strategy. Read more here: http://www.gradle.org/docs/current/userguide/dependency_management.html
The basic script is simple enough but as soon as you want to do something more complex it gets ugly fast. The lacking documentation doesn't help there.
You have to wade through random tutorials that may or may not be applicable to the current version of sbt to find out how to do things.
If build speed was a problem with gradle, one thing I can suggest is to add a gradle.properties file to the root of your project and add this line to it: org.gradle.daemon=true. More info about the gradle deamon here: http://www.gradle.org/docs/current/userguide/gradle_daemon.html
A good start is to create a new project in Android Studio (or use an existing AS project) and play around with the command line. You can see a list of Gradle tasks by executing gradlew tasks
from the root directory of the project. Read what they do, and experiment with them to see what they do.
The Gradle website provides a good user guide as well: http://www.gradle.org/docs/current/userguide/userguide.html
2) See #4.
4) Learn Gradle (or Maven) build tool. Any good IDE will have great support.
Use a web server plugin, making #2 unnecessary.
If you want a PDF of the gradle documentation its available at
http://www.gradle.org/documentation
That documentation is generic to all gradle, not specific to google's android gradle plugin tho. I took this PDF and slapped it on my tablet & kindle. Practically a book.
It does help to know Groovy...
I eventually just ended up downloding the source for the android gradle plugin as the documentation provided by google on their website is lacking
https://android.googlesource.com/platform/tools/build
^ Inside is loaded with great javadoc & groovydoc and a great readme.md file...why Google doesn't publish all this about its android gradle plugin is beyond me.
> Kids don't have full internet access meaning they cant download Gradle, how can I install on mass or make studio use a pre downloaded copy?
You could download the current gradle instalation (1.12) from http://www.gradle.org/ and place it in a network share. Then in Android Studio, you can go to Settings > Gradle and at the bottom, you can set a static location for Gradle. Point it to the network share.
There is a canonical java project layout, it is recommended by maven and gradle tools. It looks like this.
I do not know the details about the python problem, but I am fairly certain it is easier to solve with gradle than with javac.
I'll try to take a closer look at the project over the weekend.
Good luck!
You should look into build management with gradle. It can handle the dependencies of your project as well as your builds. It's fairly new still, but the documentation is good and there are lots of plugins.
After updating android studio to 3.4.2 it is not making some file properly, Because of which I am not able to build it. For example : colors.xml has --> !/usr/bin/env sh ################################################################################## Gradle start up script for UN*X # ic_launcher.xml and ic_launcher_round.xml has --> Project-wide Gradle settings. IDE (e.g. Android Studio) users:# Gradle settings configured through the IDE will override# any settings specified in this file. For more details on how to configure your build environment visit# http://www.gradle.org/do Please help me to solve this.
So the following (you need gradle installed):
git clone https://github.com/puniverse/quasar cd quasar/quasar-kotlin git checkout tags/v0.7.0 gradle test
doesn't work for you? What's the problem you get?
[Buildscript closure](http://www.gradle.org/docs/current/javadoc/org/gradle/api/Project.html#buildscript(groovy.lang.Closure\)) in the API docs: configureClosure - the closure to use to configure the build script classpath.
The only common use case for using buildscript closures like this is plugins - and most of them have moved on to the much cleaner Gradle 2.0+ syntax (Android hasn't yet), which looks more like this:
plugins { id 'nebula.info' version '2.0.0' }
But the syntax you listed should be familiar to anyone who's added a third-party plugin to their gradle build, because it looks the same whether it's the android plugin or any other third-party plugin, the only thing that changes is the dependency.
From the command line there are two main options. The old way which includes Ant and newer ones like Gradle. Ant itself doesn't manage dependencies per se and can be coupled with Apache Ivy.
I recommend using Gradle. There will be a learning curve most definitely. Gradle is configured and manipulated with Groovy, so you have the full power of a scripting language. You can define tasks that will run consecutively.
This jumps right into the Gradle documentation, but describes some command line options: http://www.gradle.org/docs/current/userguide/tutorial_gradle_command_line.html
A good discussion of the 3 main options: http://technologyconversations.com/2014/06/18/build-tools/
I haven't read this book, but this is the best reviewed and recent book from this year on Gradle (I looked over the table of contents and it looks solid): http://www.amazon.com/Gradle-Action-Benjamin-Muschko/dp/1617291307
Any reason you want to avoid a Java IDE?
Modern java development typically includes use of a dependency management tool (usually one feature within a more general build tool) - examples include Ant's Ivy, Maven, and Gradle - I'd recommend Gradle to begin with, see http://www.gradle.org/docs/current/userguide/dependency_management.htm
To be fair, this was a link to a forum post instead of the release notes page on their main site. It does a better job of describing what's new, and has a good overview of Gradle on the "home" page.
I think you can use the IDE instead of actually adjusting the gradle files, I think - but it's very obvious that things like dependencies are meant to be adjusted in the gradle files.
Don't worry about basic stuff like compiling, but see it more as if you want to use an external library, using an (online) external dependency, etc. If your app is basic, you won't have to touch the gradle files. However, I'd recommend learning gradle a bit (see: http://www.gradle.org/docs/current/userguide/userguide_single.html). I find it simple to understand, you just need to get used to the syntax and such.
To be fair, the rest of the software development world has had build runners et al for a long time, and everyone uses them. The Java world has possibly one of the best I've ever come across: Gradle. Even PHP has them now!