From 7dfa707cfb3fc95e49ae43dca4e5d7387119cb4e Mon Sep 17 00:00:00 2001 From: stevenknight Date: Thu, 8 Jan 2004 07:15:22 +0000 Subject: [PATCH] Fix .class suffix handling in JavaH. git-svn-id: http://scons.tigris.org/svn/scons/trunk@872 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/CHANGES.txt | 3 +++ src/engine/SCons/Tool/javah.py | 6 ++++-- test/JAVAH.py | 6 +++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 222e0eb6..73f9d4f2 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -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. diff --git a/src/engine/SCons/Tool/javah.py b/src/engine/SCons/Tool/javah.py index 93678e4c..fe8c82d5 100644 --- a/src/engine/SCons/Tool/javah.py +++ b/src/engine/SCons/Tool/javah.py @@ -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 diff --git a/test/JAVAH.py b/test/JAVAH.py index e881bca7..b3183354 100644 --- a/test/JAVAH.py +++ b/test/JAVAH.py @@ -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', -- 2.26.2