Skip to content

Commit

Permalink
implemented useLibFolderContentForManifestClasspath
Browse files Browse the repository at this point in the history
  • Loading branch information
FibreFoX committed Feb 5, 2017
1 parent 36f0adf commit 41bf054
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ jfx {
addPackagerJar = true
copyAdditionalAppResourcesToJar = false
skipCopyingDependencies = false
useLibFolderContentForManifestClasspath = false
fixedManifestClasspath = null
// gradle jfxNative
identifier = null // String - setting this for windows-bundlers makes it possible to generate upgradeable installers (using same GUID)
Expand Down Expand Up @@ -276,6 +278,7 @@ New:
* added property to skip `nativeReleaseVersion` rewriting, just set `skipNativeVersionNumberSanitizing = true` inside the jfx-block
* added `skipCopyingDependencies` to make it possible to NOT copying dependencies, but they are added to the classpath inside the manifest like normal
* added `fixedManifestClasspath` for setting the classpath-entry inside the generated manifest-file in the main jfx-jar, this is already possible for secondary launchers by setting `classpath` within the configuration-block of the secondary launcher
* added `useLibFolderContentForManifestClasspath` for creating the manifest-entriy for the classpath, depending on the content of the lib-folder, makes it possible to have files not being inside dependencies being present there (which got copied beforehand)

Changes:
* reimplemented `additionalBundlerResources`, now searching for folders with the name of the used bundler, makes it possible to adjust nearly all bundlers now (for Mac a special replacement-class was created, as the default one did not provide any way to add more files)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class JavaFXGradlePluginExtension {
// private boolean classpathExcludesTransient = true;
private boolean copyAdditionalAppResourcesToJar = false;
private boolean skipCopyingDependencies = false;
private boolean useLibFolderForManifestClasspath = false;
private boolean useLibFolderContentForManifestClasspath = false;
private String fixedManifestClasspath = null;

// NativeMojo
Expand Down Expand Up @@ -229,12 +229,12 @@ public void setSkipCopyingDependencies(boolean skipCopyingDependencies) {
this.skipCopyingDependencies = skipCopyingDependencies;
}

public boolean isUseLibFolderForManifestClasspath() {
return useLibFolderForManifestClasspath;
public boolean isUseLibFolderContentForManifestClasspath() {
return useLibFolderContentForManifestClasspath;
}

public void setUseLibFolderForManifestClasspath(boolean useLibFolderForManifestClasspath) {
this.useLibFolderForManifestClasspath = useLibFolderForManifestClasspath;
public void setUseLibFolderContentForManifestClasspath(boolean useLibFolderContentForManifestClasspath) {
this.useLibFolderContentForManifestClasspath = useLibFolderContentForManifestClasspath;
}

public String getFixedManifestClasspath() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,34 @@ public void jfxjar(Project project) {
project.getLogger().info("Skipped copying runtime dependencies");
}

if( !foundLibs.isEmpty() ){
createJarParams.setClasspath(ext.getLibFolderName() + "/" + String.join(" " + ext.getLibFolderName() + "/", foundLibs));
if( ext.isUseLibFolderContentForManifestClasspath() ){
StringBuilder scannedClasspath = new StringBuilder();
try{
Files.walkFileTree(libDir.toPath(), new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
scannedClasspath.append(file.toString().replace("\\", "/")).append(" ");
return super.visitFile(file, attrs);
}
});
} catch(IOException ioex){
project.getLogger().warn("Got problem while scanning lib-folder", ioex);
}
createJarParams.setClasspath(scannedClasspath.toString());
} else {
if( !foundLibs.isEmpty() ){
createJarParams.setClasspath(ext.getLibFolderName() + "/" + String.join(" " + ext.getLibFolderName() + "/", foundLibs));
}
}
Optional.ofNullable(ext.getFixedManifestClasspath()).ifPresent(manifestClasspath -> {
if( manifestClasspath.trim().isEmpty() ){
return;
}
createJarParams.setClasspath(manifestClasspath);

if( ext.isUseLibFolderContentForManifestClasspath() ){
project.getLogger().warn("You specified to use the content of the lib-folder AND specified a fixed classpath. The fixed classpath will get taken.");
}
});

// https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/manifest.html#JSDPG896
Expand Down

0 comments on commit 41bf054

Please sign in to comment.