You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Michael Semb Wever <mc...@apache.org> on 2020/11/06 08:03:24 UTC

Is there a way to validate/test a project.xml for a freeform project from the command line?

-- bumping to dev@ --

tl;dr
 Is it possible to write a test that validates a project has all its dependencies correct in the project.xml ?



The Apache Cassandra project has a netbeans project file
 ref: https://github.com/apache/cassandra/tree/trunk/ide/nbproject

When the project adds/removes/updates dependencies in its ant build.xml file, we don't always remember to also update the netbeans project file. (Freeform projects don't support classpath wildcards afaik.)

I'd like to write a simple unit test that ensures the netbeans project file is kept up to date, specifically that no error badges will exist on packages or files when opening the project in netbeans.
I don't care if this is done via a command line script, or programmatically in a java unit test.

regards,
Mick

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Is there a way to validate/test a project.xml for a freeform project from the command line?

Posted by Jan Lahoda <la...@gmail.com>.
Hi,

Sorry for the delayed answer. It is correct Jackpot is unfortunately not a
good tool for this. But should be doable by automatically running NetBeans.
I'll take a look at this in the next few days, if that's OK.

Jan

On Sat, Nov 14, 2020 at 10:15 AM Jaroslav Tulach <ja...@gmail.com>
wrote:

