Skip to content

Commit

Permalink
Upgraded Gradle and Android Tools
Browse files Browse the repository at this point in the history
  • Loading branch information
hierynomus committed Jun 6, 2016
1 parent 01fc363 commit 25ca349
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -53,7 +53,7 @@ dependencies {
exclude group: 'org.apache.maven', module: 'maven-plugin-api'
exclude group: 'org.apache.maven', module: 'maven-project'
}
compile 'com.android.tools.build:gradle:1.0.+', optional
compile 'com.android.tools.build:gradle:2.0.+', optional
compile gradleApi()

testCompile 'junit:junit:4.11'
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip
@@ -1,13 +1,13 @@
/* License added by: GRADLE-LICENSE-PLUGIN
*
* Copyright (C)2011 - Jeroen van Erp <jeroen@javadude.nl>
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -34,7 +34,7 @@ class LicensePlugin implements Plugin<Project> {
static final String DEFAULT_FILE_NAME_FOR_REPORTS_BY_DEPENDENCY = "dependency-license"
static final String DEFAULT_FILE_NAME_FOR_REPORTS_BY_LICENSE = "license-dependency"
static final String DEFAULT_DEPENDENCY_CONFIGURATION_TO_HANDLE = "runtime"

protected Project project
protected LicenseExtension extension
protected DownloadLicensesExtension downloadLicensesExtension
Expand All @@ -45,7 +45,7 @@ class LicensePlugin implements Plugin<Project> {
protected Task baseCheckTask
protected Task baseFormatTask
protected Task downloadLicenseTask

void apply(Project project) {
this.project = project
project.plugins.apply(ReportingBasePlugin)
Expand Down Expand Up @@ -107,7 +107,7 @@ class LicensePlugin implements Plugin<Project> {
sourceSets = { [] }
}
}


logger.info("Adding license extension");
return extension
Expand Down Expand Up @@ -157,7 +157,7 @@ class LicensePlugin implements Plugin<Project> {

/**
* We'll be creating the tasks by default based on the source sets, but users could define their
* own, and we'd still want it configured.
* own, and we'd still want it configured.
* TODO: Confirm that user defined tasks will get this configuration, it'd have to be lazily evaluated
* @param task
*/
Expand Down Expand Up @@ -281,7 +281,7 @@ class LicensePlugin implements Plugin<Project> {
// This follows the other check task pattern
project.plugins.withType(pluginType) {
extension.sourceSets.all { sourceSet ->
def sourceSetTaskName = (taskBaseName + 'Android' + sourceSet.name.capitalize())
def sourceSetTaskName = "${taskBaseName}Android${sourceSet.name.capitalize()}"
logger.info("[AndroidLicensePlugin] Adding license tasks for sourceSet ${sourceSetTaskName}");

License checkTask = project.tasks.create(sourceSetTaskName, License)
Expand All @@ -290,7 +290,7 @@ class LicensePlugin implements Plugin<Project> {
baseCheckTask.dependsOn checkTask

// Add independent license task, which will perform format
def sourceSetFormatTaskName = (taskBaseName + 'FormatAndroid'+ sourceSet.name.capitalize())
def sourceSetFormatTaskName = "${taskBaseName}FormatAndroid${sourceSet.name.capitalize()}"
License formatTask = project.tasks.create(sourceSetFormatTaskName, License)
formatTask.check = false
configureForAndroidSourceSet(sourceSet, formatTask)
Expand All @@ -301,7 +301,7 @@ class LicensePlugin implements Plugin<Project> {
}

// Add license checking into check lifecycle, since its a type of code quality plugin

project.tasks['check'].dependsOn baseCheckTask

}
Expand All @@ -316,17 +316,17 @@ class LicensePlugin implements Plugin<Project> {
sourceSet.properties.each { key, val ->
logger.debug("[AndroidLicensePlugin] sourceSet.$key:$val");
}

ArrayList androidSource = new ArrayList<File>();

for (File file : sourceSet.java.sourceFiles) {
androidSource.add(file);
}

for (File file : sourceSet.res.sourceFiles) {
androidSource.add(file);
}

task.source = project.files(androidSource)

}
Expand Down
@@ -1,13 +1,13 @@
/* License added by: GRADLE-LICENSE-PLUGIN
*
* Copyright (C)2011 - Jeroen van Erp <jeroen@javadude.nl>
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -92,54 +92,54 @@ class AndroidLicensePluginTest {
project.license.header = project.file("OTHERLICENSE")
assertThat(project.license.header.name, is("OTHERLICENSE"))
}


@Test
public void shouldFindTwoLicenseTaskPerSourceSet() {
def tasks = project.tasks.withType(License.class).findAll { true }
assertThat tasks.size(), is(8) // [main,androidTest, release, debug].count * 2
assertThat tasks.size(), is(14) // [androidTest, debug, main, release, test, testDebug, testRelease].count * 2
}

@Test
public void shouldFindMainLicenseTask() {
def task = project.tasks.getByName("licenseAndroidMain")
assertThat task, instanceOf(License.class)
}

@Test
public void shouldFindDebugLicenseTask() {
def task = project.tasks.getByName("licenseAndroidDebug")
assertThat task, instanceOf(License.class)
}

@Test
public void shouldFindReleaseLicenseTask() {
def task = project.tasks.getByName("licenseAndroidRelease")
assertThat task, instanceOf(License.class)
}

@Test
public void shouldFindTestLicenseTask() {
def task = project.tasks.getByName("licenseAndroidAndroidTest")
assertThat task, instanceOf(License.class)
}

@Test
public void extensionShouldHaveSourceSetsWithJava() {
assertThat project.license.sourceSets.size(), equalTo(project.sourceSets.size())
}

@Test
public void shouldConfigureLicenseForTasks() {
def task = project.tasks['licenseAndroidMain']

assertThat task.header.name, is("LICENSE")
}

@Test
public void shouldConfigureManuallyConfiguredTask() {
def task = project.tasks.create('licenseManual', License)

assertThat task.header.name, is("LICENSE")
}

Expand All @@ -149,7 +149,7 @@ class AndroidLicensePluginTest {

assertThat project.license.ignoreFailures, is(false) // Default
assertThat task.ignoreFailures, is(false)

project.license.ignoreFailures = true
assertThat task.isIgnoreFailures(), is(true)
//assertThat task.getIgnoreFailures(), is(true) // GRADLE-2163, fixed in 1.0-rc1
Expand All @@ -174,7 +174,7 @@ class AndroidLicensePluginTest {
Set<Task> dependsOn = project.tasks['license'].getDependsOn()
assertThat dependsOn, hasItem(project.tasks['licenseAndroidMain'])
assertThat dependsOn, hasItem(project.tasks['licenseAndroidAndroidTest'])

// Manual tests don't get registered with check
assertThat dependsOn, not(hasItem(task))

Expand All @@ -185,7 +185,7 @@ class AndroidLicensePluginTest {
// Manual tests don't get registered with check
assertThat dependsOnFormat, not(hasItem(task))
}

@Test
public void canAddMappingsAtMultipleLevels() {
def task = project.tasks['licenseAndroidMain']
Expand All @@ -200,4 +200,4 @@ class AndroidLicensePluginTest {
assert mappings.containsKey('map1')
assert mappings.containsKey('map2')
}
}
}

0 comments on commit 25ca349

Please sign in to comment.