use of com.android.tools.idea.gradle.dsl.model.repositories.RepositoriesModel in project android by JetBrains.
the class GradleBuildModel method repositories.
@NotNull
public RepositoriesModel repositories() {
RepositoriesDslElement repositoriesDslElement = myGradleDslFile.getPropertyElement(REPOSITORIES_BLOCK_NAME, RepositoriesDslElement.class);
if (repositoriesDslElement == null) {
repositoriesDslElement = new RepositoriesDslElement(myGradleDslFile);
myGradleDslFile.setNewElement(REPOSITORIES_BLOCK_NAME, repositoriesDslElement);
}
return new RepositoriesModel(repositoriesDslElement);
}
use of com.android.tools.idea.gradle.dsl.model.repositories.RepositoriesModel in project android by JetBrains.
the class BuildScriptModel method repositories.
@NotNull
public RepositoriesModel repositories() {
RepositoriesDslElement repositoriesDslElement = myDslElement.getPropertyElement(REPOSITORIES_BLOCK_NAME, RepositoriesDslElement.class);
if (repositoriesDslElement == null) {
repositoriesDslElement = new RepositoriesDslElement(myDslElement);
myDslElement.setNewElement(REPOSITORIES_BLOCK_NAME, repositoriesDslElement);
}
return new RepositoriesModel(repositoriesDslElement);
}
use of com.android.tools.idea.gradle.dsl.model.repositories.RepositoriesModel in project android by JetBrains.
the class BuildScriptModelTest method testParseRepositories.
public void testParseRepositories() throws IOException {
String text = "buildscript {\n" + " repositories {\n" + " jcenter()\n" + " }\n" + "}";
writeToBuildFile(text);
RepositoriesModel repositoriesModel = getGradleBuildModel().buildscript().repositories();
List<RepositoryModel> repositories = repositoriesModel.repositories();
assertThat(repositories).hasSize(1);
RepositoryModel repositoryModel = repositories.get(0);
assertTrue(repositoryModel instanceof JCenterDefaultRepositoryModel);
JCenterDefaultRepositoryModel repository = (JCenterDefaultRepositoryModel) repositoryModel;
assertEquals("name", "BintrayJCenter2", repository.name());
assertEquals("url", "https://jcenter.bintray.com/", repository.url());
}
Aggregations