This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 62773 - Cannot add zip of sources in NB platform manager
Summary: Cannot add zip of sources in NB platform manager
Status: VERIFIED FIXED
Alias: None
Product: apisupport
Classification: Unclassified
Component: Project (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Martin Krauskopf
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-22 13:06 UTC by Tomas Danek
Modified: 2005-10-26 14:04 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Danek 2005-08-22 13:06:06 UTC
Jesse,

in issue 61187 you say:

>> BTW you *are* supposed to be able to use a ZIP of NB sources, so long as e.g.
"nbbuild/" is a top-level entry.

This violates UI spec http://apisupport.netbeans.org/phase-II-ui.html (where
only adding folder is mentioned), and it even does not work in build 20050821!!
Comment 1 Tomas Danek 2005-08-22 13:23:16 UTC
And additional:

you also say in issue 61187

>> Only the root of the netbeans.org CVS tree is accepted, i.e. that folder
containing "nbbuild" etc. as a child. If the file chooser does not already
enforce this, it should.

NO,it does not enforce,I was able to add even empty folders...
Comment 2 Martin Krauskopf 2005-08-22 13:30:48 UTC
> ...supposed to be able to use a ZIP of NB sources...

This should be permitted. But sources we are distributing contains netbeans-src
as a toplevel entry. So probably we should adjust behaviour to this. Or better
to both cases - i.e. whether nbbuild or netbeans-src/nbbuild entry is inside of
the zip.

> I was able to add even empty folders...

See issue 62730, where the problem with adding arbitrary directory will be
solved as well.
Comment 3 Tomas Danek 2005-08-22 14:54:39 UTC
I've tried a crummy workaround on this: unpack distributed zip and pack it again
without netbeans-src at top level, so that nbbuild is directly in root of ziped
file..but it also does not work, seems like filechooser is not sensitive for
ordinary files, only for directories.
Comment 4 Martin Krauskopf 2005-08-22 15:05:14 UTC
> filechooser is not sensitive for ordinary files, only for directories

exactly
Comment 5 Jesse Glick 2005-08-22 21:13:00 UTC
I guess recognizing nbbuild/ as a second-level directory would be wise.
Comment 6 Martin Krauskopf 2005-10-24 09:34:35 UTC
Let's say started. I'll also update UI spec accordingly.
Comment 7 Martin Krauskopf 2005-10-24 16:51:19 UTC
Apparently I'll have to parse all project.xml files of all module entries
similar to the way how NetBeansOrgEntry are created - to obtain CNBs. This will
be presuambly quite slow (probably slower than scanning NB_CVS_DIR).
Also to be precise I should also read "src.dir" property, maybe more (probably
could be skipped for 5.0 - "src" hardcoded). So probably CNB from project.xml of
each up-to-3rd level subdirectory of nb-src.zip!/**/nbbuild/.. should be enough.
Am I correct or there is something I don't see or better way (from performance
point of view) how to solve this issue. Any tips?
Comment 8 Jesse Glick 2005-10-24 17:00:39 UTC
Uh, I'm not sure what you're asking about, exactly. Behavior should be that any
dir or ZIP should be accepted in the filechooser so long as either

1. It is a nb.org checkout - meaning contains "nbbuild" subdir, and you can do a
couple of other checks here.

2. For a ZIP file only, it contains "nbbuild" as a subsubdir, in which case the
parent is treated as the root.

3. The dir is a suite project directory (can check for a nbproject/project.xml
matching suite type). Remember that you are permitted to add sources and Javadoc
for suites to a binary platform, in case the platform is a derived platform
which was built from that suite.

