use of com.android.tools.idea.gradle.dsl.parser.elements.GradleDslLiteral in project android by JetBrains.
the class SigningConfigModel method setStoreFile.
public SigningConfigModel setStoreFile(@NotNull String storeFile) {
if (myDslElement.getPropertyElement(STORE_FILE) == null) {
GradleDslMethodCall methodCall = new GradleDslMethodCall(myDslElement, "file", STORE_FILE);
GradleDslLiteral literal = new GradleDslLiteral(methodCall, "");
literal.setValue(storeFile);
methodCall.addNewArgument(literal);
myDslElement.setNewElement(STORE_FILE, methodCall);
} else {
GradleDslExpression expression = getStoreFileExpression();
if (expression != null) {
expression.setValue(storeFile);
}
}
return this;
}
use of com.android.tools.idea.gradle.dsl.parser.elements.GradleDslLiteral in project android by JetBrains.
the class SigningConfigModel method setPasswordValue.
private void setPasswordValue(@NotNull String property, @NotNull Type type, @NotNull String text) {
if (type == PLAIN_TEXT) {
myDslElement.setNewLiteral(property, text);
return;
}
GradleNullableValue<SigningConfigPassword> passwordValue = getPasswordValue(property);
SigningConfigPassword password = passwordValue.value();
if (password != null && password.getType() == type) {
GradleDslExpression element = getPasswordElement(property);
if (element != null) {
element.setValue(text);
return;
}
}
GradleDslMethodCall methodCall = null;
if (type == ENVIRONMENT_VARIABLE) {
methodCall = new GradleDslMethodCall(myDslElement, SYSTEM_GETENV, property);
} else if (type == CONSOLE_READ) {
methodCall = new GradleDslMethodCall(myDslElement, SYSTEM_CONSOLE_READ_LINE, property);
}
if (methodCall != null) {
GradleDslLiteral argumentElement = new GradleDslLiteral(methodCall, methodCall.getName());
argumentElement.setValue(text);
methodCall.addNewArgument(argumentElement);
myDslElement.setNewElement(property, methodCall);
}
}
Aggregations