private void createHeaderArchive( List<HeaderFilesDirective> finalHeaderFilesDirectives, String ndkArchitecture) throws MojoExecutionException { try { MavenArchiver mavenArchiver = new MavenArchiver(); mavenArchiver.setArchiver(jarArchiver); final File jarFile = new File( new File(project.getBuild().getDirectory()), project.getBuild().getFinalName() + ".har"); mavenArchiver.setOutputFile(jarFile); for (HeaderFilesDirective headerFilesDirective : finalHeaderFilesDirectives) { mavenArchiver .getArchiver() .addDirectory( new File(headerFilesDirective.getDirectory()), headerFilesDirective.getIncludes(), headerFilesDirective.getExcludes()); } final MavenArchiveConfiguration mavenArchiveConfiguration = new MavenArchiveConfiguration(); mavenArchiveConfiguration.setAddMavenDescriptor(false); mavenArchiver.createArchive(project, mavenArchiveConfiguration); String classifier = ndkArchitecture; if (ndkClassifier != null) { classifier += "-" + ndkClassifier; } getLog().debug("Attaching 'har' classifier=" + classifier + " file=" + jarFile); projectHelper.attachArtifact( project, Const.ArtifactType.NATIVE_HEADER_ARCHIVE, classifier, jarFile); } catch (Exception e) { throw new MojoExecutionException(e.getMessage()); } }
private void createHeaderArchive( List<HeaderFilesDirective> finalHeaderFilesDirectives, String ndkArchitecture) throws MojoExecutionException { try { MavenArchiver mavenArchiver = new MavenArchiver(); mavenArchiver.setArchiver(jarArchiver); final File jarFile = new File( new File(project.getBuild().getDirectory()), project.getBuild().getFinalName() + ".har"); mavenArchiver.setOutputFile(jarFile); for (HeaderFilesDirective headerFilesDirective : finalHeaderFilesDirectives) { mavenArchiver .getArchiver() .addDirectory( new File(headerFilesDirective.getDirectory()), headerFilesDirective.getIncludes(), headerFilesDirective.getExcludes()); } final MavenArchiveConfiguration mavenArchiveConfiguration = new MavenArchiveConfiguration(); mavenArchiveConfiguration.setAddMavenDescriptor(false); mavenArchiver.createArchive(project, mavenArchiveConfiguration); if (AndroidExtension.APKLIB.equals(project.getPackaging())) { projectHelper.attachArtifact(project, "har", ndkClassifier, jarFile); } else { projectHelper.attachArtifact(project, "har", ndkArchitecture, jarFile); } } catch (Exception e) { throw new MojoExecutionException(e.getMessage()); } }