Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #143 from novoda/update-gradle-4.2
Browse files Browse the repository at this point in the history
Upgrade to the latest gradle version (4.2.1)
  • Loading branch information
Xavi Rigau authored Oct 31, 2017
2 parents e1eca2c + 42c402d commit 8f1b80f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ allprojects {
google()
jcenter()
}
version = "0.6.1"
version = "0.7.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,25 @@ import org.gradle.api.attributes.Usage
import org.gradle.api.internal.DefaultDomainObjectSet
import org.gradle.api.internal.component.SoftwareComponentInternal
import org.gradle.api.internal.component.UsageContext
import org.gradle.api.model.ObjectFactory

class AndroidLibrary implements SoftwareComponentInternal {

private final UsageContext runtimeUsage

public static AndroidLibrary newInstance(Project project) {

ObjectFactory objectFactory = project.getObjects();
Usage usage = objectFactory.named(Usage.class, Usage.JAVA_RUNTIME);


def configuration = project.configurations.getByName("compile")
return configuration ? from(configuration) : empty()
return configuration ? from(configuration, usage) : empty()
}

static AndroidLibrary from(def configuration) {
def usage = new RuntimeUsage(configuration.dependencies)
new AndroidLibrary(usage)
static AndroidLibrary from(def configuration, Usage usage) {
def runtimeUsage = new RuntimeUsage(configuration.dependencies, usage)
new AndroidLibrary(runtimeUsage)
}

static AndroidLibrary empty() {
Expand All @@ -44,13 +50,15 @@ class AndroidLibrary implements SoftwareComponentInternal {
private static class RuntimeUsage implements UsageContext {

private final DomainObjectSet<Dependency> runtimeDependencies
private final Usage usage;

RuntimeUsage(DomainObjectSet<Dependency> runtimeDependencies) {
RuntimeUsage(DomainObjectSet<Dependency> runtimeDependencies, Usage usage) {
this.usage = usage;
this.runtimeDependencies = runtimeDependencies
}

Usage getUsage() {
return Usage.FOR_RUNTIME
return usage;
}

public Set<PublishArtifact> getArtifacts() {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
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-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-all.zip

0 comments on commit 8f1b80f

Please sign in to comment.