Relocation moves classes to new package, but keeps old package in the JAR. #53

Closed
Minecrell opened this Issue Jun 26, 2014 · 6 comments

Comments

Projects
None yet
2 participants
@Minecrell
Contributor

Minecrell commented Jun 26, 2014

When I relocate the guava package in my test project to another package, it moves the classes correctly but if I look into the JAR the folder of the original package still exists.

relocate 'com.google.common', 'net.minecrell.gradletest.com.google.common'

Guava has been moved to the correct package but there is still the com folder with all of the sub directories as well.

@johnrengelman

This comment has been minimized.

Show comment
Hide comment
@johnrengelman

johnrengelman Jun 26, 2014

Owner

That shouldn't have any negative effect, it's just entry structure within the archive. I'm not sure I can do anything about it without having to do a second pass through the jar, which doesn't seem like a good practice.

The reason is that the relocation is done on an entry by entry basis, but the parent directory structure needs to be created first and there is no way to know ahead of time if all the entries within the directory are going to be relocated.

Owner

johnrengelman commented Jun 26, 2014

That shouldn't have any negative effect, it's just entry structure within the archive. I'm not sure I can do anything about it without having to do a second pass through the jar, which doesn't seem like a good practice.

The reason is that the relocation is done on an entry by entry basis, but the parent directory structure needs to be created first and there is no way to know ahead of time if all the entries within the directory are going to be relocated.

@Minecrell

This comment has been minimized.

Show comment
Hide comment
@Minecrell

Minecrell Jun 27, 2014

Contributor

Hmm, yes it should not really matter. But actually I would prefer to have a clean JAR without unneeded entries so if you find a way to remove them maybe you can add an option for it because I don't mind waiting some seconds longer.

Contributor

Minecrell commented Jun 27, 2014

Hmm, yes it should not really matter. But actually I would prefer to have a clean JAR without unneeded entries so if you find a way to remove them maybe you can add an option for it because I don't mind waiting some seconds longer.

@johnrengelman

This comment has been minimized.

Show comment
Hide comment
@johnrengelman

johnrengelman Jun 27, 2014

Owner

I'm not going to add an option to do that. As I fix the relocation bug, I'll see if I can stop this (I think there is).

Owner

johnrengelman commented Jun 27, 2014

I'm not going to add an option to do that. As I fix the relocation bug, I'll see if I can stop this (I think there is).

@Minecrell

This comment has been minimized.

Show comment
Hide comment
@Minecrell

Minecrell Jun 27, 2014

Contributor

Okay, thank you. :)

Contributor

Minecrell commented Jun 27, 2014

Okay, thank you. :)

@johnrengelman

This comment has been minimized.

Show comment
Hide comment
@johnrengelman

johnrengelman Jun 27, 2014

Owner

So, after looking at this more, there is a part that I had to fix. Not only was it leaving the source directories around, I wasn't creating the directories for the target location. No big deal, unless you try to do some type of package scanning. So that should be fixed now.

Owner

johnrengelman commented Jun 27, 2014

So, after looking at this more, there is a part that I had to fix. Not only was it leaving the source directories around, I wasn't creating the directories for the target location. No big deal, unless you try to do some type of package scanning. So that should be fixed now.

@Minecrell

This comment has been minimized.

Show comment
Hide comment
@Minecrell

Minecrell Jun 27, 2014

Contributor

Just tested the new version 1.0.0 and it doesn't generate the old folders of the dependencies anymore. However, for some reason in the JAR file is an empty folder with the name of the file. (In my case GradleTest-1.0-all). This is kinda strange but I don't really mind, but maybe it is just a small mistake that is easily fixable?
Relocations of packages within the source files still generate their old folders in the JAR but as of I don't use that, it's not important to fix (for me).

Contributor

Minecrell commented Jun 27, 2014

Just tested the new version 1.0.0 and it doesn't generate the old folders of the dependencies anymore. However, for some reason in the JAR file is an empty folder with the name of the file. (In my case GradleTest-1.0-all). This is kinda strange but I don't really mind, but maybe it is just a small mistake that is easily fixable?
Relocations of packages within the source files still generate their old folders in the JAR but as of I don't use that, it's not important to fix (for me).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment