mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
Native Libraries:
- Linux: added dumps - macOS: replaced deprecated Gradle `exec`
This commit is contained in:
@@ -14,6 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.FileOutputStream
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
`cpp-library`
|
`cpp-library`
|
||||||
`flatlaf-cpp-library`
|
`flatlaf-cpp-library`
|
||||||
@@ -96,8 +98,10 @@ tasks {
|
|||||||
copy {
|
copy {
|
||||||
from( linkedFile )
|
from( linkedFile )
|
||||||
into( nativesDir )
|
into( nativesDir )
|
||||||
rename( "libflatlaf-natives-linux.so", libraryName )
|
rename( linkedFile.get().asFile.name, libraryName )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// dump( linkedFile.asFile.get(), true )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +164,37 @@ tasks {
|
|||||||
from( "$outDir/$libraryName" )
|
from( "$outDir/$libraryName" )
|
||||||
into( nativesDir )
|
into( nativesDir )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// dump( file( "$outDir/$libraryName" ), false )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*dump
|
||||||
|
interface InjectedExecOps { @get:Inject val execOps: ExecOperations }
|
||||||
|
val injected = project.objects.newInstance<InjectedExecOps>()
|
||||||
|
|
||||||
|
fun dump( dylib: File, disassemble: Boolean ) {
|
||||||
|
|
||||||
|
val dylibDir = dylib.parent
|
||||||
|
injected.execOps.exec { commandLine( "size", dylib ); standardOutput = FileOutputStream( "$dylibDir/size.txt" ) }
|
||||||
|
injected.execOps.exec {
|
||||||
|
commandLine( "objdump",
|
||||||
|
// commands
|
||||||
|
"--archive-headers",
|
||||||
|
"--section-headers",
|
||||||
|
"--private-headers",
|
||||||
|
"--reloc",
|
||||||
|
"--dynamic-reloc",
|
||||||
|
"--syms",
|
||||||
|
// files
|
||||||
|
dylib )
|
||||||
|
standardOutput = FileOutputStream( "$dylibDir/objdump.txt" )
|
||||||
|
}
|
||||||
|
if( disassemble )
|
||||||
|
injected.execOps.exec { commandLine( "objdump", "--disassemble-all", dylib ); standardOutput = FileOutputStream( "$dylibDir/disassemble.txt" ) }
|
||||||
|
injected.execOps.exec { commandLine( "objdump", "--full-contents", dylib ); standardOutput = FileOutputStream( "$dylibDir/full-contents.txt" ) }
|
||||||
|
injected.execOps.exec { commandLine( "hexdump", dylib ); standardOutput = FileOutputStream( "$dylibDir/hexdump.txt" ) }
|
||||||
|
}
|
||||||
|
dump*/
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ var javaHome = System.getProperty( "java.home" )
|
|||||||
if( javaHome.endsWith( "jre" ) )
|
if( javaHome.endsWith( "jre" ) )
|
||||||
javaHome += "/.."
|
javaHome += "/.."
|
||||||
|
|
||||||
|
interface InjectedExecOps { @get:Inject val execOps: ExecOperations }
|
||||||
|
val injected = project.objects.newInstance<InjectedExecOps>()
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
register( "build-natives" ) {
|
register( "build-natives" ) {
|
||||||
group = "build"
|
group = "build"
|
||||||
@@ -95,21 +98,21 @@ tasks {
|
|||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
// sign shared library
|
// sign shared library
|
||||||
// exec { commandLine( "codesign", "-s", "FormDev Software GmbH", "--timestamp", "${linkedFile.asFile.get()}" ) }
|
// injected.execOps.exec { commandLine( "codesign", "-s", "FormDev Software GmbH", "--timestamp", "${linkedFile.asFile.get()}" ) }
|
||||||
|
|
||||||
// copy shared library to flatlaf-core resources
|
// copy shared library to flatlaf-core resources
|
||||||
copy {
|
copy {
|
||||||
from( linkedFile )
|
from( linkedFile )
|
||||||
into( nativesDir )
|
into( nativesDir )
|
||||||
rename( "libflatlaf-natives-macos.dylib", libraryName )
|
rename( linkedFile.get().asFile.name, libraryName )
|
||||||
}
|
}
|
||||||
|
|
||||||
/*dump
|
/*dump
|
||||||
val dylib = linkedFile.asFile.get()
|
val dylib = linkedFile.asFile.get()
|
||||||
val dylibDir = dylib.parent
|
val dylibDir = dylib.parent
|
||||||
exec { commandLine( "size", dylib ) }
|
injected.execOps.exec { commandLine( "size", dylib ); standardOutput = FileOutputStream( "$dylibDir/size.txt" ) }
|
||||||
exec { commandLine( "size", "-m", dylib ) }
|
injected.execOps.exec { commandLine( "size", "-m", dylib ); standardOutput = FileOutputStream( "$dylibDir/size-m.txt" ) }
|
||||||
exec {
|
injected.execOps.exec {
|
||||||
commandLine( "objdump",
|
commandLine( "objdump",
|
||||||
// commands
|
// commands
|
||||||
"--archive-headers",
|
"--archive-headers",
|
||||||
@@ -127,8 +130,8 @@ tasks {
|
|||||||
dylib )
|
dylib )
|
||||||
standardOutput = FileOutputStream( "$dylibDir/objdump.txt" )
|
standardOutput = FileOutputStream( "$dylibDir/objdump.txt" )
|
||||||
}
|
}
|
||||||
exec { commandLine( "objdump", "--disassemble-all", dylib ); standardOutput = FileOutputStream( "$dylibDir/disassemble.txt" ) }
|
injected.execOps.exec { commandLine( "objdump", "--disassemble-all", dylib ); standardOutput = FileOutputStream( "$dylibDir/disassemble.txt" ) }
|
||||||
exec { commandLine( "objdump", "--full-contents", dylib ); standardOutput = FileOutputStream( "$dylibDir/full-contents.txt" ) }
|
injected.execOps.exec { commandLine( "objdump", "--full-contents", dylib ); standardOutput = FileOutputStream( "$dylibDir/full-contents.txt" ) }
|
||||||
dump*/
|
dump*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ tasks {
|
|||||||
copy {
|
copy {
|
||||||
from( linkedFile )
|
from( linkedFile )
|
||||||
into( nativesDir )
|
into( nativesDir )
|
||||||
rename( "flatlaf-natives-windows.dll", libraryName )
|
rename( linkedFile.get().asFile.name, libraryName )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user