APISonar


com.android.tools.idea.gradle.dsl.api.GradleBuildModel.android

> com > android > tools > idea > gradle > dsl > api > GradleBuildModel > android
com APIs android APIs tools APIs idea APIs gradle APIs dsl APIs api APIs GradleBuildModel APIs android APIs

Example 1
private void editBuildFile(@NotNull VirtualFile moduleDir) {
    Project project = myModel.project().getValue();
    ProjectBuildModel projectBuildModel = ProjectBuildModel.get(project);
    GradleBuildModel buildModel = projectBuildModel.getModuleBuildModel(moduleDir);
    AndroidModel android = buildModel.android();
    CompileOptionsModel options = android.compileOptions();
    LanguageLevelPropertyModel source = options.sourceCompatibility();
    source.setLanguageLevel(LanguageLevel.JDK_1_8);
    LanguageLevelPropertyModel target = options.targetCompatibility();
    target.setLanguageLevel(LanguageLevel.JDK_1_8);
    DependenciesModel deps = buildModel.dependencies();
    deps.addModule("implementation", ":flutter");
    runWriteCommandAction(project, "build", "import", buildModel::applyChanges);
  }