Hi,
A few comments:
It should be possible to set:
nbjdk.home=<path-to-jdk8>
in:
nbbuild/user.build.properties
When running on runtime JDK 9+, the build should be able to use JDK 8 to
build without manual switching.
The issue with "-source 8" is that this only switches the input language,
but not the JDK libraries. So it may happen the code would unintentionally
use JDK 9 APIs, in which case it would not run on JDK 8. Using "--release
8" is better in this regard (if the code compiles using --release 8, then
it should run on JDK 8, as the JDK 8 versions of the libraries are used),
but could be tricky to convert the Java support to it.
The (JDK 9) javac is downloaded and compiled to ensure we compile against
the JDK 9 version (even when running the build on 8).
I think it is important to separate on which JDKs NetBeans runs (which I
think currently is JDK 8, 9 and the upcoming 10) and on which it builds
(which currently is JDK 8). I don't think we should remove a runtime
platform at this time, but to me, it is fine to discuss if we want to add
or move the build time JDK. So, to me personally, contributions on this are
welcome. (Even though I suspect this may be somewhat non trivial.)
Thanks,
Jan
On Sun, Feb 18, 2018 at 12:07 AM, Martin Dindoffer <[email protected]>
wrote:
> "No, nobody needs to switch between JDKs when contributing, as far as I
> know."
>
> I am sorry but I do not really see what do you mean. I switched to JDK9
> recently.
> I do not keep 2 versions of JDK on my machine - I simply do not need the
> old
> one (except for building NB). The simple build via `ant` fails. And this is
> a scenario
> a bunch of new contributors will face as well.
>
> The solution for me and other new contributors is to download JDK8 and have
> it
> installed together with JDK 9, just to be able to work on NB. And as long
> as there is
> no magic in the ant build scripts that automatically detects JDK8 and sets
> the appropriate envs, the burden lies once again on contributors
> to switch JAVA_HOME for building.
> If there indeed is such functionality present in the scripts, then I
> apologize as
> the problem is somewhat irrelevant. I haven't tried it yet.
> If there isn't such a thing present, the importance of supporting JDK9
> building
> will only increase over time.
>
> As for the options introduced by Jan, I personally like 1., but I fail to
> see how
> it would prevent the build to "reliably run on 8". Isn't this already the
> case with
> some modules specifying source 1.6 and 1.7?
>
> As for the problem of code compatibility - JDK9 builds should be already
> possible
> without changes. The JDK9 gentoo builds by sir Thomson are a proof,
> see https://github.com/apache/incubator-netbeans/pull/392
>
> Regards,
> Martin
>
> 2018-02-17 23:36 GMT+01:00 Geertjan Wielenga <
> [email protected]>:
>
> > Also, the question is what it means to build NetBeans on JDK 9, i.e.,
> > here's some thoughts from an e-mail from Jan Lahoda:
> >
> > I guess there's a big range of variants of "building NetBeans on Java 9",
> > > e.g.:
> > > 1. just allowing build pass on 9, using -source 8/-target 8 as before
> > (but
> > > the result may be unable to reliably run on 8)
> > > 2. building with --release 8 (i.e. building on JDK 9, but producing
> > output
> > > runnable on 8), and having JDK 9 as the minimal requirement for
> building.
> > > (Which is something the community needs to decide.)
> > > 3. as 2, but supporting build on both JDK 9 and JDK 8. (I suspect this
> > may
> > > be pretty hard.)
> > > 4. allowing modules to actually use -source >= 9 (first for platform
> > > users, and then, when JDK 8 support is dropped, for core modules as
> well)
> > > For 1., the first compilation error is:
> > > [repeat]
> > > /usr/local/home/lahvac/src/nb/apache-netbeans/o.n.bootstrap/
> > src/org/netbeans/NbInstrumentation.java:43:
> > > error: NbInstrumentation is not abstract and does not override abstract
> > > method isModifiableModule(Module) in Instrumentation
> > > [repeat] final class NbInstrumentation implements Instrumentation {
> > > [repeat] ^
> > > Not unsolvable, of course, but hard to say how many more issues like
> this
> > > can be expected. (And this variant does not make too much sense anyway
> -
> > as
> > > long as JDK 8 is supported at runtime, we should at least aim for
> > building
> > > with --release 8.)
> >
> >
> >
> > Thanks,
> >
> > Gj
> >
> > On Sat, Feb 17, 2018 at 11:31 PM, Geertjan Wielenga <
> > [email protected]> wrote:
> >
> > > No, nobody needs to switch between JDKs when contributing, as far as I
> > > know.
> > >
> > > Jan Lahoda and others can provide details on what needs to be done to
> > > build NetBeans on JDK 9, though I wonder whether that is a priority.
> > > So long as NetBeans can run on JDK 9 (which it can), it doesn't really
> > > matter as far as I can see that it needs JDK 8 for building it.
> > >
> > > From those who've been contributing code so far, I don't see that this
> > > is a blocker.
> > >
> > > Gj
> > >
> > > On Sat, Feb 17, 2018 at 2:28 PM, Martin Dindoffer <
> [email protected]>
> > > wrote:
> > > > Hi NB dev team,
> > > >
> > > > As we all know, NB cannot be built using Java 9. With 9 way past its
> > > GA, it
> > > > seems to pose a roadblock
> > > > for new contributors, as they need to switch between 9 and 8
> > environments
> > > > for contributing.
> > > > I was wondering, what exactly blocks the j9 builds? As far as I can
> > > > remember, the ant script tries to download
> > > > the javac, self-compile it and then build an ant bootstrap with it,
> > which
> > > > fails.
> > > >
> > > > Can someone more knowledgeable in this area of Netbeans/ant shed more
> > > light
> > > > on the issue? Why exactly do
> > > > we need the special ant bootstrap and why do we have to redownload
> and
> > > > self-compile the javac?
> > > >
> > > > There may be some people out there who would volunteer to work on
> this.
> > > > Myself included, but I cannot make any promises right now.
> > > >
> > > > Thanks,
> > > > Martin
> > > >
> > > >
> > > > ------------------------------------------------------------
> ---------
> > > > To unsubscribe, e-mail: dev-unsubscribe@netbeans.
> incubator.apache.org
> > > > For additional commands, e-mail: [email protected].
> > apache.org
> > > >
> > > > For further information about the NetBeans mailing lists, visit:
> > > > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
> > > >
> > > >
> > > >
> > >
> >
>