Fix .class suffix handling in JavaH.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 8 Jan 2004 07:15:22 +0000 (07:15 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 8 Jan 2004 07:15:22 +0000 (07:15 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@872 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Tool/javah.py
test/JAVAH.py

index 222e0eb6879fde0ece1705c9b0b15d01500d013c..73f9d4f2e485f761108c41e51ede01cceaf8059e 100644 (file)
@@ -112,6 +112,9 @@ RELEASE 0.95 - XXX
   - Fix the env.Action() method so it returns the correct type of
     Action for its argument(s).
 
+  - Fix specifying .class files as input to JavaH with the .class suffix
+    when they weren't generated using the Java Builder.
+
   From Vincent Risi:
 
   - Add support for the bcc32, ilink32 and tlib Borland tools.
index 93678e4c0974fa4638f9081efb314bf445e4ebc5..fe8c82d588b894b8f4e4c2a4153498498be5f073 100644 (file)
@@ -39,6 +39,7 @@ import string
 
 import SCons.Builder
 import SCons.Node.FS
+import SCons.Tool.javac
 
 def emit_java_headers(target, source, env):
     """Create and return lists of Java stub header files that will
@@ -71,8 +72,9 @@ def emit_java_headers(target, source, env):
             classname = str(src)
             if c_ and classname[:len(c_)] == c_:
                 classname = classname[len(c_):]
-            if class_suffix and classname[:-len(class_suffix)] == class_suffix:
-                classname = classname[-len(class_suffix):]
+            if class_suffix and classname[-len(class_suffix):] == class_suffix:
+                classname = classname[:-len(class_suffix)]
+            classname = SCons.Tool.javac.classname(classname)
         s = src.rfile()
         s.attributes.java_classdir = classdir
         s.attributes.java_classname = classname
index e881bca7ebfd750f2be3badf7919e3d3f76f0a6b..b31833544af5f3c34b59918a0b7bd216271e1327 100644 (file)
@@ -114,7 +114,7 @@ foo = Environment(tools = ['javac', 'javah'],
                   JAVAH = '/usr/local/j2sdk1.3.1/bin/javah')
 javah = foo.Dictionary('JAVAH')
 bar = foo.Copy(JAVAH = r'%s wrapper.py ' + javah)
-fff = foo.Java(target = 'class1', source = 'com/sub/foo')
+foo.Java(target = 'class1', source = 'com/sub/foo')
 bar_classes = bar.Java(target = 'class2', source = 'com/sub/bar')
 foo_classes = foo.Java(target = 'class3', source = 'src')
 foo.JavaH(target = 'outdir1',
@@ -124,6 +124,10 @@ foo.JavaH(target = 'outdir1',
           JAVACLASSDIR = 'class1')
 bar.JavaH(target = 'outdir2', source = bar_classes)
 foo.JavaH(target = File('output.h'), source = foo_classes)
+foo.Install('class4/com/sub/foo', 'class1/com/sub/foo/Example1.class')
+foo.JavaH(target = 'outdir4',
+          source = ['class4/com/sub/foo/Example1.class'],
+          JAVACLASSDIR = 'class4')
 """ % python)
 
 test.subdir('com',