> Dne pátek 13. listopadu 2020 19:48:41 CET, Michael Semb Wever napsal(a):
> > > Or you can use [Jackpot](
> https://netbeans.apache.org/jackpot/index.html)!
> > > It's primary goal is to search and perform advanced refactorings and
> watch
> > > for code quality. However while doing so, it has to also check for
> errors.
> > > Unless I am mistaken it understands NetBeans Ant (hopefully also free
> > > form)
> > > projects. It can be invoked from a command line[1]. It may be ideal for
> > > validating project setup from a NetBeans IDE perspective in a CI
> system. I
> > > am CCing Jan Lahoda to guide you through that journey as the
> documentation
> > > may not fully cover this way of using the tool.
> >
> > Thanks Jaroslav!
> >
> > I am curious about Jackpot.
>
> Turns out I was wrong. Jan Lahoda told me that command line Jackpot needs
> to
> properly specify classpath, which is exactly what I wanted to avoid.
>
> I guess the test is the only option then. I am sorry for misguiding you.
> -jt
>
> >
> >
> > I tried to run
> >  `mvn
> org.apache.netbeans.modules.jackpot30:jackpot30-maven-plugin:analyze`
> > but it complains the current directory is not a maven project. So I went
> to
> > the code to see if it can be run maven-free, directly against the
> > freeform-form ant project…
> >
> >
> > Given the code is at https://github.com/apache/netbeans-jackpot30
> >
> > I managed to build the cmdline subproject with
> >
> > `ant -DNETBEANS_PLATFORM=/Users/mick/src/apache/netbeans/nbbuild/netbeans
> > -DJDK11=/Users/mick/.jenv/versions/11.0.4 build`
> >
> > Though build-and-test target failed. I'm on macos. And the jackpot script
> > doesn't work… but hacking it a bit gets me closer…
> >
> > java  -classpath
> >
> build/cluster/modules/org-netbeans-modules-jackpot30-cmdline.jar:build/clus
> >
> ter/modules/org-netbeans-modules-jackpot30-cmdline-lib.jar:tool/build/jopt-s
> >
> imple-3.2.jar:tool/build/slf4j-api-1.7.25.jar:tool/build/diffparser-1.4.jar:
> > tool/build/slf4j-nop-1.7.25.jar:<plus-all-the-netbeans-jar>
> > org.netbeans.modules.jackpot30.cmdline.Main --help
> >
> > I gave up at this point. Is there a shaded jarfile, or downloaded cmdline
> > artefact, I can download to keep me moving? Or have I just taken a wrong
> > turn here…?
> >
> > regards,
> > Mick
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> > For additional commands, e-mail: dev-help@netbeans.apache.org
> >
> > For further information about the NetBeans mailing lists, visit:
> > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: dev-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
>

Re: Is there a way to validate/test a project.xml for a freeform project from the command line?

Posted by Jaroslav Tulach <ja...@gmail.com>.
Dne pátek 13. listopadu 2020 19:48:41 CET, Michael Semb Wever napsal(a):
> > Or you can use [Jackpot](https://netbeans.apache.org/jackpot/index.html)!
> > It's primary goal is to search and perform advanced refactorings and watch
> > for code quality. However while doing so, it has to also check for errors.
> > Unless I am mistaken it understands NetBeans Ant (hopefully also free
> > form)
> > projects. It can be invoked from a command line[1]. It may be ideal for
> > validating project setup from a NetBeans IDE perspective in a CI system. I
> > am CCing Jan Lahoda to guide you through that journey as the documentation
> > may not fully cover this way of using the tool.
> 
> Thanks Jaroslav!
> 
> I am curious about Jackpot.

Turns out I was wrong. Jan Lahoda told me that command line Jackpot needs to 
properly specify classpath, which is exactly what I wanted to avoid.

I guess the test is the only option then. I am sorry for misguiding you.
-jt

> 
> 
> I tried to run
>  `mvn org.apache.netbeans.modules.jackpot30:jackpot30-maven-plugin:analyze`
> but it complains the current directory is not a maven project. So I went to
> the code to see if it can be run maven-free, directly against the
> freeform-form ant project…
> 
> 
> Given the code is at https://github.com/apache/netbeans-jackpot30
> 
> I managed to build the cmdline subproject with
> 
> `ant -DNETBEANS_PLATFORM=/Users/mick/src/apache/netbeans/nbbuild/netbeans
> -DJDK11=/Users/mick/.jenv/versions/11.0.4 build`
> 
> Though build-and-test target failed. I'm on macos. And the jackpot script
> doesn't work… but hacking it a bit gets me closer…
> 
> java  -classpath
> build/cluster/modules/org-netbeans-modules-jackpot30-cmdline.jar:build/clus
> ter/modules/org-netbeans-modules-jackpot30-cmdline-lib.jar:tool/build/jopt-s
> imple-3.2.jar:tool/build/slf4j-api-1.7.25.jar:tool/build/diffparser-1.4.jar:
> tool/build/slf4j-nop-1.7.25.jar:<plus-all-the-netbeans-jar>
> org.netbeans.modules.jackpot30.cmdline.Main --help
> 
> I gave up at this point. Is there a shaded jarfile, or downloaded cmdline
> artefact, I can download to keep me moving? Or have I just taken a wrong
> turn here…?
> 
> regards,
> Mick
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: dev-help@netbeans.apache.org
> 
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Is there a way to validate/test a project.xml for a freeform project from the command line?

Posted by Michael Semb Wever <mc...@apache.org>.

> Or you can use [Jackpot](https://netbeans.apache.org/jackpot/index.html)!
> It's primary goal is to search and perform advanced refactorings and watch
> for code quality. However while doing so, it has to also check for errors.
> Unless I am mistaken it understands NetBeans Ant (hopefully also free form)
> projects. It can be invoked from a command line[1]. It may be ideal for
> validating project setup from a NetBeans IDE perspective in a CI system. I
> am CCing Jan Lahoda to guide you through that journey as the documentation
> may not fully cover this way of using the tool.


Thanks Jaroslav!

I am curious about Jackpot. 


I tried to run
 `mvn org.apache.netbeans.modules.jackpot30:jackpot30-maven-plugin:analyze` 
but it complains the current directory is not a maven project. So I went to the code to see if it can be run maven-free, directly against the freeform-form ant project…


Given the code is at https://github.com/apache/netbeans-jackpot30

I managed to build the cmdline subproject with

`ant -DNETBEANS_PLATFORM=/Users/mick/src/apache/netbeans/nbbuild/netbeans -DJDK11=/Users/mick/.jenv/versions/11.0.4 build`

Though build-and-test target failed. I'm on macos. And the jackpot script doesn't work… but hacking it a bit gets me closer…

java  -classpath build/cluster/modules/org-netbeans-modules-jackpot30-cmdline.jar:build/cluster/modules/org-netbeans-modules-jackpot30-cmdline-lib.jar:tool/build/jopt-simple-3.2.jar:tool/build/slf4j-api-1.7.25.jar:tool/build/diffparser-1.4.jar:tool/build/slf4j-nop-1.7.25.jar:<plus-all-the-netbeans-jar> org.netbeans.modules.jackpot30.cmdline.Main --help

I gave up at this point. Is there a shaded jarfile, or downloaded cmdline artefact, I can download to keep me moving? Or have I just taken a wrong turn here…?

regards,
Mick


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Is there a way to validate/test a project.xml for a freeform project from the command line?

Posted by Jaroslav Tulach <ja...@gmail.com>.
 > tl;dr
> Is it possible to write a test that validates a project has all its
dependencies correct in the project.xml ?

Interesting topic!

I can write a test that launches NetBeans, opens some projects, uses
[JavaSource](
https://bits.netbeans.org/12.0/javadoc/org-netbeans-modules-java-source-base/org/netbeans/api/java/source/JavaSource.html)
to iterate through the sources and check for errors. I have done that in
the past. Use [NbModuleSuite](
https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-nbjunit/org/netbeans/junit/NbModuleSuite.html)
to launch NetBeans IDE in a test.

Or you can use [Jackpot](https://netbeans.apache.org/jackpot/index.html)!
It's primary goal is to search and perform advanced refactorings and watch
for code quality. However while doing so, it has to also check for errors.
Unless I am mistaken it understands NetBeans Ant (hopefully also free form)
projects. It can be invoked from a command line[1]. It may be ideal for
validating project setup from a NetBeans IDE perspective in a CI system. I
am CCing Jan Lahoda to guide you through that journey as the documentation
may not fully cover this way of using the tool.

If we could use Jackpot for validating project structure, then it'd be
clearly amazing! It is something everyone needs and at the end, I could
also delete my test that does that manually.
-jt

[1] Jan integrated Jackpot into GraalVM build infrastructure with this
commit
https://github.com/graalvm/mx/commit/58540336f1a583c0c2058f0faa30e27bfb99839d#diff-3c2ada2edc0aef357c3874192df806717735257b625b509a48b7d13a45a75adcR29

pá 6. 11. 2020 v 9:03 odesílatel Michael Semb Wever <mc...@apache.org> napsal:

> -- bumping to dev@ --
>
> tl;dr
>  Is it possible to write a test that validates a project has all its
> dependencies correct in the project.xml ?
>
>
>
> The Apache Cassandra project has a netbeans project file
>  ref: https://github.com/apache/cassandra/tree/trunk/ide/nbproject
>
> When the project adds/removes/updates dependencies in its ant build.xml
> file, we don't always remember to also update the netbeans project file.
> (Freeform projects don't support classpath wildcards afaik.)
>
> I'd like to write a simple unit test that ensures the netbeans project
> file is kept up to date, specifically that no error badges will exist on
> packages or files when opening the project in netbeans.
> I don't care if this is done via a command line script, or
> programmatically in a java unit test.
>
> regards,
> Mick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: dev-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
>