File: build.gradle

package info (click to toggle)
android-platform-tools-base 2.2.2-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 113,928 kB
  • sloc: java: 696,396; xml: 45,920; cpp: 2,526; ansic: 1,432; sh: 508; lisp: 110; javascript: 108; makefile: 17
file content (58 lines) | stat: -rw-r--r-- 1,593 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
apply plugin: 'java'


dependencies {
    compile project(':base:annotations')
}

group = 'com.android.tools.build'
archivesBaseName = 'builder-model'
version = rootProject.ext.buildVersion

project.ext.pomName = 'Android Builder Model library'
project.ext.pomDesc = 'Model for the Builder library.'

project.ext.apiVersion = rootProject.ext.apiVersion ?: 0

// because the model is passed from the IDE to Gradle, no matter
// what version of Gradle Plugin is running, we need to keep this
// as Java6 bytecode in case Studio 2.2 loads a project running
// an older plugin in a JDK6 VM.
sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6


["Model-Version": version, "Model-Api-Version": apiVersion].each { key, value ->
    jar.manifest.attributes((key): value)
}

def generated = new File("${project.buildDir}/generated/java")

sourceSets {
    main {
        java {
            srcDir generated
        }
    }
}

task generateVersionConstantsJava {
    inputs.property("apiVersion", apiVersion)
    inputs.property("version", version)
    ext.versionFile = new File(generated, "com/android/builder/model/Version.java")
    outputs.file(versionFile)
}
generateVersionConstantsJava << {
    versionFile.parentFile.mkdirs()
    versionFile.text = """
package com.android.builder.model;

public final class Version {
    private Version() {}
    public static final String ANDROID_GRADLE_PLUGIN_VERSION = "$version";
    public static final int BUILDER_MODEL_API_VERSION = $apiVersion;
}
"""
}

tasks.compileJava.dependsOn generateVersionConstantsJava