Search in sources :

Example 16 with Dependency

use of org.gradle.api.artifacts.Dependency in project gradle by gradle.

the class PlayRunAdapterV23X method getRunsupportClasspathDependencies.

@Override
public Iterable<Dependency> getRunsupportClasspathDependencies(String playVersion, String scalaCompatibilityVersion) {
    ImmutableList.Builder<Dependency> listBuilder = ImmutableList.builder();
    String runsupportPlayVersion = playVersion;
    boolean transitive = true;
    // use run-support from 2.3.7 for versions before Play 2.3.7
    if (VersionNumber.parse(playVersion).compareTo(MINIMUM_PLAY_VERSION_WITH_RUN_SUPPORT) < 0) {
        runsupportPlayVersion = "2.3.7";
        transitive = false;
    }
    DefaultExternalModuleDependency runSupportDependency = new DefaultExternalModuleDependency("com.typesafe.play", RUN_SUPPORT_PLAY_MODULE + "_" + scalaCompatibilityVersion, runsupportPlayVersion);
    runSupportDependency.setTransitive(transitive);
    listBuilder.add(runSupportDependency);
    String name = scalaCompatibilityVersion.equals("2.10") ? "io" : ("io_" + scalaCompatibilityVersion);
    DefaultExternalModuleDependency dependency = new DefaultExternalModuleDependency("org.scala-sbt", name, getIOSupportDependencyVersion(), "runtime");
    dependency.setTransitive(false);
    listBuilder.add(dependency);
    return listBuilder.build();
}
Also used : ImmutableList(com.google.common.collect.ImmutableList) DefaultExternalModuleDependency(org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency) DefaultExternalModuleDependency(org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency) Dependency(org.gradle.api.artifacts.Dependency)

Example 17 with Dependency

use of org.gradle.api.artifacts.Dependency in project gradle by gradle.

the class JsHintPlugin method addConfiguration.

public Configuration addConfiguration(ConfigurationContainer configurations, final DependencyHandler dependencies, final JsHintExtension extension) {
    Configuration configuration = configurations.create(JsHintExtension.CONFIGURATION_NAME);
    configuration.defaultDependencies(new Action<DependencySet>() {

        @Override
        public void execute(DependencySet configDependencies) {
            String notation = JsHintExtension.DEFAULT_DEPENDENCY_GROUP + ":" + JsHintExtension.DEFAULT_DEPENDENCY_MODULE + ":" + extension.getVersion() + "@js";
            Dependency dependency = dependencies.create(notation);
            configDependencies.add(dependency);
        }
    });
    return configuration;
}
Also used : Configuration(org.gradle.api.artifacts.Configuration) DependencySet(org.gradle.api.artifacts.DependencySet) Dependency(org.gradle.api.artifacts.Dependency)

Example 18 with Dependency

use of org.gradle.api.artifacts.Dependency in project gradle by gradle.

the class EnvJsPlugin method addConfiguration.

public Configuration addConfiguration(ConfigurationContainer configurations, final DependencyHandler dependencies, final EnvJsExtension extension) {
    Configuration configuration = configurations.create(EnvJsExtension.CONFIGURATION_NAME);
    configuration.defaultDependencies(new Action<DependencySet>() {

        @Override
        public void execute(DependencySet configDependencies) {
            String notation = EnvJsExtension.DEFAULT_DEPENDENCY_GROUP + ":" + EnvJsExtension.DEFAULT_DEPENDENCY_MODULE + ":" + extension.getVersion() + "@js";
            Dependency dependency = dependencies.create(notation);
            configDependencies.add(dependency);
        }
    });
    return configuration;
}
Also used : Configuration(org.gradle.api.artifacts.Configuration) DependencySet(org.gradle.api.artifacts.DependencySet) Dependency(org.gradle.api.artifacts.Dependency)

Example 19 with Dependency

use of org.gradle.api.artifacts.Dependency in project gradle by gradle.

the class DefaultIdeDependencyResolver method getIdeLocalFileDependencies.

/**
     * Gets IDE local file dependencies.
     *
     * @param configuration Configuration
     * @return IDE local file dependencies
     */
