com.android.builder.model.JavaArtifact Java Examples
The following examples show how to use
com.android.builder.model.JavaArtifact.
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: JavaArtifactImpl.java From javaide with GNU General Public License v3.0 | 6 votes |
public static JavaArtifactImpl clone(@NonNull JavaArtifact javaArtifact) { SourceProvider variantSP = javaArtifact.getVariantSourceProvider(); SourceProvider flavorsSP = javaArtifact.getMultiFlavorSourceProvider(); return new JavaArtifactImpl( javaArtifact.getName(), javaArtifact.getAssembleTaskName(), javaArtifact.getCompileTaskName(), javaArtifact.getIdeSetupTaskNames(), javaArtifact.getGeneratedSourceFolders(), javaArtifact.getClassesFolder(), javaArtifact.getJavaResourcesFolder(), javaArtifact.getMockablePlatformJar(), DependenciesImpl.cloneDependenciesForJavaArtifacts(javaArtifact.getDependencies()), variantSP != null ? SourceProviderImpl.cloneProvider(variantSP) : null, flavorsSP != null ? SourceProviderImpl.cloneProvider(flavorsSP) : null); }
Example #2
Source File: VariantImpl.java From javaide with GNU General Public License v3.0 | 6 votes |
VariantImpl(@NonNull String name, @NonNull String displayName, @NonNull String buildTypeName, @NonNull List<String> productFlavorNames, @NonNull ProductFlavorImpl mergedFlavor, @NonNull AndroidArtifact mainArtifactInfo, @NonNull Collection<AndroidArtifact> extraAndroidArtifacts, @NonNull Collection<JavaArtifact> extraJavaArtifacts) { this.name = name; this.displayName = displayName; this.buildTypeName = buildTypeName; this.productFlavorNames = productFlavorNames; this.mergedFlavor = mergedFlavor; this.mainArtifactInfo = mainArtifactInfo; this.extraAndroidArtifacts = extraAndroidArtifacts; this.extraJavaArtifacts = extraJavaArtifacts; }
Example #3
Source File: ExtraModelInfo.java From javaide with GNU General Public License v3.0 | 5 votes |
public void registerJavaArtifact( @NonNull String name, @NonNull BaseVariant variant, @NonNull String assembleTaskName, @NonNull String javaCompileTaskName, @NonNull Collection<File> generatedSourceFolders, @NonNull Iterable<String> ideSetupTaskNames, @NonNull Configuration configuration, @NonNull File classesFolder, @NonNull File javaResourcesFolder, @Nullable SourceProvider sourceProvider) { ArtifactMetaData artifactMetaData = extraArtifactMap.get(name); if (artifactMetaData == null) { throw new IllegalArgumentException(String.format( "Artifact with name %1$s is not yet registered. Use registerArtifactType()", name)); } if (artifactMetaData.getType() != ArtifactMetaData.TYPE_JAVA) { throw new IllegalArgumentException( String.format("Artifact with name %1$s is not of type JAVA", name)); } JavaArtifact artifact = new JavaArtifactImpl( name, assembleTaskName, javaCompileTaskName, ideSetupTaskNames, generatedSourceFolders, classesFolder, javaResourcesFolder, null, new ConfigurationDependencies(configuration), sourceProvider, null); extraJavaArtifacts.put(variant.getName(), artifact); }
Example #4
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 #5
Source File: VariantImpl.java From javaide with GNU General Public License v3.0 | 4 votes |
@NonNull @Override public Collection<JavaArtifact> getExtraJavaArtifacts() { return extraJavaArtifacts; }
Example #6
Source File: ModelBuilder.java From javaide with GNU General Public License v3.0 | 4 votes |
@NonNull private VariantImpl createVariant( @NonNull BaseVariantData<? extends BaseVariantOutputData> variantData) { AndroidArtifact mainArtifact = createAndroidArtifact(ARTIFACT_MAIN, variantData); GradleVariantConfiguration variantConfiguration = variantData.getVariantConfiguration(); String variantName = variantConfiguration.getFullName(); List<AndroidArtifact> extraAndroidArtifacts = Lists.newArrayList( extraModelInfo.getExtraAndroidArtifacts(variantName)); // Make sure all extra artifacts are serializable. Collection<JavaArtifact> extraJavaArtifacts = extraModelInfo.getExtraJavaArtifacts( variantName); List<JavaArtifact> clonedExtraJavaArtifacts = Lists.newArrayListWithCapacity( extraJavaArtifacts.size()); for (JavaArtifact javaArtifact : extraJavaArtifacts) { clonedExtraJavaArtifacts.add(JavaArtifactImpl.clone(javaArtifact)); } // if the target is a codename, override the model value. ApiVersion sdkVersionOverride = null; // we know the getTargetInfo won't return null here. @SuppressWarnings("ConstantConditions") IAndroidTarget androidTarget = androidBuilder.getTargetInfo().getTarget(); AndroidVersion version = androidTarget.getVersion(); if (version.getCodename() != null) { sdkVersionOverride = ApiVersionImpl.clone(version); } return new VariantImpl( variantName, variantConfiguration.getBaseName(), variantConfiguration.getBuildType().getName(), getProductFlavorNames(variantData), ProductFlavorImpl.cloneFlavor( variantConfiguration.getMergedFlavor(), sdkVersionOverride, sdkVersionOverride), mainArtifact, extraAndroidArtifacts, clonedExtraJavaArtifacts); }
Example #7
Source File: ExtraModelInfo.java From javaide with GNU General Public License v3.0 | 4 votes |
public Collection<JavaArtifact> getExtraJavaArtifacts(@NonNull String variantName) { return extraJavaArtifacts.get(variantName); }