Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to gradle 5 #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies {
compile gradleApi()
compile localGroovy()

provided 'com.android.tools.build:gradle:3.0.0'
provided 'com.android.tools.build:gradle:3.5.2'

testCompile gradleTestKit()
testCompile 'junit:junit:4.12'
Expand Down Expand Up @@ -68,3 +68,11 @@ pluginBundle {
}
}
}

// allprojects {
// gradle.projectsEvaluated {
// tasks.withType(JavaCompile) {
// options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
// }
// }
// }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip
5 changes: 5 additions & 0 deletions src/main/java/com/typelead/gradle/eta/api/EtaExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ public EtaExtension(final Project project) {
resolvedEtaInfo = objectFactory.property(EtaInfo.class);
resolvedEtlas = objectFactory.property(ResolvedExecutable.class);

resolvedEta.set(new ResolvedExecutable(
parseStringProperty(project, "etlasPath"),
parseStringProperty(project, "etlasVersion")
));

preInstallDependencies = objectFactory.property(Boolean.class);
preInstallDependencies.set(false);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.typelead.gradle.eta.internal;

import javax.inject.Inject;
import java.util.Optional;

import groovy.lang.Closure;

Expand All @@ -19,11 +20,11 @@ public class DefaultEtaSourceSet implements EtaSourceSet {
private final SourceDirectorySet eta;

@Inject
public DefaultEtaSourceSet(SourceSet sourceSet,
public DefaultEtaSourceSet(Optional<SourceSet> sourceSet,
String name,
String displayName,
SourceDirectorySetFactory sourceDirectorySetFactory) {
this.sourceSet = sourceSet;
this.sourceSet = sourceSet.isPresent() ? sourceSet.get() : null;
this.eta = sourceDirectorySetFactory.create(name, displayName + " Eta source");
eta.getFilter().include("**/*.eta", "**/*.hs");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.File;
import java.util.HashSet;
import java.util.Set;
import java.util.Optional;

import javax.inject.Inject;

Expand Down Expand Up @@ -83,8 +84,8 @@ private void configureEtaSourceSetConvention() {

final DefaultEtaSourceSet etaSourceSet =
project.getObjects().newInstance
(DefaultEtaSourceSet.class, null, ETA_SOURCE_SET_NAME,
((DefaultAndroidSourceSet) sourceSet).getDisplayName(),
(DefaultEtaSourceSet.class, Optional.empty(), ETA_SOURCE_SET_NAME,
((DefaultAndroidSourceSet) sourceSet).getName(),
sourceDirectorySetFactory);

ExtensionHelper.createConvention
Expand Down Expand Up @@ -122,6 +123,7 @@ private void configureBaseVariant(BaseVariant variant) {
project.getLogger()
.debug("Processing variant " + variantName + " for Eta compilation.");

// Use getJavaCompileProvider for newer API, but reserve this for backward compatibility
final JavaCompile javaCompileTask = variant.getJavaCompile();

if (javaCompileTask == null) {
Expand Down Expand Up @@ -181,6 +183,7 @@ private void configureBaseVariant(BaseVariant variant) {
configuration, it must run *before* the preBuild phase since every task
after that will resolve configurations. */

// Use getPreBuildProvider for newer API, but reserve this for backward compatibility
variant.getPreBuild().dependsOn(installDependenciesTask);

/* Create the compile task. */
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/com/typelead/gradle/eta/plugins/EtaPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.File;
import java.util.Map;
import java.util.HashMap;
import java.util.Optional;

import javax.inject.Inject;

Expand Down Expand Up @@ -96,7 +97,7 @@ private void configureSourceSet(SourceSet sourceSet) {

final DefaultEtaSourceSet etaSourceSet =
project.getObjects().newInstance
(DefaultEtaSourceSet.class, sourceSet, "eta",
(DefaultEtaSourceSet.class, Optional.ofNullable(sourceSet), "eta",
((DefaultSourceSet) sourceSet).getDisplayName(),
sourceDirectorySetFactory);

Expand Down Expand Up @@ -175,8 +176,11 @@ private void configureSourceSet(SourceSet sourceSet) {
project.getLayout().getBuildDirectory();
if (sourceSet.getOutput().isLegacyLayout()) {
return buildDir.dir(buildDir.getAsFile().get().toPath()
.relativize(sourceSet.getOutput()
.getClassesDir().toPath())
.relativize(sourceSet
.getOutput()
.getClassesDirs()
.getSingleFile()
.toPath())
.toString()).get();
}
return buildDir.dir(etaSourceSet.getClassesDir()).get();
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/com/typelead/gradle/utils/OverridingProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,33 @@ public boolean isPresent() {
public <S> Provider<S> map(Transformer<? extends S, ? super T> transformer) {
throw new UnsupportedOperationException("The map operation is not provided by OverridingProperty!");
}

@Override
public <S> Provider<S> flatMap(Transformer<? extends Provider<? extends S>, ? super T> transformer) {
throw new UnsupportedOperationException("The flatMap operation is not provided by OverridingProperty!");
}

@Override
public void finalizeValue() {
throw new UnsupportedOperationException("The finalizeValue operation is not provided by OverridingProperty!");
}

@Override
public Property<T> convention(Provider<? extends T> valueProvider) {
throw new UnsupportedOperationException("The convention operation is not provided by OverridingProperty!");
}

@Override
public Property<T> convention(T value) {
throw new UnsupportedOperationException("The convention operation is not provided by OverridingProperty!");
}

public Property<T> value(Provider<? extends T> provider) {
throw new UnsupportedOperationException("The value operation is not provided by OverridingProperty!");
}

@Override
public Property<T> value(T value) {
throw new UnsupportedOperationException("The value operation is not provided by OverridingProperty!");
}
}