public static String getCanonicalPath(File file) throws BuildException { try { return file.getCanonicalPath(); } catch (IOException e) { throw new BuildException("Failed to get canonical path of " + file.getAbsolutePath(), e); } }
public static String getCanonicalPath(File file) throws BuildException { try { return file.getCanonicalPath(); } catch (IOException e) { throw new BuildException("Failed to get canonical path of " + file.getAbsolutePath(), e); } }
/** * Creates a SigningConfig with a given name. * * @param name the name of the signingConfig. * */ public SigningConfig(@NonNull String name) { super(name); if (BuilderConstants.DEBUG.equals(name)) { try { initDebug(); } catch (AndroidLocation.AndroidLocationException e) { throw new BuildException("Failed to get default debug keystore location", e); } } }
public static void checkGradleVersion(Project project, String gradleMinVersion, String gradlePluginName) { String projectGradleVersion = project.getGradle().getGradleVersion(); if (new VersionComparator().compare(gradleMinVersion, projectGradleVersion) > 0) { throw new BuildException(String.format( "Detected Gradle version %s, but %s requires Gradle version %s or higher.", projectGradleVersion, gradlePluginName, gradleMinVersion), null); } } }
throw new BuildException("Failed to inject bootstrapping application", e);
@Override @NonNull public SigningConfig create(@NonNull String name) { SigningConfig signingConfig = instantiator.newInstance(SigningConfig.class, name); if (BuilderConstants.DEBUG.equals(name)) { try { signingConfig.initWith( DefaultSigningConfig.debugSigningConfig( new File(KeystoreHelper.defaultDebugKeystoreLocation()))); } catch (AndroidLocation.AndroidLocationException e) { throw new BuildException("Failed to get default debug keystore location.", e); } } return signingConfig; } }
private void generateRebelXml(File rebelXmlFile) { // TODO replacement of those placeholders does not work and probably has never worked (probably copy-pasted from maven plugin). REPLACE! log.info("Processing ${project.group}:${project.name} with packaging " + getPackaging()); log.info("Generating \"${rebelXmlFile}\"..."); // Do generate the rebel.xml try { String xmlFileContents = getRebelModel().toXmlString(); // Print generated rebel.xml out to console if user wants to see it if (getShowGenerated()) { System.out.println(xmlFileContents); } // Write out the rebel.xml file rebelXmlFile.getParentFile().mkdirs(); FileUtil.writeToFile(rebelXmlFile, xmlFileContents); } catch (IOException e) { throw new BuildException("Failed writing \"${rebelXmlFile}\"", e); } }
+ storeDirectory.getAbsolutePath() + "\" because it is not writable."; throw new BuildException(message, null); signingConfig.getStorePassword(), signingConfig.getKeyPassword(), signingConfig.getKeyAlias(), getILogger())) { throw new BuildException("Unable to recreate missing debug keystore.", null);
private void generateRebelXml(File rebelXmlFile) { // TODO replacement of those placeholders does not work and probably has never worked (probably copy-pasted from maven plugin). REPLACE! log.info("Processing ${project.group}:${project.name} with packaging " + getPackaging()); log.info("Generating \"${rebelXmlFile}\"..."); // Do generate the rebel.xml try { String xmlFileContents = getRebelModel().toXmlString(); // Print generated rebel.xml out to console if user wants to see it if (getShowGenerated()) { System.out.println(xmlFileContents); } // Write out the rebel.xml file rebelXmlFile.getParentFile().mkdirs(); FileUtil.writeToFile(rebelXmlFile, xmlFileContents); } catch (IOException e) { throw new BuildException("Failed writing \"${rebelXmlFile}\"", e); } }
private static void checkForWarnings( @NonNull ProguardConfig config, @NonNull ShrinkerLogger shrinkerLogger) { if (shrinkerLogger.getWarningsCount() > 0 && !config.getFlags().isIgnoreWarnings()) { throw new BuildException( "Warnings found during shrinking, please use -dontwarn or -ignorewarnings to suppress them.", null); } }
@Override public GradleConnectionException transform(Throwable failure) { if (failure instanceof InternalUnsupportedBuildArgumentException) { return new UnsupportedBuildArgumentException(connectionFailureMessage(failure) + "\n" + failure.getMessage(), failure); } else if (failure instanceof UnsupportedOperationConfigurationException) { return new UnsupportedOperationConfigurationException(connectionFailureMessage(failure) + "\n" + failure.getMessage(), failure.getCause()); } else if (failure instanceof GradleConnectionException) { return (GradleConnectionException) failure; } else if (failure instanceof InternalBuildCancelledException) { return new BuildCancelledException(connectionFailureMessage(failure), failure.getCause()); } else if (failure instanceof InternalTestExecutionException) { return new TestExecutionException(connectionFailureMessage(failure), failure.getCause()); } else if (failure instanceof BuildExceptionVersion1) { return new BuildException(connectionFailureMessage(failure), failure.getCause()); } else if (failure instanceof ListenerNotificationException) { return new ListenerFailedException(connectionFailureMessage(failure), ((ListenerNotificationException) failure).getCauses()); } else { return new GradleConnectionException(connectionFailureMessage(failure), failure); } }
classpathJar = createClasspathJarFromFileCollection(jointClasspath); } catch (IOException e) { throw new BuildException("Error creating classpath JAR for gosudoc generation", e);
instantRunContext.addChangedFile(instantRunFileType, getOutputFile()); } catch (IOException e) { throw new BuildException(e.getMessage(), e);
@Override protected void doFullTaskAction() { try { final File dir = getJavaResourceDir(); getBuilder().packageApk(getResourceFile().getAbsolutePath(), getDexFolder(), getDexedLibraries(), getPackagedJars(), (dir == null ? null : dir.getAbsolutePath()), getJniFolders(), getMergingFolder(), getAbiFilters(), getJniDebugBuild(), getSigningConfig(), getPackagingOptions(), getOutputFile().getAbsolutePath()); } catch (DuplicateFileException e) { Logger logger = getLogger(); logger.error("Error: duplicate files during packaging of APK " + getOutputFile() .getAbsolutePath()); logger.error("\tPath in archive: " + e.getArchivePath()); logger.error("\tOrigin 1: " + e.getFile1()); logger.error("\tOrigin 2: " + e.getFile2()); logger.error("You can ignore those files in your build.gradle:"); logger.error("\tandroid {"); logger.error("\t packagingOptions {"); logger.error("\t exclude \'" + e.getArchivePath() + "\'"); logger.error("\t }"); logger.error("\t}"); throw new BuildException(e.getMessage(), e); } catch (Exception e) { throw new BuildException(e.getMessage(), e); } }
String packageName = variantConfig.getPackageFromManifest(); if (packageName == null) { throw new BuildException("Failed to read manifest", null);
database = new ApiDatabase(apiFilter); } catch (IOException e) { throw new BuildException("Could not open API database " + apiFilter, e);