public List<IdeLocalFileDependency> getIdeLocalFileDependencies(Configuration configuration) {
    List<SelfResolvingDependency> externalDependencies = new ArrayList<SelfResolvingDependency>();
    findAllExternalDependencies(externalDependencies, new ArrayList<Dependency>(), configuration);
    List<IdeLocalFileDependency> ideLocalFileDependencies = new ArrayList<IdeLocalFileDependency>();
    for (SelfResolvingDependency externalDependency : externalDependencies) {
        Set<File> resolvedFiles = externalDependency.resolve(configuration.isTransitive());
        for (File resolvedFile : resolvedFiles) {
            IdeLocalFileDependency ideLocalFileDependency = new IdeLocalFileDependency(resolvedFile);
            ideLocalFileDependencies.add(ideLocalFileDependency);
        }
    }
    return ideLocalFileDependencies;
}
Also used : IdeLocalFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeLocalFileDependency) SelfResolvingDependency(org.gradle.api.artifacts.SelfResolvingDependency) ArrayList(java.util.ArrayList) UnresolvedIdeRepoFileDependency(org.gradle.plugins.ide.internal.resolver.model.UnresolvedIdeRepoFileDependency) SelfResolvingDependency(org.gradle.api.artifacts.SelfResolvingDependency) ProjectDependency(org.gradle.api.artifacts.ProjectDependency) IdeLocalFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeLocalFileDependency) IdeProjectDependency(org.gradle.plugins.ide.internal.resolver.model.IdeProjectDependency) IdeExtendedRepoFileDependency(org.gradle.plugins.ide.internal.resolver.model.IdeExtendedRepoFileDependency) Dependency(org.gradle.api.artifacts.Dependency) File(java.io.File)

Example 20 with Dependency

use of org.gradle.api.artifacts.Dependency in project atlas by alibaba.

the class PrepareAPTask method generate.

/**
     * 生成so的目录
     */
@TaskAction
void generate() {
    Project project = getProject();
    File apBaseFile = null;
    if (null != apContext.getApFile() && apContext.getApFile().exists()) {
        apBaseFile = apContext.getApFile();
    } else if (StringUtils.isNotBlank(apContext.getApDependency())) {
        Dependency dependency = project.getDependencies().create(apContext.getApDependency());
        Configuration configuration = project.getConfigurations().detachedConfiguration(dependency);
        configuration.setTransitive(false);
        for (File file : configuration.getFiles()) {
            if (file.getName().endsWith(".ap")) {
                apBaseFile = file;
                break;
            }
        }
    }
    if (null != apBaseFile && apBaseFile.exists()) {
        File explodedDir = project.file(project.getBuildDir().getAbsolutePath() + "/" + FD_INTERMEDIATES + "/exploded-ap" + "/");
        ZipUtils.unzip(apBaseFile, explodedDir.getAbsolutePath());
        apContext.setApExploredFolder(explodedDir);
        apContext.setBaseApk(new File(explodedDir, "android.apk"));
    }
}
Also used : Project(org.gradle.api.Project) Configuration(org.gradle.api.artifacts.Configuration) Dependency(org.gradle.api.artifacts.Dependency) File(java.io.File) MtlBaseTaskAction(com.taobao.android.builder.tasks.manager.MtlBaseTaskAction) TaskAction(org.gradle.api.tasks.TaskAction)

Aggregations

Dependency (org.gradle.api.artifacts.Dependency)25 Configuration (org.gradle.api.artifacts.Configuration)9 FileCollectionDependency (org.gradle.api.artifacts.FileCollectionDependency)7 File (java.io.File)4 DependencySet (org.gradle.api.artifacts.DependencySet)4 ProjectDependency (org.gradle.api.artifacts.ProjectDependency)4 TaskDependency (org.gradle.api.tasks.TaskDependency)4 LinkedHashSet (java.util.LinkedHashSet)3 ModuleDependency (org.gradle.api.artifacts.ModuleDependency)3 SelfResolvingDependency (org.gradle.api.artifacts.SelfResolvingDependency)3 AbstractTaskDependency (org.gradle.api.internal.tasks.AbstractTaskDependency)3 ImmutableList (com.google.common.collect.ImmutableList)2 ArrayList (java.util.ArrayList)2 ExcludeRule (org.gradle.api.artifacts.ExcludeRule)2 ResolvedConfiguration (org.gradle.api.artifacts.ResolvedConfiguration)2 UnresolvedDependency (org.gradle.api.artifacts.UnresolvedDependency)2 DefaultExcludeRule (org.gradle.api.internal.artifacts.DefaultExcludeRule)2 DependencyGraphNodeResult (org.gradle.api.internal.artifacts.DependencyGraphNodeResult)2 DefaultExternalModuleDependency (org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency)2 FileCollectionInternal (org.gradle.api.internal.file.FileCollectionInternal)2