/** * Additional directory in which to find raw asset files. * * @param assetsFolder Folder containing the combined raw assets to add. * @return current instance of {@link AaptCommandBuilder} */ public AaptPackageCommandBuilder addRawAssetsDirectoryIfExists( File assetsFolder ) { if ( assetsFolder != null && assetsFolder.exists() ) { log.debug( "Adding assets folder : " + assetsFolder ); commands.add( "-A" ); commands.add( assetsFolder.getAbsolutePath() ); } return this; }
/** * Output Proguard options to a File. * * @return current instance of {@link AaptCommandBuilder} */ public AaptPackageCommandBuilder setProguardOptionsOutputFile( File outputFile ) { if ( outputFile != null ) { final File parentFolder = outputFile.getParentFile(); if ( parentFolder != null ) { parentFolder.mkdirs(); } log.debug( "Adding proguard file : " + outputFile ); commands.add( "-G" ); commands.add( outputFile.getAbsolutePath() ); } return this; }
@Override public void execute() throws MojoExecutionException, MojoFailureException { if (mainClass == null) { throw new MojoExecutionException("main class not configured"); } try (URLClassLoader loader = new Classpath(mavenProject).toClassLoader()) { Path srcdir = new File(mavenProject.getBuild().getSourceDirectory()).toPath(); Path bindir = new File(mavenProject.getBuild().getOutputDirectory()).toPath(); getLog().debug("Using classloader " + loader); getLog().debug(" source: " + srcdir); getLog().debug(" bin: " + bindir); Path output = new ApiParser(srcdir) .with(loader) .export(bindir, mainClass); getLog().info("API file: " + output); } catch (Exception x) { throw new MojoFailureException("ApiTool resulted in exception: ", x); } } }
private void addR( ZipArchiver zipArchiver ) throws MojoExecutionException, IOException { final File rFile = new File( targetDirectory, "R.txt" ); if ( !rFile.exists() ) { getLog().debug( "No resources - creating empty R.txt" ); if ( !rFile.createNewFile() ) { getLog().warn( "Unable to create R.txt in AAR" ); } } zipArchiver.addFile( rFile, "R.txt" ); getLog().debug( "Packaging R.txt in AAR" ); }
private String getXmlOutputPath() { getLog().debug( "get parsed xml output path:" + parsedXmlOutputPath ); if ( parsedXmlOutputPath == null ) { File reportPath = new File( targetDirectory, "lint-results/lint-results.xml" ); createReportDirIfNeeded( reportPath ); return reportPath.getAbsolutePath(); } return parsedXmlOutputPath; }
private void copyNativeLibraryArtifact( Artifact artifact, File destinationDirectory, String ndkArchitecture ) throws MojoExecutionException { final File artifactFile = getArtifactResolverHelper().resolveArtifactToFile( artifact ); try { final String artifactId = artifact.getArtifactId(); String filename = artifactId.startsWith( "lib" ) ? artifactId + ".so" : "lib" + artifactId + ".so"; if ( ndkFinalLibraryName != null && artifact.getFile().getName().startsWith( "lib" + ndkFinalLibraryName ) ) { // The artifact looks like one we built with the NDK in this module // preserve the name from the NDK build filename = artifact.getFile().getName(); } final File folder = new File( destinationDirectory, ndkArchitecture ); final File file = new File( folder, filename ); getLog().debug( "Copying native dependency " + artifactId + " (" + artifact.getGroupId() + ") to " + file ); FileUtils.copyFile( artifactFile, file ); } catch ( IOException e ) { throw new MojoExecutionException( "Could not copy native dependency.", e ); } }
output.mkdirs(); getLog().debug("claspath: " + loader); getLog().debug("assets.conf: " + assetConf.getConfig("assets")); ClassLoader assetLoader = AssetClassLoader.classLoader(loader, mavenProject.getBasedir()); AssetCompiler compiler = new AssetCompiler(assetLoader, assetConf); dist.append("assets.pipeline.dev = {}\n"); dist.append("assets.pipeline.").append(env).append(" = {}\n"); File distFile = new File(output, "assets." + env + ".conf"); try (FileWriter writer = new FileWriter(distFile)) { writer.write(dist.toString()); CharSequence summary = compiler .summary(fileset, output.toPath(), env, end - start, " " + assemblyOutput, "Assets: " + distFile); getLog().info(summary); .toFile(); to.getParentFile().mkdirs(); getLog().debug("copying file to: " + to); Files.copy(from, to);
private List<File> getLibraryResourceFolders() { final List<File> resourceFolders = new ArrayList<File>(); for ( Artifact artifact : getTransitiveDependencyArtifacts( AAR, APKLIB ) ) { getLog().debug( "Considering dep artifact : " + artifact ); final File resourceFolder = getUnpackedLibResourceFolder( artifact ); if ( resourceFolder.exists() ) { getLog().debug( "Adding apklib or aar resource folder : " + resourceFolder ); resourceFolders.add( resourceFolder ); } } return resourceFolders; }
try { urls.add( file.toURI().toURL() ); getLog().debug( "Adding classpath entry for classes root " + file.getAbsolutePath() ); String msg = "Unable to resolve classpath entry to URL: " + file.getAbsolutePath(); if ( failOnError ) { throw new MojoExecutionException( msg, e ); try { urls.add( a.getFile().toURI().toURL() ); getLog().debug( "Adding classpath entry for dependency " + a.getId() ); String msg = "Unable to resolve URL for dependency " + a.getId() + " at " + a.getFile().getAbsolutePath(); if ( failOnError ) { throw new MojoExecutionException( msg, e );
getLog().debug( "skip, no androidmanifest.xml defined (androidManifestFile rare case)" ); return; // skip, no androidmanifest.xml defined (rare case) getLog().info( "Attempting to update manifest " + androidManifestFile ); getLog().debug( " usesSdk=" + parsedUsesSdk ); getLog().debug( " versionName=" + parsedVersionName ); getLog().debug( " versionCode=" + parsedVersionCode ); getLog().debug( " usesSdk=" + parsedUsesSdk ); getLog().debug( " versionCodeUpdateFromVersion=" + parsedVersionCodeUpdateFromVersion ); getLog().debug( " versionNamingPattern=" + parsedVersionNamingPattern ); getLog().debug( " versionDigits=" + parsedVersionDigits ); getLog().debug( " mergeLibraries=" + parsedMergeLibraries ); getLog().debug( " mergeReportFile=" + parsedMergeReportFile ); if ( ! androidManifestFile.exists() ) getLog().debug( "Using manifest merger V2" ); manifestMergerV2();
private void copyFolder( File sourceFolder, File targetFolder, FileFilter filter ) throws MojoExecutionException { if ( !sourceFolder.exists() ) { return; } try { getLog().debug( "Copying " + sourceFolder + " to " + targetFolder ); if ( ! targetFolder.exists() ) { if ( ! targetFolder.mkdirs() ) { throw new MojoExecutionException( "Could not create target directory " + targetFolder ); } } FileUtils.copyDirectory( sourceFolder, targetFolder, filter ); } catch ( IOException e ) { throw new MojoExecutionException( "Could not copy source folder to target folder", e ); } }
try { if (log.isDebugEnabled()) { log.debug("classPath: " + classPath); log.debug("classPaths: " + Arrays.deepToString(classPaths)); log.debug("buildPath: " + buildPath); log.debug("buildPaths: " + Arrays.deepToString(buildPaths)); log.debug("buildResource: " + buildResource); log.debug("buildResources: " + Arrays.deepToString(buildResources)); log.debug("includePath: " + includePath); log.debug("includePaths: " + Arrays.deepToString(includePaths)); log.debug("includeResource: " + includeResource); log.debug("includeResources: " + Arrays.deepToString(includeResources)); log.debug("linkPath: " + linkPath); log.debug("linkPaths: " + Arrays.deepToString(linkPaths)); log.debug("linkResource: " + linkResource); log.debug("linkResources: " + Arrays.deepToString(linkResources)); log.debug("preloadPath: " + preloadPath); log.debug("preloadPaths: " + Arrays.deepToString(preloadPaths)); log.debug("preloadResource: " + preloadResource); log.debug("preloadResources: " + Arrays.deepToString(preloadResources)); log.debug("resourcePath: " + resourcePath); log.debug("resourcePaths: " + Arrays.deepToString(resourcePaths)); log.debug("encoding: " + encoding); log.debug("outputDirectory: " + outputDirectory); log.debug("outputName: " + outputName); log.debug("generate: " + generate); log.debug("compile: " + compile); log.debug("deleteJniFiles: " + deleteJniFiles); log.debug("header: " + header);
private Document build() throws MojoExecutionException getLog().debug( "load plugin-help.xml: " + PLUGIN_HELP_PATH ); InputStream is = null; try throw new MojoExecutionException( e.getMessage(), e ); throw new MojoExecutionException( e.getMessage(), e ); throw new MojoExecutionException( e.getMessage(), e );
public void doWithDevice( final IDevice device ) throws MojoExecutionException { String deviceLogLinePrefix = DeviceHelper.getDeviceLogLinePrefix( device ); try { device.installPackage( apkFile.getAbsolutePath(), true ); getLog().info( deviceLogLinePrefix + "Successfully installed " + apkFile.getAbsolutePath() ); getLog().debug( " to " + DeviceHelper.getDescriptiveName( device ) ); } catch ( InstallException e ) { throw new MojoExecutionException( deviceLogLinePrefix + "Install of " + apkFile.getAbsolutePath() + " failed.", e ); } } } );
boolean standardOutput = CompilerMain.isAvailableOutput(output); File basedir = baseDir.getAbsoluteFile(); File currentDir = new File(".").getAbsoluteFile(); if (!standardOutput) File absolutePath = new File(output); if (!absolutePath.exists()) File relativePath = new File(baseDir, output); if (relativePath.exists()) getLog().debug("Can not determine full path for output=" + output, e);
private void extractDuplicateFiles( List<File> jarFiles, Collection<File> sourceFolders ) throws IOException getLog().debug( "Extracting duplicates" ); List<String> duplicates = new ArrayList<String>(); List<File> jarToModify = new ArrayList<File>(); File tmp = new File( targetDirectory.getAbsolutePath(), "unpacked-embedded-jars" ); tmp.mkdirs(); File duplicatesJar = new File( tmp, "duplicate-resources.jar" ); Set<String> duplicatesAdded = new HashSet<String>(); getLog().debug( "Removed duplicates from " + newJar ); if ( newJar != null ) getLog().debug( "Removed duplicates from " + file );
private void generateBuildConfigForPackage( String packageName ) throws MojoExecutionException getLog().debug( "Creating BuildConfig for " + packageName ); File outputFolder = new File( genDirectory, packageName.replace( ".", File.separator ) ); outputFolder.mkdirs(); File outputFile = new File( outputFolder, "BuildConfig.java" ); try throw new MojoExecutionException( "Error generating BuildConfig", e );
/** * Extract the source dependencies. * * @throws MojoExecutionException if it fails. */ protected void extractSourceDependencies() throws MojoExecutionException { for ( Artifact artifact : getDirectDependencyArtifacts() ) { String type = artifact.getType(); if ( type.equals( APKSOURCES ) ) { getLog().debug( "Detected apksources dependency " + artifact + " with file " + artifact.getFile() + ". Will resolve and extract..." ); final File apksourcesFile = resolveArtifactToFile( artifact ); getLog().debug( "Extracting " + apksourcesFile + "..." ); extractApksources( apksourcesFile ); } } if ( extractedDependenciesJavaResources.exists() ) { projectHelper.addResource( project, extractedDependenciesJavaResources.getAbsolutePath(), null, null ); project.addCompileSourceRoot( extractedDependenciesJavaSources.getAbsolutePath() ); } }