Skip to content

Commit

Permalink
ConstraintTypeCoercer is unconfigured-only coercer
Browse files Browse the repository at this point in the history
Reviewed By: gabrielrussoc

shipit-source-id: eca9cc1112f19f6d1c8fa10b299365de4b2bf1f8
  • Loading branch information
stepancheg authored and facebook-github-bot committed Feb 26, 2020
1 parent 894492a commit 83d458d
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions src/com/facebook/buck/rules/coercer/ConstraintTypeCoercer.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,26 @@
package com.facebook.buck.rules.coercer;

import com.facebook.buck.core.cell.nameresolver.CellNameResolver;
import com.facebook.buck.core.model.TargetConfiguration;
import com.facebook.buck.core.path.ForwardRelativePath;
import com.facebook.buck.io.filesystem.ProjectFilesystem;
import com.facebook.buck.versions.Constraint;
import com.facebook.buck.versions.ExactConstraint;
import com.facebook.buck.versions.Version;
import com.google.common.reflect.TypeToken;

public class ConstraintTypeCoercer extends LeafTypeCoercer<Constraint> {
/** Coerce to {@link com.facebook.buck.versions.Constraint}. */
public class ConstraintTypeCoercer extends LeafUnconfiguredOnlyCoercer<Constraint> {

@Override
public TypeToken<Constraint> getOutputType() {
public TypeToken<Constraint> getUnconfiguredType() {
return TypeToken.of(Constraint.class);
}

@Override
public TypeToken<Object> getUnconfiguredType() {
return TypeToken.of(Object.class);
}

@Override
public Object coerceToUnconfigured(
CellNameResolver cellRoots,
ProjectFilesystem filesystem,
ForwardRelativePath pathRelativeToProjectRoot,
Object object)
throws CoerceFailedException {
return object;
}

@Override
public Constraint coerce(
public Constraint coerceToUnconfigured(
CellNameResolver cellRoots,
ProjectFilesystem filesystem,
ForwardRelativePath pathRelativeToProjectRoot,
TargetConfiguration targetConfiguration,
TargetConfiguration hostConfiguration,
Object object)
throws CoerceFailedException {
if (object instanceof String) {
Expand Down

0 comments on commit 83d458d

Please sign in to comment.