private boolean checkContentTypes( @NonNull Set<ContentType> contentTypes, @NonNull Transform transform) { for (ContentType contentType : contentTypes) { if (!(contentType instanceof QualifiedContent.DefaultContentType || contentType instanceof ExtendedContentType)) { errorReporter.handleSyncError(null, SyncIssue.TYPE_GENERIC, String.format("Custom content types (%1$s) are not supported in transforms (%2$s)", contentType.getClass().getName(), transform.getName())); return false; } } return true; }
/** * Check for user requested ABIs that aren't valid. Give a SyncIssue. */ private static void checkForRequestedButUnknownAbis ( @NonNull Collection<String> availableAbis, @NonNull Collection<String> userRequestedAbis, @NonNull AndroidBuilder androidBuilder, @NonNull String variantName) { List<String> requestedButNotAvailable = Lists.newArrayList(); for (String abiName : userRequestedAbis) { if (!availableAbis.contains(abiName)) { requestedButNotAvailable.add(abiName); } } if (!requestedButNotAvailable.isEmpty()) { androidBuilder.getErrorReporter().handleSyncError( variantName, SyncIssue.TYPE_EXTERNAL_NATIVE_BUILD_CONFIGURATION, String.format("ABIs [%s] are not available for platform and will be " + "excluded from building and packaging. Available ABIs are [%s].", Joiner.on(", ").join(requestedButNotAvailable), Joiner.on(", ").join(availableAbis))); } }
public void build(boolean forceJsonGeneration) { try { diagnostic("building json with force flag %s", forceJsonGeneration); buildAndPropagateException(forceJsonGeneration); } catch (@NonNull IOException | GradleException e ) { androidBuilder.getErrorReporter().handleSyncError( variantName, SyncIssue.TYPE_EXTERNAL_NATIVE_BUILD_CONFIGURATION, e.getMessage()); } catch (ProcessException e) { androidBuilder.getErrorReporter().handleSyncError( e.getMessage(), SyncIssue.TYPE_EXTERNAL_NATIVE_BUILD_PROCESS_EXCEPTION, String.format("executing external native build for %s %s", getNativeBuildSystem().getName(), makefile)); } }
private boolean validateTransform(@NonNull Transform transform) { // check the content type are of the right Type. if (!checkContentTypes(transform.getInputTypes(), transform) || !checkContentTypes(transform.getOutputTypes(), transform)) { return false; } // check some scopes are not consumed. Set<? super Scope> scopes = transform.getScopes(); // Allow Jack transform to consume provided classes as the .jack files are needed. if (scopes.contains(Scope.PROVIDED_ONLY) && !isJackRuntimeLib(transform)) { errorReporter.handleSyncError(null, SyncIssue.TYPE_GENERIC, String.format("PROVIDED_ONLY scope cannot be consumed by Transform '%1$s'", transform.getName())); return false; } if (scopes.contains(Scope.TESTED_CODE)) { errorReporter.handleSyncError(null, SyncIssue.TYPE_GENERIC, String.format("TESTED_CODE scope cannot be consumed by Transform '%1$s'", transform.getName())); return false; } return true; }
errorReporter.handleSyncError( library.getName(), SyncIssue.TYPE_OPTIONAL_LIB_NOT_FOUND,
resolvedConfiguration.rethrowFailure(); } catch (Exception e) { errorReporter.handleSyncError( "annotationProcessor", SyncIssue.TYPE_UNRESOLVED_DEPENDENCY,
@NonNull public Set<File> resolveAndGetJackPluginClassPath( @NonNull ErrorReporter errorReporter) { if (getJackPluginConfiguration().getAllDependencies().isEmpty()) { return Collections.emptySet(); } ResolvedConfiguration resolvedConfiguration = getJackPluginConfiguration().getResolvedConfiguration(); if (resolvedConfiguration.hasError()) { try { resolvedConfiguration.rethrowFailure(); } catch (Exception e) { errorReporter.handleSyncError( "jackPlugin", SyncIssue.TYPE_UNRESOLVED_DEPENDENCY, "Unable to find Jack plugin. " + e.getMessage()); return Collections.emptySet(); } } return getJackPluginConfiguration().getFiles(); }
/** * Sets the SdkInfo and the targetInfo on the builder. This is required to actually * build (some of the steps). * * @see com.android.builder.sdk.SdkLoader */ public void setTargetInfo(@NonNull TargetInfo targetInfo) { mTargetInfo = targetInfo; mDexByteCodeConverter = new DexByteCodeConverter( getLogger(), mTargetInfo, mJavaProcessExecutor, mVerboseExec); if (mTargetInfo.getBuildTools().getRevision().compareTo(MIN_BUILD_TOOLS_REV) < 0) { mErrorReporter.handleSyncError( MIN_BUILD_TOOLS_REV.toString(), SyncIssue.TYPE_BUILD_TOOLS_TOO_LOW, String.format( "The SDK Build Tools revision (%1$s) is too low for project '%2$s'. " + "Minimum required is %3$s", mTargetInfo.getBuildTools().getRevision(), mProjectId, MIN_BUILD_TOOLS_REV)); } }
if (Boolean.TRUE.equals(unbundledWearApp)) { if (hasWearAppDependency(variantData)) { androidBuilder.getErrorReporter().handleSyncError( scope.getFullVariantName(), SyncIssue.TYPE_DEPENDENCY_WEAR_APK_WITH_UNBUNDLED, androidBuilder.getErrorReporter().handleSyncError( configName, SyncIssue.TYPE_DEPENDENCY_WEAR_APK_TOO_MANY,
variantScope.getGlobalScope().getAndroidBuilder().getErrorReporter().handleSyncError( null, SyncIssue.TYPE_GENERIC,
errorReporter.handleSyncError( applicationId, SyncIssue.TYPE_GENERIC, String applicationIdSuffix = model.getDefaultConfig().getProductFlavor().getApplicationIdSuffix(); errorReporter.handleSyncError( applicationIdSuffix, SyncIssue.TYPE_GENERIC, if (buildType.getBuildType().getApplicationIdSuffix() != null) { String applicationIdSuffix = buildType.getBuildType().getApplicationIdSuffix(); errorReporter.handleSyncError( applicationIdSuffix, SyncIssue.TYPE_GENERIC, if (productFlavor.getProductFlavor().getApplicationId() != null) { String applicationId = productFlavor.getProductFlavor().getApplicationId(); errorReporter.handleSyncError( applicationId, SyncIssue.TYPE_GENERIC, String applicationIdSuffix = productFlavor.getProductFlavor().getApplicationIdSuffix(); errorReporter.handleSyncError( applicationIdSuffix, SyncIssue.TYPE_GENERIC, errorReporter.handleSyncError(
public void createExternalNativeBuildJsonGenerators(@NonNull VariantScope scope) { CoreExternalNativeBuild externalNativeBuild = extension.getExternalNativeBuild(); ExternalNativeBuildTaskUtils.ExternalNativeBuildProjectPathResolution pathResolution = ExternalNativeBuildTaskUtils.getProjectPath(externalNativeBuild); if (pathResolution.errorText != null) { androidBuilder.getErrorReporter().handleSyncError( scope.getVariantConfiguration().getFullName(), SyncIssue.TYPE_EXTERNAL_NATIVE_BUILD_CONFIGURATION, pathResolution.errorText); return; } if (pathResolution.makeFile == null) { // No project return; } scope.setExternalNativeJsonGenerator(ExternalNativeJsonGenerator.create( project.getProjectDir(), pathResolution.buildSystem, pathResolution.makeFile, androidBuilder, sdkHandler, scope )); }
errorReporter.handleSyncError( applicationId, SyncIssue.TYPE_GENERIC, String applicationIdSuffix = model.getDefaultConfig().getProductFlavor().getApplicationIdSuffix(); errorReporter.handleSyncError( applicationIdSuffix, SyncIssue.TYPE_GENERIC, if (buildType.getBuildType().getApplicationIdSuffix() != null) { String applicationIdSuffix = buildType.getBuildType().getApplicationIdSuffix(); errorReporter.handleSyncError( applicationIdSuffix, SyncIssue.TYPE_GENERIC, if (productFlavor.getProductFlavor().getApplicationId() != null) { String applicationId = productFlavor.getProductFlavor().getApplicationId(); errorReporter.handleSyncError( applicationId, SyncIssue.TYPE_GENERIC, String applicationIdSuffix = productFlavor.getProductFlavor().getApplicationIdSuffix(); errorReporter.handleSyncError( applicationIdSuffix, SyncIssue.TYPE_GENERIC, minSdkVersion.getCodename() == null &&
errorReporter.handleSyncError( null, SyncIssue.TYPE_GENERIC,
if (variantConfig.isMinifyEnabled() && variantConfig.getJackOptions().isEnabled()) { androidBuilder.getErrorReporter().handleSyncError( variantConfig.getFullName(), SyncIssue.TYPE_JACK_IS_NOT_SUPPORTED,
androidBuilder.getErrorReporter().handleSyncError( null, SyncIssue.TYPE_GENERIC,
androidBuilder .getErrorReporter() .handleSyncError( variantScope .getVariantConfiguration()
androidBuilder .getErrorReporter() .handleSyncError( variantScope .getVariantConfiguration()