com.android.builder.model.Dependencies Java Examples
The following examples show how to use
com.android.builder.model.Dependencies.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LintGradleProject.java From javaide with GNU General Public License v3.0 | 6 votes |
/** * Creates a {@link LintGradleProject} from * the given {@link com.android.builder.model.AndroidProject} definition for * a given {@link com.android.builder.model.Variant}, and returns it along with * a set of lint custom rule jars applicable for the given model project. * * @param client the client * @param project the model project * @param variant the variant * @param gradleProject the gradle project * @return a pair of new project and list of custom rule jars */ @NonNull public static Pair<LintGradleProject, List<File>> create( @NonNull LintGradleClient client, @NonNull AndroidProject project, @NonNull Variant variant, @NonNull org.gradle.api.Project gradleProject) { File dir = gradleProject.getProjectDir(); AppGradleProject lintProject = new AppGradleProject(client, dir, dir, project, variant); List<File> customRules = Lists.newArrayList(); File appLintJar = new File(gradleProject.getBuildDir(), "lint" + separatorChar + "lint.jar"); if (appLintJar.exists()) { customRules.add(appLintJar); } Set<AndroidLibrary> libraries = Sets.newHashSet(); Dependencies dependencies = variant.getMainArtifact().getDependencies(); for (AndroidLibrary library : dependencies.getLibraries()) { lintProject.addDirectLibrary(createLibrary(client, library, libraries, customRules)); } return Pair.<LintGradleProject, List<File>>of(lintProject, customRules); }
Example #2
Source File: JavaArtifactImpl.java From javaide with GNU General Public License v3.0 | 6 votes |
public JavaArtifactImpl(@NonNull String name, @NonNull String assembleTaskName, @NonNull String compileTaskName, @NonNull Iterable<String> ideSetupTaskNames, @NonNull Collection<File> generatedSourceFolders, @NonNull File classesFolder, @NonNull File javaResourcesFolder, @Nullable File mockablePlatformJar, @NonNull Dependencies dependencies, @Nullable SourceProvider variantSourceProvider, @Nullable SourceProvider multiFlavorSourceProviders) { super(name, assembleTaskName, compileTaskName, classesFolder, javaResourcesFolder, dependencies, variantSourceProvider, multiFlavorSourceProviders, generatedSourceFolders); this.ideSetupTaskNames = Sets.newHashSet(ideSetupTaskNames); this.mockablePlatformJar = mockablePlatformJar; }
Example #3
Source File: BaseArtifactImpl.java From javaide with GNU General Public License v3.0 | 6 votes |
BaseArtifactImpl(@NonNull String name, @NonNull String assembleTaskName, @NonNull String compileTaskName, @NonNull File classesFolder, @NonNull File javaResourcesFolder, @NonNull Dependencies dependencies, @Nullable SourceProvider variantSourceProvider, @Nullable SourceProvider multiFlavorSourceProviders, @NonNull Collection<File> generatedSourceFolders) { this.name = name; this.assembleTaskName = assembleTaskName; this.compileTaskName = compileTaskName; this.classesFolder = classesFolder; this.javaResourcesFolder = javaResourcesFolder; this.dependencies = dependencies; this.variantSourceProvider = variantSourceProvider; this.multiFlavorSourceProviders = multiFlavorSourceProviders; this.generatedSourceFolders = generatedSourceFolders; }
Example #4
Source File: LintGradleProject.java From javaide with GNU General Public License v3.0 | 5 votes |
protected static boolean dependsOn(@NonNull Dependencies dependencies, @NonNull String artifact) { for (AndroidLibrary library : dependencies.getLibraries()) { if (dependsOn(library, artifact)) { return true; } } return false; }
Example #5
Source File: DependenciesImpl.java From javaide with GNU General Public License v3.0 | 5 votes |
@NonNull static DependenciesImpl cloneDependenciesForJavaArtifacts(@NonNull Dependencies dependencies) { List<AndroidLibrary> libraries = Collections.emptyList(); List<JavaLibrary> javaLibraries = Lists.newArrayList(dependencies.getJavaLibraries()); List<String> projects = Collections.emptyList(); return new DependenciesImpl(libraries, javaLibraries, projects); }
Example #6
Source File: AndroidArtifactImpl.java From javaide with GNU General Public License v3.0 | 5 votes |
AndroidArtifactImpl( @NonNull String name, @NonNull Collection<AndroidArtifactOutput> outputs, @NonNull String assembleTaskName, boolean isSigned, @Nullable String signingConfigName, @NonNull String applicationId, @NonNull String sourceGenTaskName, @NonNull String compileTaskName, @NonNull List<File> generatedSourceFolders, @NonNull List<File> generatedResourceFolders, @NonNull File classesFolder, @NonNull File javaResourcesFolder, @NonNull Dependencies dependencies, @Nullable SourceProvider variantSourceProvider, @Nullable SourceProvider multiFlavorSourceProviders, @NonNull Collection<NativeLibrary> nativeLibraries, @NonNull Map<String, ClassField> buildConfigFields, @NonNull Map<String, ClassField> resValues) { super(name, assembleTaskName, compileTaskName, classesFolder, javaResourcesFolder, dependencies, variantSourceProvider, multiFlavorSourceProviders, generatedSourceFolders); this.outputs = outputs; this.isSigned = isSigned; this.signingConfigName = signingConfigName; this.applicationId = applicationId; this.sourceGenTaskName = sourceGenTaskName; this.generatedResourceFolders = generatedResourceFolders; this.nativeLibraries = nativeLibraries; this.buildConfigFields = buildConfigFields; this.resValues = resValues; }
Example #7
Source File: PrivateResourceDetectorTest.java From javaide with GNU General Public License v3.0 | 5 votes |
public static AndroidArtifact createMockArtifact(List<AndroidLibrary> libraries) { Dependencies dependencies = mock(Dependencies.class); when(dependencies.getLibraries()).thenReturn(libraries); AndroidArtifact artifact = mock(AndroidArtifact.class); when(artifact.getDependencies()).thenReturn(dependencies); return artifact; }
Example #8
Source File: AndroidSupport.java From meghanada-server with GNU General Public License v3.0 | 5 votes |
private void parseExtraJavaArtifacts(Set<ProjectDependency> dependencies, Variant variant) { String buildType = variant.getBuildType(); boolean debugBuild = buildType.equals(DEBUG_BUILD); Collection<JavaArtifact> extraJavaArtifacts = variant.getExtraJavaArtifacts(); for (JavaArtifact javaArtifact : extraJavaArtifacts) { if (debugBuild) { Collection<File> generatedSourceFolders = javaArtifact.getGeneratedSourceFolders(); for (File src : generatedSourceFolders) { this.project.getSources().add(src); } } Dependencies compileDependencies = javaArtifact.getDependencies(); Collection<AndroidLibrary> libraries = compileDependencies.getLibraries(); for (AndroidLibrary androidLibrary : libraries) { Collection<File> localJars = androidLibrary.getLocalJars(); for (File jar : localJars) { addDependencies(dependencies, jar); } } Collection<JavaLibrary> javaLibraries = compileDependencies.getJavaLibraries(); for (JavaLibrary javaLibrary : javaLibraries) { File file = javaLibrary.getJarFile(); addDependencies(dependencies, file); } } }
Example #9
Source File: BaseArtifactImpl.java From javaide with GNU General Public License v3.0 | 4 votes |
@NonNull @Override public Dependencies getDependencies() { return dependencies; }
Example #10
Source File: GradleDetectorTest.java From javaide with GNU General Public License v3.0 | 4 votes |
@Override protected TestLintClient createClient() { return new TestLintClient() { @Nullable @Override public File getSdkHome() { return getMockSupportLibraryInstallation(); } @NonNull @Override protected Project createProject(@NonNull File dir, @NonNull File referenceDir) { if (!"testDependenciesInVariables".equals(getName())) { return super.createProject(dir, referenceDir); } return new Project(this, dir, referenceDir) { @Override public boolean isGradleProject() { return true; } @Nullable @Override public Variant getCurrentVariant() { /* Simulate variant which has an AndroidLibrary with resolved coordinates com.google.android.gms:play-services-wearable:5.0.77" */ MavenCoordinates coordinates = mock(MavenCoordinates.class); when(coordinates.getGroupId()).thenReturn("com.google.android.gms"); when(coordinates.getArtifactId()).thenReturn("play-services-wearable"); when(coordinates.getVersion()).thenReturn("5.0.77"); AndroidLibrary library = mock(AndroidLibrary.class); when(library.getResolvedCoordinates()).thenReturn(coordinates); List<AndroidLibrary> libraries = Collections.singletonList(library); Dependencies dependencies = mock(Dependencies.class); when(dependencies.getLibraries()).thenReturn(libraries); AndroidArtifact artifact = mock(AndroidArtifact.class); when(artifact.getDependencies()).thenReturn(dependencies); Variant variant = mock(Variant.class); when(variant.getMainArtifact()).thenReturn(artifact); return variant; } }; } }; }