From: cascade Date: Mon, 9 Feb 2004 11:22:16 +0000 (+0000) Subject: 5082,5083 Some corrections and improvements in WOK Java extractor.cdl,cxx,h,java... X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=dc9a6ff3065d0c4c74452a5ee0f02e19eb143f08;p=occt-wok.git 5082,5083 Some corrections and improvements in WOK Java extractor.cdl,cxx,h,java,edl need wok modification --- diff --git a/src/WOKStep/WOKStep_JavaCompile.tcl b/src/WOKStep/WOKStep_JavaCompile.tcl index 92dc658..0c48346 100755 --- a/src/WOKStep/WOKStep_JavaCompile.tcl +++ b/src/WOKStep/WOKStep_JavaCompile.tcl @@ -59,7 +59,11 @@ proc WOKStep_JavaCompile:ComputeIncludeDir { unit } { set result $env(WOKHOME)$ps$result - return /usr/java/jre/lib/rt.jar$ps$result + # if { [wokparam -t %CSF_JavaHome] } { + # set result [wokparam -e %CSF_JavaHome]/jre/lib/rt.jar$ps$result + # } + + return $result } @@ -88,6 +92,18 @@ proc WOKStep_JavaCompile:Execute { theunit args } { set sources {} + set sourceslen 0 + set MaxLength 32000 + set tocompile 0 + + # For faster compilation all sources are collected and passed to the compiler + # at once. But for better dependency tracking, .class files are then explicitly + # "linked" to the .java ones. This will allow to remove orphan .class if there + # are no their original .java anymore. + # Building a command line with all file names has a strong limitation - length + # of the line (e.g. on Windows NT: 32Kb of symbols). So this limitation will + # affect on large Interface(s) included into Jni. To overcome this, the line + # is built unless it exceeds its limit, then it is compiled. foreach ID $args { @@ -98,43 +114,61 @@ proc WOKStep_JavaCompile:Execute { theunit args } { regsub -all "/" $infile "\\\\\\" infile } lappend sources $infile + set sourceslen [expr $sourceslen + [string length $infile]] + set tocompile 1 + + if { $sourceslen >= $MaxLength } { + # Command line is close to its maximum, let's compile it + wokparam -s%Source=$sources + set thecommand [wokparam -e JAVA_Compiler] + msgprint -i -c "WOKStep_JavaCompile:Execute" [lindex $thecommand 0] + if { [catch {eval exec [lindex $thecommand 0]} res] } { + + msgprint -e -c "WOKStep_JavaCompile:Execute" $res + set failed 1 + return $failed + } + + # reset again + set sources {} + set sourceslen 0 + set tocompile 0 + } + } -# wokparam -s%Source=$infile + if { $tocompile } { + wokparam -s%Source=$sources + set thecommand [wokparam -e JAVA_Compiler] + msgprint -i -c "WOKStep_JavaCompile:Execute" [lindex $thecommand 0] + if { [catch {eval exec [lindex $thecommand 0]} res] } { + + msgprint -e -c "WOKStep_JavaCompile:Execute" $res + set failed 1 + return $failed + } + } - ##set outfileid [file rootname $name] - ##set outfileid ${outfileid}.class + # Compilation was successful. Now declare a dependency chain. The same loop as above. + foreach ID $args { + scan $ID "%\[^:\]:%\[^:\]:%\[^:\]" unit type name + set infile [UNC [woklocate -p $ID]] -# msgprint -i -c "WOKStep_JavaCompile:Execute" "Compiling $name" -# msgprint -i -c "WOKStep_JavaCompile:Execute" [lindex $thecommand 0] + if { $tcl_platform(platform) == "windows" } { + regsub -all "/" $infile "\\\\\\" infile + } + set outfileid [file rootname $name].class -# if { [catch {eval exec [lindex $thecommand 0]} res] } { - -# msgprint -e -c "WOKStep_JavaCompile:Execute" $res -# set failed 1 - -# } else { - -# if { $fJava } { -# ##stepoutputadd $unitname:javafile:$outfileid -# ##stepaddexecdepitem $ID $unitname:javafile:$outfileid -# } else { -# ##stepoutputadd $unitname:derivated:$outfileid -# ##stepaddexecdepitem $ID $unitname:derivated:$outfileid -# } - - #} + if { $fJava } { + stepoutputadd $unitname:javafile:$outfileid + stepaddexecdepitem $ID $unitname:javafile:$outfileid + } else { + stepoutputadd $unitname:derivated:$outfileid + stepaddexecdepitem $ID $unitname:derivated:$outfileid + } } - - wokparam -s%Source=$sources - set thecommand [wokparam -e JAVA_Compiler] - msgprint -i -c "WOKStep_JavaCompile:Execute" [lindex $thecommand 0] - if { [catch {eval exec [lindex $thecommand 0]} res] } { - - msgprint -e -c "WOKStep_JavaCompile:Execute" $res - set failed 1 - } - + + return $failed } diff --git a/src/WOKStep/WOKStep_JavaHeader.tcl b/src/WOKStep/WOKStep_JavaHeader.tcl index 2cac194..02532a9 100755 --- a/src/WOKStep/WOKStep_JavaHeader.tcl +++ b/src/WOKStep/WOKStep_JavaHeader.tcl @@ -29,24 +29,25 @@ proc WOKStep_JavaHeader:ComputeIncludeDir { unit } { global env global tcl_platform - set fJava [info exists env(WOK_USE_JAVA_DIRECTORY)] - if { $tcl_platform(platform) == "windows" } { set ps "\\;" } else { set ps ":" } - set allwb [w_info -A $unit] + set fJava [info exists env(WOK_USE_JAVA_DIRECTORY)] + + set allwb [w_info -A $unit] set unitname [wokinfo -n $unit] - set result "" - set themax [llength $allwb] + set result "" - for {set i $themax} {[expr $i != 0]} {incr i -1} { + set themax [llength $allwb] + + for { set i $themax } { [expr $i != 0] } { incr i -1 } { set awb [lindex $allwb [expr $i - 1]] - if { $fJava != 0 } { + if { $fJava } { set addinc [UNC [wokparam -e WOKEntity_javadir ${awb}]] } else { set addinc [UNC [wokparam -e WOKEntity_drvdir ${awb}]] @@ -56,7 +57,9 @@ proc WOKStep_JavaHeader:ComputeIncludeDir { unit } { } - return $env(WOKHOME)$ps$result + set result $env(WOKHOME)$ps$result + + return $result } @@ -87,8 +90,7 @@ proc WOKStep_JavaHeader:Execute { theunit args } { set nameid ${unitname} regsub -all "\\." $nameid "_" nameid set outfileid ${nameid}_${outfileid}.h - - set outfile [UNC [wokinfo -p pubinclude:$outfileid $theunit]] + set outfile [UNC [wokinfo -p privinclude:$outfileid $theunit]] wokparam -s%OutFile=$outfile set thecommand [wokparam -e JAVA_Header] @@ -102,8 +104,8 @@ proc WOKStep_JavaHeader:Execute { theunit args } { } else { - stepoutputadd $unitname:pubinclude:$outfileid - stepaddexecdepitem $ID $unitname:pubinclude:$outfileid + stepoutputadd $unitname:privinclude:$outfileid + stepaddexecdepitem $ID $unitname:privinclude:$outfileid }