use of com.android.builder.model.JavaLibrary in project meghanada-server by mopemope.
the class AndroidSupport method parseExtraJavaArtifacts.
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);
}
}
}
use of com.android.builder.model.JavaLibrary in project meghanada-server by mopemope.
the class AndroidSupport method parseExtraAndroidArtifacts.
private void parseExtraAndroidArtifacts(Set<ProjectDependency> dependencies, Variant variant) {
String buildType = variant.getBuildType();
boolean debugBuild = buildType.equals(DEBUG_BUILD);
Collection<AndroidArtifact> extraAndroidArtifacts = variant.getExtraAndroidArtifacts();
for (AndroidArtifact androidArtifact : extraAndroidArtifacts) {
String name = androidArtifact.getName();
boolean isTest = name.contains(TEST_SUFFIX);
if (debugBuild) {
Collection<File> generatedSourceFolders = androidArtifact.getGeneratedSourceFolders();
for (File src : generatedSourceFolders) {
if (isTest) {
this.project.getTestSources().add(src);
} else {
this.project.getSources().add(src);
}
}
Collection<File> generatedResourceFolders = androidArtifact.getGeneratedResourceFolders();
for (File src : generatedResourceFolders) {
if (isTest) {
this.project.getTestResources().add(src);
} else {
this.project.getResources().add(src);
}
}
}
Dependencies compileDependencies = androidArtifact.getDependencies();
// getLibraries
Collection<AndroidLibrary> libraries = compileDependencies.getLibraries();
for (AndroidLibrary androidLibrary : libraries) {
Collection<File> localJars = androidLibrary.getLocalJars();
if (localJars.isEmpty()) {
File jar = androidLibrary.getJarFile();
addDependencies(dependencies, jar);
} else {
for (File jar : localJars) {
addDependencies(dependencies, jar);
}
}
}
// getJavaLibraries
Collection<JavaLibrary> javaLibraries = compileDependencies.getJavaLibraries();
for (JavaLibrary javaLibrary : javaLibraries) {
File file = javaLibrary.getJarFile();
addDependencies(dependencies, file);
}
}
}
use of com.android.builder.model.JavaLibrary in project atlas by alibaba.
the class AtlasDepTreeParser method check.
private void check(AtlasDependencyTree atlasDependencyTree) {
Map<String, List<String>> dependeys = new HashMap<>();
for (AwbBundle awbBundle : atlasDependencyTree.getAwbBundles()) {
String gav = awbBundle.getAndroidLibrary().getResolvedCoordinates().toString();
for (AndroidLibrary androidLibrary : awbBundle.getAndroidLibraries()) {
addValuetoList(dependeys, gav, androidLibrary.getResolvedCoordinates().toString());
}
for (JavaLibrary javaLibrary : awbBundle.getJavaLibraries()) {
addValuetoList(dependeys, gav, javaLibrary.getResolvedCoordinates().toString());
}
for (SoLibrary soLibrary : awbBundle.getSoLibraries()) {
addValuetoList(dependeys, gav, soLibrary.getResolvedCoordinates().toString());
}
}
List<String> warnings = new ArrayList<>();
for (String key : dependeys.keySet()) {
List<String> values = dependeys.get(key);
if (values.size() > 1) {
String msg = key + ":" + StringUtils.join(values, ",");
warnings.add(msg);
logger.warning(msg);
}
}
if (warnings.size() > 0) {
logger.warning(JSON.toJSONString(atlasDependencyTree.getDependencyJson(), true));
throw new GradleException("decencyconflict : " + StringUtils.join(warnings, "\r\n"));
}
}
use of com.android.builder.model.JavaLibrary in project atlas by alibaba.
the class AwbBundle method getLibraryJars.
/**
* Get all the associated jars
*
* @return
*/
public List<File> getLibraryJars() {
List<File> jars = Lists.newArrayList();
jars.add(androidLibrary.getJarFile());
Collection<File> localJars = androidLibrary.getLocalJars();
if (null != localJars) {
jars.addAll(localJars);
}
if (null != androidLibraries) {
for (AndroidLibrary aarBundle : androidLibraries) {
if (aarBundle.getJarFile().exists()) {
jars.add(aarBundle.getJarFile());
}
jars.addAll(aarBundle.getLocalJars());
}
}
if (null != javaLibraries) {
for (JavaLibrary javaLibrary : javaLibraries) {
if (javaLibrary.getJarFile().exists()) {
jars.add(javaLibrary.getJarFile());
}
}
}
return jars;
}
Aggregations