Jonas Ragaišis Programų sistemų 2M kursas Vilnius, 2015 Gradle Jonas Ragaišis Programų sistemų 2M kursas Vilnius, 2015
Gradle open source build automation system builds upon the concepts of Apache Ant and Apache Maven introduces a Groovy-based domain-specific language (DSL)
Why gradle? Designed for multi-project builds which can grow to be quite large Supports incremental builds Tracks version upgrades
Polyglot builds Linkedin uses Gradle to build 60 different programming languages
Tool integrations
Robust Dependency Management Retrieve artifacts from any known binary repository, from public to private to local. Flat
High Performance Builds Gradle avoids unnecessary workload by caching: remote metadata and artifacts transitive dependency resolution build execution plan plugin inputs and outputs test results
Packs all the gear to build enterprise software for the JVM Test frameworks: JUnit, TestNG, Spock Application frameworks: Java EE, Grails, Play!, Code analysis cops: Checkstyle, CodeNarc, FindBugs, JDepend, PMD, JaCoCo, Sonar
Reliable incremental builds
Partial builds Gradle helps quickly accomplish the task by only building parts of the project
Efficient test execution Filter tests by type, group or pattern Run a single test Rerun failed tests Fail fast (stop on first failure) Run tests in parallel Distribute tests across multiple runtimes or machines Skip tests when not needed
Gradle’s Daemon cuts startup time to near zero enhances incremental builds reuses the execution plan between subsequent builds monitors changes to make builds reactive lets you move seamlessly between the IDE and command line performs preemptive work and maintenance tasks
From continuous integration to delivery Get feedback sooner thanks to CI job caching and Gradle’s incremental build capabilities. Activate Gradle’s numerous reports to inspect build results, troubleshoot problems and monitor build performance. Use Gradle’s publishing tasks to turn the CI server into a publishing tool and release manager. Push artifacts to a binary repository, documentation to a web server or your app to a staging or production environment.
Android studio Automatic configuration of build variants and multiple APK file generation ProGuard obfuscation App-signing capabilities Vector drawables Project wizard for creating a Gradle-based project Command line and IDE compatibility
Repositories repositories { jcenter() mavenCentral() maven { url 'https://twittersdk.artifactoryonline.com/twittersdk/public/' } maven { url 'https://maven.fabric.io/public' } }
Global parameters maven { credentials { username projectNexusUsername password projectNexusPassword } url 'http://nexus.app.lan/nexus/content/repositories/releases'
Android project configuration (1/x) compileSdkVersion 23 buildToolsVersion "23.0.1" useLibrary 'org.apache.http.legacy' packagingOptions { exclude 'META-INF/LICENSE' exclude 'META-INF/NOTICE' exclude 'META-INF/services/javax.annotation.processing.Processor' }
Android project configuration (2/x) dexOptions { incremental true javaMaxHeapSize "2048M" } lintOptions { checkReleaseBuilds false abortOnError false disable 'InvalidPackage'
Android project configuration (3/x) defaultConfig { applicationId "lt.lemonlabs.android.mob.payment" minSdkVersion 14 targetSdkVersion 22 multiDexEnabled true resValue 'string', 'config_app_name', 'Wallet'
Android project configuration (4/x) buildConfigField "String", "CARD_RELATION_URI", '"wallet://card/related"' buildConfigField "String", "API_BASE_URI", '"https://wallet.com"' buildConfigField "String", "API_CLIENT_MAC_ID", '"AB14sAp3OwKSeCZk"' buildConfigField 'boolean', 'FEATURE_FLAG_SCAN_HISTORY', 'false' buildConfigField 'boolean', 'FEATURE_FLAG_PIN_LOCK', 'true'
Android project configuration (5/x) signingConfigs { beta { storeFile file("keys/beta.keystore") storePassword "android" keyAlias "alias_name" keyPassword "android" }
Android project configuration (6/x) productFlavors { prod { versionCode 34 versionName "1.1.25" buildConfigField "String", "NEWRELIC_KEY", '"AB8413efaesba5a3Fsd25"' resValue 'string', 'config_google_maps_api_key', 'AIZad23OTiX86iB74' }
Android project configuration (7/x) sourceSets { main { jniLibs.srcDirs = ['libs'] java.srcDirs = ['src/main/java', 'src/main/java-gen', 'src/main/kotlin'] }
Android project configuration (8/x) buildTypes { release { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' shrinkResources true productFlavors.beta.signingConfig signingConfigs.beta }
Android project configuration (9/x) dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" compile 'com.android.support:support-v4:23.1.0' compile 'com.android.support:design:23.0.1' compile fileTree(dir: 'libs', include: ['*.jar']) compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') { transitive = true }
Semantic Versioning v3.10.672 MAJOR version when you make incompatible API changes, MINOR version when you add functionality in a backwards-compatible manner, and PATCH version when you make backwards-compatible bug fixes.
Alternatives Rake (DSL + Ruby) Apache Buildr (DSL + Ruby) Scons (DSL + Python) Simple Build Tool (DSL + Scala)
Off topic :) Dockercraft - simple Minecraft Docker client, to visualize and manage Docker containers. https://github.com/docker/dockercraft You can start, stop and remove containers interacting with levers and buttons. Some Docker commands are also supported directly via Minecraft's chat window