Search in sources :

Example 1 with EtlasResolver

use of com.typelead.gradle.eta.internal.EtlasResolver in project gradle-eta by typelead.

the class EtaSetupEnvironment method resolveEtlas.

private ResolvedExecutable resolveEtlas() {
    EtlasResolver resolver = new EtlasResolver(getCacheDir());
    ExecutableSpec spec = etlasSpec.get();
    ResolvedExecutable resolvedEtlas = null;
    if (spec instanceof NoSpec) {
        throw new GradleException("Etlas not configured, please supply a value for the 'etlasVersion'" + " property in an eta { .. } block.");
    } else if (spec instanceof SystemSpec) {
        resolvedEtlas = resolver.resolveInSystemPath();
        getProject().getLogger().info("Using etlas from system PATH: " + resolvedEtlas.getPath());
    } else if (spec instanceof PathSpec) {
        resolvedEtlas = resolver.resolveLocalPath(((PathSpec) spec).getPath());
    } else if (spec instanceof VersionSpec) {
        String etlasRepo = getEtlasRepository();
        if (etlasRepo == null) {
            throw new GradleException("etlasVersion provided, but etlasRepo was unexpectedly null!");
        }
        resolvedEtlas = resolver.resolveRemote(etlasRepo, ((VersionSpec) spec).getVersion());
    }
    return resolvedEtlas;
}
Also used : NoSpec(com.typelead.gradle.utils.NoSpec) ResolvedExecutable(com.typelead.gradle.utils.ResolvedExecutable) ExecutableSpec(com.typelead.gradle.utils.ExecutableSpec) GradleException(org.gradle.api.GradleException) SystemSpec(com.typelead.gradle.utils.SystemSpec) EtlasResolver(com.typelead.gradle.eta.internal.EtlasResolver) PathSpec(com.typelead.gradle.utils.PathSpec) VersionSpec(com.typelead.gradle.utils.VersionSpec)

Aggregations

EtlasResolver (com.typelead.gradle.eta.internal.EtlasResolver)1 ExecutableSpec (com.typelead.gradle.utils.ExecutableSpec)1 NoSpec (com.typelead.gradle.utils.NoSpec)1 PathSpec (com.typelead.gradle.utils.PathSpec)1 ResolvedExecutable (com.typelead.gradle.utils.ResolvedExecutable)1 SystemSpec (com.typelead.gradle.utils.SystemSpec)1 VersionSpec (com.typelead.gradle.utils.VersionSpec)1 GradleException (org.gradle.api.GradleException)1