Skip to content

Commit

Permalink
Get rid of complicated getManifestFile method
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Tian committed Dec 10, 2018
1 parent 62b22d1 commit 01d072c
Showing 1 changed file with 6 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,30 +59,15 @@ private void addFiles(Element parent, File file, String targetPrefix) throws DOM
}
}

public void addManifestFileWithParent(Element parent, Object...params) throws Exception {
config.addFile(parent, getManifestOrDefault(params), MANIFEST_TARGET);
public void addManifestFileWithParent(Element parent, File manifestFile) throws Exception {
config.addFile(parent, getManifestOrDefault(manifestFile), MANIFEST_TARGET);
}

public void addManifestFile(Object...params) throws Exception {
config.addFile(getManifestOrDefault(params), MANIFEST_TARGET);
}

/**
* Abstract method to be implemented for manifest file retrieval.
* Params are as follows:
* Maven:
* - project: MavenProject
* - pluginArtifactId: String
* Gradle:
* -
*
* @param params
* @return
*/
public abstract File getManifestFile(Object...params) throws PluginExecutionException;
public void addManifestFile(File manifestFile) throws Exception {
config.addFile(getManifestOrDefault(manifestFile), MANIFEST_TARGET);
}

private File getManifestOrDefault(Object...params) throws IOException, PluginExecutionException {
File manifestFile = getManifestFile(params);
private File getManifestOrDefault(File manifestFile) throws IOException, PluginExecutionException {
File defaultManifestFileLocation = new File(buildDirectory + "/tmp" + MANIFEST_TARGET);
defaultManifestFileLocation.getParentFile().mkdirs();
if(manifestFile != null && manifestFile.exists() && manifestFile.isFile()) {
Expand Down

0 comments on commit 01d072c

Please sign in to comment.