use of com.typelead.gradle.utils.VersionSpec 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;
}
use of com.typelead.gradle.utils.VersionSpec in project gradle-eta by typelead.
the class EtaSetupEnvironment method resolveEta.
private ResolvedExecutable resolveEta(EtlasCommand etlas) {
ResolvedExecutable resolvedEta;
ExecutableSpec spec = etaSpec.get();
boolean system = false;
boolean fresh = false;
String message = null;
String etaVersion = null;
if (spec instanceof NoSpec) {
message = "latest available version";
etaVersion = etlas.getLatestEtaVersion();
} else if (spec instanceof SystemSpec) {
system = true;
message = "version available on your system";
etaVersion = etlas.getGlobalEtaVersion();
} else if (spec instanceof PathSpec) {
throw new GradleException("etaSpec should never have a value PathSpec");
} else if (spec instanceof VersionSpec) {
final String friendlyEtaVersion = ((VersionSpec) spec).getVersion();
etaVersion = machineVersion(friendlyEtaVersion);
fresh = !etlas.getInstalledEtaVersions().contains(friendlyEtaVersion);
}
if (message != null) {
getProject().getLogger().lifecycle("WARNING: You have not explicitly set the version of Eta to be used, " + "so the " + message + ", " + friendlyVersion(etaVersion) + ", will be used." + NEWLINE + NEWLINE + "This is not recommended since it will make this build " + "non-reproducible. Please supply a value for the 'version' property " + "in an eta { .. } block.");
}
return new ResolvedExecutable(null, etaVersion, system, fresh);
}
Aggregations