mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 15:42:20 +00:00
Add output directory field to dartfix API
Change-Id: Ia2dc3e4d3a458f43e9f2b0c1a25418f10931920c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117442 Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
parent
93980b75ce
commit
dd83ded1e9
|
@ -172,6 +172,7 @@ const String EDIT_REQUEST_DARTFIX_INCLUDE_PEDANTIC_FIXES =
|
|||
'includePedanticFixes';
|
||||
const String EDIT_REQUEST_DARTFIX_INCLUDE_REQUIRED_FIXES =
|
||||
'includeRequiredFixes';
|
||||
const String EDIT_REQUEST_DARTFIX_OUTPUT_DIR = 'outputDir';
|
||||
const String EDIT_REQUEST_FORMAT = 'edit.format';
|
||||
const String EDIT_REQUEST_FORMAT_FILE = 'file';
|
||||
const String EDIT_REQUEST_FORMAT_LINE_LENGTH = 'lineLength';
|
||||
|
|
|
@ -7964,6 +7964,7 @@ class DiagnosticGetServerPortResult implements ResponseResult {
|
|||
* "includePedanticFixes": optional bool
|
||||
* "includeRequiredFixes": optional bool
|
||||
* "excludedFixes": optional List<String>
|
||||
* "outputDir": optional FilePath
|
||||
* }
|
||||
*
|
||||
* Clients may not extend, implement or mix-in this class.
|
||||
|
@ -7979,6 +7980,8 @@ class EditDartfixParams implements RequestParams {
|
|||
|
||||
List<String> _excludedFixes;
|
||||
|
||||
String _outputDir;
|
||||
|
||||
/**
|
||||
* A list of the files and directories for which edits should be suggested.
|
||||
*
|
||||
|
@ -8066,16 +8069,36 @@ class EditDartfixParams implements RequestParams {
|
|||
this._excludedFixes = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* The absolute and normalized path to a directory to which non-nullability
|
||||
* migration output will be written. The output is only produced if the
|
||||
* non-nullable fix is included. Files in the directory might be overwritten,
|
||||
* but no previously existing files will be deleted.
|
||||
*/
|
||||
String get outputDir => _outputDir;
|
||||
|
||||
/**
|
||||
* The absolute and normalized path to a directory to which non-nullability
|
||||
* migration output will be written. The output is only produced if the
|
||||
* non-nullable fix is included. Files in the directory might be overwritten,
|
||||
* but no previously existing files will be deleted.
|
||||
*/
|
||||
void set outputDir(String value) {
|
||||
this._outputDir = value;
|
||||
}
|
||||
|
||||
EditDartfixParams(List<String> included,
|
||||
{List<String> includedFixes,
|
||||
bool includePedanticFixes,
|
||||
bool includeRequiredFixes,
|
||||
List<String> excludedFixes}) {
|
||||
List<String> excludedFixes,
|
||||
String outputDir}) {
|
||||
this.included = included;
|
||||
this.includedFixes = includedFixes;
|
||||
this.includePedanticFixes = includePedanticFixes;
|
||||
this.includeRequiredFixes = includeRequiredFixes;
|
||||
this.excludedFixes = excludedFixes;
|
||||
this.outputDir = outputDir;
|
||||
}
|
||||
|
||||
factory EditDartfixParams.fromJson(
|
||||
|
@ -8111,11 +8134,17 @@ class EditDartfixParams implements RequestParams {
|
|||
excludedFixes = jsonDecoder.decodeList(jsonPath + ".excludedFixes",
|
||||
json["excludedFixes"], jsonDecoder.decodeString);
|
||||
}
|
||||
String outputDir;
|
||||
if (json.containsKey("outputDir")) {
|
||||
outputDir = jsonDecoder.decodeString(
|
||||
jsonPath + ".outputDir", json["outputDir"]);
|
||||
}
|
||||
return new EditDartfixParams(included,
|
||||
includedFixes: includedFixes,
|
||||
includePedanticFixes: includePedanticFixes,
|
||||
includeRequiredFixes: includeRequiredFixes,
|
||||
excludedFixes: excludedFixes);
|
||||
excludedFixes: excludedFixes,
|
||||
outputDir: outputDir);
|
||||
} else {
|
||||
throw jsonDecoder.mismatch(jsonPath, "edit.dartfix params", json);
|
||||
}
|
||||
|
@ -8142,6 +8171,9 @@ class EditDartfixParams implements RequestParams {
|
|||
if (excludedFixes != null) {
|
||||
result["excludedFixes"] = excludedFixes;
|
||||
}
|
||||
if (outputDir != null) {
|
||||
result["outputDir"] = outputDir;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -8163,7 +8195,8 @@ class EditDartfixParams implements RequestParams {
|
|||
includePedanticFixes == other.includePedanticFixes &&
|
||||
includeRequiredFixes == other.includeRequiredFixes &&
|
||||
listEqual(excludedFixes, other.excludedFixes,
|
||||
(String a, String b) => a == b);
|
||||
(String a, String b) => a == b) &&
|
||||
outputDir == other.outputDir;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -8176,6 +8209,7 @@ class EditDartfixParams implements RequestParams {
|
|||
hash = JenkinsSmiHash.combine(hash, includePedanticFixes.hashCode);
|
||||
hash = JenkinsSmiHash.combine(hash, includeRequiredFixes.hashCode);
|
||||
hash = JenkinsSmiHash.combine(hash, excludedFixes.hashCode);
|
||||
hash = JenkinsSmiHash.combine(hash, outputDir.hashCode);
|
||||
return JenkinsSmiHash.finish(hash);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1773,6 +1773,13 @@ abstract class IntegrationTestMixin {
|
|||
* If a name is specified that does not match the name of a known fix, an
|
||||
* error of type UNKNOWN_FIX will be generated.
|
||||
*
|
||||
* outputDir: FilePath (optional)
|
||||
*
|
||||
* The absolute and normalized path to a directory to which non-nullability
|
||||
* migration output will be written. The output is only produced if the
|
||||
* non-nullable fix is included. Files in the directory might be
|
||||
* overwritten, but no previously existing files will be deleted.
|
||||
*
|
||||
* Returns
|
||||
*
|
||||
* suggestions: List<DartFixSuggestion>
|
||||
|
@ -1806,12 +1813,14 @@ abstract class IntegrationTestMixin {
|
|||
{List<String> includedFixes,
|
||||
bool includePedanticFixes,
|
||||
bool includeRequiredFixes,
|
||||
List<String> excludedFixes}) async {
|
||||
List<String> excludedFixes,
|
||||
String outputDir}) async {
|
||||
var params = new EditDartfixParams(included,
|
||||
includedFixes: includedFixes,
|
||||
includePedanticFixes: includePedanticFixes,
|
||||
includeRequiredFixes: includeRequiredFixes,
|
||||
excludedFixes: excludedFixes)
|
||||
excludedFixes: excludedFixes,
|
||||
outputDir: outputDir)
|
||||
.toJson();
|
||||
var result = await server.send("edit.dartfix", params);
|
||||
ResponseDecoder decoder = new ResponseDecoder(null);
|
||||
|
|
|
@ -2561,6 +2561,7 @@ final Matcher isDiagnosticGetServerPortResult = new LazyMatcher(() =>
|
|||
* "includePedanticFixes": optional bool
|
||||
* "includeRequiredFixes": optional bool
|
||||
* "excludedFixes": optional List<String>
|
||||
* "outputDir": optional FilePath
|
||||
* }
|
||||
*/
|
||||
final Matcher isEditDartfixParams =
|
||||
|
@ -2570,7 +2571,8 @@ final Matcher isEditDartfixParams =
|
|||
"includedFixes": isListOf(isString),
|
||||
"includePedanticFixes": isBool,
|
||||
"includeRequiredFixes": isBool,
|
||||
"excludedFixes": isListOf(isString)
|
||||
"excludedFixes": isListOf(isString),
|
||||
"outputDir": isFilePath
|
||||
}));
|
||||
|
||||
/**
|
||||
|
|
|
@ -498,8 +498,12 @@ public interface AnalysisServer {
|
|||
* @param excludedFixes A list of names indicating which fixes should not be applied. If a name is
|
||||
* specified that does not match the name of a known fix, an error of type UNKNOWN_FIX will
|
||||
* be generated.
|
||||
* @param outputDir The absolute and normalized path to a directory to which non-nullability
|
||||
* migration output will be written. The output is only produced if the non-nullable fix is
|
||||
* included. Files in the directory might be overwritten, but no previously existing files
|
||||
* will be deleted.
|
||||
*/
|
||||
public void edit_dartfix(List<String> included, List<String> includedFixes, boolean includePedanticFixes, boolean includeRequiredFixes, List<String> excludedFixes, DartfixConsumer consumer);
|
||||
public void edit_dartfix(List<String> included, List<String> includedFixes, boolean includePedanticFixes, boolean includeRequiredFixes, List<String> excludedFixes, String outputDir, DartfixConsumer consumer);
|
||||
|
||||
/**
|
||||
* {@code edit.format}
|
||||
|
|
|
@ -2235,6 +2235,16 @@
|
|||
an error of type <tt>UNKNOWN_FIX</tt> will be generated.
|
||||
</p>
|
||||
</field>
|
||||
<field name="outputDir" optional="true">
|
||||
<ref>FilePath</ref>
|
||||
<p>
|
||||
The absolute and normalized path to a directory to which
|
||||
non-nullability migration output will be written. The output is only
|
||||
produced if the non-nullable fix is included. Files in the directory
|
||||
might be overwritten, but no previously existing files will be
|
||||
deleted.
|
||||
</p>
|
||||
</field>
|
||||
</params>
|
||||
<result>
|
||||
<field name="suggestions">
|
||||
|
|
|
@ -172,6 +172,7 @@ const String EDIT_REQUEST_DARTFIX_INCLUDE_PEDANTIC_FIXES =
|
|||
'includePedanticFixes';
|
||||
const String EDIT_REQUEST_DARTFIX_INCLUDE_REQUIRED_FIXES =
|
||||
'includeRequiredFixes';
|
||||
const String EDIT_REQUEST_DARTFIX_OUTPUT_DIR = 'outputDir';
|
||||
const String EDIT_REQUEST_FORMAT = 'edit.format';
|
||||
const String EDIT_REQUEST_FORMAT_FILE = 'file';
|
||||
const String EDIT_REQUEST_FORMAT_LINE_LENGTH = 'lineLength';
|
||||
|
|
|
@ -7964,6 +7964,7 @@ class DiagnosticGetServerPortResult implements ResponseResult {
|
|||
* "includePedanticFixes": optional bool
|
||||
* "includeRequiredFixes": optional bool
|
||||
* "excludedFixes": optional List<String>
|
||||
* "outputDir": optional FilePath
|
||||
* }
|
||||
*
|
||||
* Clients may not extend, implement or mix-in this class.
|
||||
|
@ -7979,6 +7980,8 @@ class EditDartfixParams implements RequestParams {
|
|||
|
||||
List<String> _excludedFixes;
|
||||
|
||||
String _outputDir;
|
||||
|
||||
/**
|
||||
* A list of the files and directories for which edits should be suggested.
|
||||
*
|
||||
|
@ -8066,16 +8069,36 @@ class EditDartfixParams implements RequestParams {
|
|||
this._excludedFixes = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* The absolute and normalized path to a directory to which non-nullability
|
||||
* migration output will be written. The output is only produced if the
|
||||
* non-nullable fix is included. Files in the directory might be overwritten,
|
||||
* but no previously existing files will be deleted.
|
||||
*/
|
||||
String get outputDir => _outputDir;
|
||||
|
||||
/**
|
||||
* The absolute and normalized path to a directory to which non-nullability
|
||||
* migration output will be written. The output is only produced if the
|
||||
* non-nullable fix is included. Files in the directory might be overwritten,
|
||||
* but no previously existing files will be deleted.
|
||||
*/
|
||||
void set outputDir(String value) {
|
||||
this._outputDir = value;
|
||||
}
|
||||
|
||||
EditDartfixParams(List<String> included,
|
||||
{List<String> includedFixes,
|
||||
bool includePedanticFixes,
|
||||
bool includeRequiredFixes,
|
||||
List<String> excludedFixes}) {
|
||||
List<String> excludedFixes,
|
||||
String outputDir}) {
|
||||
this.included = included;
|
||||
this.includedFixes = includedFixes;
|
||||
this.includePedanticFixes = includePedanticFixes;
|
||||
this.includeRequiredFixes = includeRequiredFixes;
|
||||
this.excludedFixes = excludedFixes;
|
||||
this.outputDir = outputDir;
|
||||
}
|
||||
|
||||
factory EditDartfixParams.fromJson(
|
||||
|
@ -8111,11 +8134,17 @@ class EditDartfixParams implements RequestParams {
|
|||
excludedFixes = jsonDecoder.decodeList(jsonPath + ".excludedFixes",
|
||||
json["excludedFixes"], jsonDecoder.decodeString);
|
||||
}
|
||||
String outputDir;
|
||||
if (json.containsKey("outputDir")) {
|
||||
outputDir = jsonDecoder.decodeString(
|
||||
jsonPath + ".outputDir", json["outputDir"]);
|
||||
}
|
||||
return new EditDartfixParams(included,
|
||||
includedFixes: includedFixes,
|
||||
includePedanticFixes: includePedanticFixes,
|
||||
includeRequiredFixes: includeRequiredFixes,
|
||||
excludedFixes: excludedFixes);
|
||||
excludedFixes: excludedFixes,
|
||||
outputDir: outputDir);
|
||||
} else {
|
||||
throw jsonDecoder.mismatch(jsonPath, "edit.dartfix params", json);
|
||||
}
|
||||
|
@ -8142,6 +8171,9 @@ class EditDartfixParams implements RequestParams {
|
|||
if (excludedFixes != null) {
|
||||
result["excludedFixes"] = excludedFixes;
|
||||
}
|
||||
if (outputDir != null) {
|
||||
result["outputDir"] = outputDir;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -8163,7 +8195,8 @@ class EditDartfixParams implements RequestParams {
|
|||
includePedanticFixes == other.includePedanticFixes &&
|
||||
includeRequiredFixes == other.includeRequiredFixes &&
|
||||
listEqual(excludedFixes, other.excludedFixes,
|
||||
(String a, String b) => a == b);
|
||||
(String a, String b) => a == b) &&
|
||||
outputDir == other.outputDir;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -8176,6 +8209,7 @@ class EditDartfixParams implements RequestParams {
|
|||
hash = JenkinsSmiHash.combine(hash, includePedanticFixes.hashCode);
|
||||
hash = JenkinsSmiHash.combine(hash, includeRequiredFixes.hashCode);
|
||||
hash = JenkinsSmiHash.combine(hash, excludedFixes.hashCode);
|
||||
hash = JenkinsSmiHash.combine(hash, outputDir.hashCode);
|
||||
return JenkinsSmiHash.finish(hash);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue