Skip to content

Commit

Permalink
Add configuration to disable generating protocol version 1.0.0 reques…
Browse files Browse the repository at this point in the history
…t builders.

RB=1889124
G=sf-reviewers
R=evwillia,kbalasub,dbuthay
A=kbalasub
  • Loading branch information
mchen07 committed Nov 22, 2019
1 parent db7c53d commit 3f4d1fb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
------
[pegasus] Disable SymlinkAwareZooKeeperTest temporarily

(RB=1889124)
Add configuration to disable generating deprecated protocol version 1.0.0 request builders.

28.0.6
------
(RB=1887898)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ public class PegasusPlugin implements Plugin<Project>
private static final String IDL_NO_PUBLISH = "rest.idl.noPublish";
private static final String SKIP_IDL_CHECK = "rest.idl.skipCheck";
private static final String SUPPRESS_REST_CLIENT_RESTLI_2 = "rest.client.restli2.suppress";
private static final String SUPPRESS_REST_CLIENT_RESTLI_1 = "rest.client.restli1.suppress";

private static final String GENERATOR_CLASSLOADER_NAME = "pegasusGeneratorClassLoader";

Expand Down Expand Up @@ -1648,6 +1649,7 @@ protected void configureRestClientGeneration(Project project, SourceSet sourceSe
task.setCodegenClasspath(project.getConfigurations().getByName("pegasusPlugin"));
task.setDestinationDir(generatedRestClientDir);
task.setRestli2FormatSuppressed(project.hasProperty(SUPPRESS_REST_CLIENT_RESTLI_2));
task.setRestli1FormatSuppressed(project.hasProperty(SUPPRESS_REST_CLIENT_RESTLI_1));
});

if (dataTemplateJarTask != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class GenerateRestClientTask extends DefaultTask
private FileCollection _runtimeClasspath;
private FileCollection _codegenClasspath;
private File _destinationDir;
private boolean _restli1FormatSuppressed;
private boolean _restli2FormatSuppressed;
private boolean _restli1BuildersDeprecated = true;

Expand Down Expand Up @@ -100,8 +101,10 @@ public void generate()

String restModelFilePath = _inputDir.toString() + File.separatorChar + clientItem.restModelFileName;

version1Files.computeIfAbsent(defaultPackage, key -> new ArrayList<>())
.add(restModelFilePath);
if (!_restli1FormatSuppressed)
{
version1Files.computeIfAbsent(defaultPackage, key -> new ArrayList<>()).add(restModelFilePath);
}

if (!_restli2FormatSuppressed)
{
Expand Down Expand Up @@ -256,6 +259,17 @@ public void setRestli2FormatSuppressed(boolean restli2FormatSuppressed)
_restli2FormatSuppressed = restli2FormatSuppressed;
}

@Internal
public boolean isRestli1FormatSuppressed()
{
return _restli1FormatSuppressed;
}

public void setRestli1FormatSuppressed(boolean restli1FormatSuppressed)
{
_restli1FormatSuppressed = restli1FormatSuppressed;
}

/**
* This method is kept for backwards compatibility.
* <p>
Expand Down

0 comments on commit 3f4d1fb

Please sign in to comment.