use of org.jetbrains.jps.android.model.AndroidApplicationArtifactType in project android by JetBrains.
the class AndroidArtifactBuildTaskProvider method createArtifactBuildTasks.
@NotNull
@Override
public List<? extends BuildTask> createArtifactBuildTasks(@NotNull JpsArtifact artifact, @NotNull ArtifactBuildPhase buildPhase) {
if (buildPhase != ArtifactBuildPhase.FINISHING_BUILD) {
return Collections.emptyList();
}
if (!(artifact.getArtifactType() instanceof AndroidApplicationArtifactType)) {
return Collections.emptyList();
}
final JpsElement props = artifact.getProperties();
if (!(props instanceof JpsAndroidApplicationArtifactProperties)) {
return Collections.emptyList();
}
final JpsAndroidApplicationArtifactProperties androidProps = (JpsAndroidApplicationArtifactProperties) props;
if (!(artifact.getArtifactType() instanceof AndroidApplicationArtifactType)) {
return Collections.emptyList();
}
final AndroidArtifactSigningMode signingMode = androidProps.getSigningMode();
if (signingMode != AndroidArtifactSigningMode.RELEASE_SIGNED && signingMode != AndroidArtifactSigningMode.DEBUG_WITH_CUSTOM_CERTIFICATE) {
return Collections.emptyList();
}
final JpsAndroidModuleExtension extension = AndroidJpsUtil.getPackagedFacet(artifact);
return extension != null ? Collections.singletonList(new MyTask(artifact, extension, androidProps)) : Collections.<BuildTask>emptyList();
}
use of org.jetbrains.jps.android.model.AndroidApplicationArtifactType in project android by JetBrains.
the class AndroidSourceGeneratingBuilder method checkUnambiguousAndRecursiveArtifacts.
private static boolean checkUnambiguousAndRecursiveArtifacts(CompileContext context, List<JpsArtifact> artifacts) {
boolean success = true;
for (JpsArtifact artifact : artifacts) {
if (artifact.getArtifactType() instanceof AndroidApplicationArtifactType) {
final List<JpsAndroidModuleExtension> facets = AndroidJpsUtil.getAllPackagedFacets(artifact);
if (facets.size() > 1) {
context.processMessage(new CompilerMessage(ANDROID_VALIDATOR, BuildMessage.Kind.ERROR, "Cannot build artifact '" + artifact.getName() + "' because it contains more than one Android package"));
success = false;
continue;
}
final String artifactOutputPath = artifact.getOutputFilePath();
if (artifactOutputPath != null && facets.size() > 0) {
final JpsAndroidModuleExtension facet = facets.get(0);
final String apkPath = AndroidFinalPackageElementBuilder.getApkPath(facet);
if (FileUtil.pathsEqual(apkPath, artifactOutputPath)) {
context.processMessage(new CompilerMessage(ANDROID_VALIDATOR, BuildMessage.Kind.ERROR, "Incorrect output path for artifact '" + artifact.getName() + "': " + FileUtil.toSystemDependentName(apkPath)));
success = false;
}
}
}
}
return success;
}
Aggregations