Skip to content

Commit

Permalink
Fix to/from closure type in JibExtension (#1061)
Browse files Browse the repository at this point in the history
* Fix to/from closure type in JibExtension

* Remove interface
  • Loading branch information
loosebazooka authored and coollog committed Oct 8, 2018
1 parent 09844e9 commit 4a4a477
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
import javax.inject.Inject;
import org.gradle.api.Action;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Nested;
import org.gradle.api.tasks.Optional;

/** {@link ImageParameters} that configure the base image. */
public class BaseImageParameters implements ImageParameters {
/** Object in {@link JibExtension} that configures the base image. */
public class BaseImageParameters {

private final AuthParameters auth;

Expand All @@ -34,34 +37,34 @@ public BaseImageParameters(ObjectFactory objectFactory, String imageDescriptor)
auth = objectFactory.newInstance(AuthParameters.class, imageDescriptor + ".auth");
}

@Input
@Nullable
@Override
@Optional
public String getImage() {
return image;
}

@Override
public void setImage(String image) {
this.image = image;
}

@Input
@Nullable
@Override
@Optional
public String getCredHelper() {
return credHelper;
}

@Override
public void setCredHelper(String credHelper) {
this.credHelper = credHelper;
}

@Override
@Nested
@Optional
public AuthParameters getAuth() {
return auth;
}

@Override
public void auth(Action<? super AuthParameters> action) {
action.execute(auth);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ void handleDeprecatedParameters(JibLogger logger) {
}
}

public void from(Action<? super ImageParameters> action) {
public void from(Action<? super BaseImageParameters> action) {
action.execute(from);
}

public void to(Action<? super ImageParameters> action) {
public void to(Action<? super TargetImageParameters> action) {
action.execute(to);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
import org.gradle.api.Action;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Nested;
import org.gradle.api.tasks.Optional;

/** {@link ImageParameters} that configure the target image. */
public class TargetImageParameters implements ImageParameters {
/** Object in {@link JibExtension} that configures the target image. */
public class TargetImageParameters {

private final AuthParameters auth;

Expand All @@ -39,13 +40,13 @@ public TargetImageParameters(ObjectFactory objectFactory, String imageDescriptor
auth = objectFactory.newInstance(AuthParameters.class, imageDescriptor + ".auth");
}

@Input
@Nullable
@Override
@Optional
public String getImage() {
return image;
}

@Override
public void setImage(String image) {
this.image = image;
}
Expand All @@ -60,23 +61,23 @@ public void setTags(Set<String> tags) {
this.tags = tags;
}

@Input
@Nullable
@Override
@Optional
public String getCredHelper() {
return credHelper;
}

@Override
public void setCredHelper(String credHelper) {
this.credHelper = credHelper;
}

@Override
@Nested
@Optional
public AuthParameters getAuth() {
return auth;
}

@Override
public void auth(Action<? super AuthParameters> action) {
action.execute(auth);
}
Expand Down

0 comments on commit 4a4a477

Please sign in to comment.