I don't see any case where we need to scan arbitrary modules for anything...?
Comment 9 Martin Krauskopf 2005-10-24 17:33:30 UTC
I've been talking not about FileChooser but about the moment when user press "Go
To Source" on e.g. the TopComponent in the editor. So it will call my
SourceForBinaryQueryImplementation.findSourceRoots() implementation with e.g.
..../org-openide-windows.jar!/ as a parameter. 
And here I have to find appropriate nb-src.zip!/...$nbproject.../src.
I could probably utilize ModuleEntry.getNetBeansOrgPath() (I can find a ME in
supposed platform similar to GlobalJavadocForBinaryImpl) or something similar or
create a cache of cnb-directory_in_nbcvs. Not sure yet. I'll take a look on it more.
Comment 10 Jesse Glick 2005-10-24 17:47:15 UTC
Oh, you mean because the current SFBQI impl in apisupport works only on loadable
module projects, and you cannot load a module project from inside a ZIP file
(since it is an Ant-based project). Bummer.

May be tricky to fix, so feel free to defer to a post-5.0 release; I think we
can live with requiring people to unpack sources before use.
Comment 11 Martin Krauskopf 2005-10-24 17:58:06 UTC
Exactly. Currect SFBQI implementation is used only through
ProjectSourceForBinaryQuery.
So I would register another SFBQI (e.g. NbPlatformSFBQI, or Global....) to solve
this case.
I think that trick similar to GlobalJFBI would work. I'll obtain CNB from the
given parameter, I'll guess supposed platform (which should be already parsed),
obtain ME, obtain netbeansOrgPath and then I can find the path in nb-src.zip
without any unzipping/parsing. Just a fast idea without too much investigation,
maybe naive and non-working :). I'll give it (or something similar) a fast try.
Comment 12 Jesse Glick 2005-10-24 18:08:11 UTC
"obtain ME, obtain netbeansOrgPath and then I can find the path in nb-src.zip
without any unzipping/parsing" - won't work, I think. There will only be a
BinaryModuleEntry, with no netbeansOrgPath.
Comment 13 Martin Krauskopf 2005-10-25 17:42:02 UTC
> There will only be a BinaryModuleEntry, with no netbeansOrgPath.
Ummm.... you are right.

Anyway I have a basic version which works. Also performance is acceptable... for
me :) Just going through the zip and doing only really neccessary things. On my
machine first invocation takes about 3s (could be easily done when the zip is
added in the NB Platform Manager), others calls are immediate (cached for the
IDE session in the meantime). I'll commit till the end of the week, probably
tommorow.
Comment 14 Martin Krauskopf 2005-10-26 10:53:30 UTC
Fixed. Also having simple semi-test working with hardcoded nbsrc.zip. I'll try
to adjust them to use generated pseudo nbsrc.zip and commit.

Checking in
src/META-INF/services/org.netbeans.spi.java.queries.SourceForBinaryQueryImplementation;
1.4 --> 1.5
Checking in queries/GlobalSourceForBinaryImpl.java; 1.1
Checking in ui/platform/NbPlatformCustomizerSources.form; 1.2 --> 1.3
Checking in ui/platform/NbPlatformCustomizerSources.java; 1.4 --> 1.5
Checking in universe/ModuleList.java; 1.17 --> 1.18
Comment 15 Tomas Danek 2005-10-26 13:05:51 UTC
> Behavior should be that any
> dir or ZIP should be accepted in the filechooser so long as either
> ...
> 2. For a ZIP file only, it contains "nbbuild" as a subsubdir, in which case the
> parent is treated as the root

Filechooser currently accepts whatever ZIP you like..even empty:(
Comment 16 Martin Krauskopf 2005-10-26 13:13:47 UTC
See the subject. This is another bug with lesser importance (P4 probably).
Please file another issue to keep things clear (i.e. keep this one P2). Dik.
Comment 17 Tomas Danek 2005-10-26 13:31:31 UTC
OK, the main problem is solved and works fine. Verified in custom build on sol.
Don't forget to add the tests..
Comment 18 Martin Krauskopf 2005-10-26 14:04:12 UTC
> Also having simple semi-test working with hardcoded nbsrc.zip.
> I'll try to adjust them to use generated pseudo nbsrc.zip and commit.

Checking in test/project/queries/GlobalSourceForBinaryImplTest.java; 1.1