Browse Source

Really move the generated java files in rmic.

PR: 5781

Fixed some minor stuff in DefaultRmicAdapter while I was at it.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272331 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 23 years ago
parent
commit
e390c09b6e
3 changed files with 32 additions and 5 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/MatchingTask.java
  2. +14
    -1
      src/main/org/apache/tools/ant/taskdefs/Rmic.java
  3. +17
    -3
      src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java

+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/MatchingTask.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without


+ 14
- 1
src/main/org/apache/tools/ant/taskdefs/Rmic.java View File

@@ -440,9 +440,22 @@ public class Rmic extends MatchingTask {
adapter.getMapper().mapFileName(classFileName);

for (int i=0; i<generatedFiles.length; i++) {
if (!generatedFiles[i].endsWith(".class")) {
// don't know how to handle that - a IDL file doesn't
// have a corresponding Java source for example.
continue;
}
String sourceFileName =
classFileName.substring(0, classFileName.length()-6) + ".java";
generatedFiles[i].substring(0, classFileName.length()-6)
+ ".java";

File oldFile = new File(baseDir, sourceFileName);
if (!oldFile.exists()) {
// no source file generated, nothing to move
continue;
}

File newFile = new File(sourceBaseFile, sourceFileName);
try {
project.copyFile(oldFile, newFile, filtering);


+ 17
- 3
src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -263,7 +263,19 @@ public abstract class DefaultRmicAdapter implements RmicAdapter {
private final static Random rand = new Random();

/**
* Mapper that possibly returns two file names, *_Stub and *_Skel.
* Mapper that may return up to two file names.
*
* <ul>
* <li>for JRMP it will return *_Stub (and *_Skel if JDK 1.1 is
* used)</li>
*
* <li>for IDL it will return a random name, causing <rmic> to
* always recompile.</li>
*
* <li>for IIOP it will return _*_Stub for interfaces and _*_Tie
* for non-interfaces (and determine the interface and create
* _*_Stub from that).</p>
* </ul>
*/
private class RmicFileNameMapper implements FileNameMapper {

@@ -288,7 +300,9 @@ public abstract class DefaultRmicAdapter implements RmicAdapter {
return null;
}

String base = name.substring(0, name.indexOf(".class"));
// we know that name.endsWith(".class")
String base = name.substring(0, name.length()-6);

String classname = base.replace(File.separatorChar, '.');
if (attributes.getVerify() &&
!attributes.isValidRmiRemote(classname)) {


Loading…
Cancel
Save