-
1. Re: SHRINKDESC-92
jesper.pedersen Oct 13, 2011 4:31 PM (in response to rbattenfeld)I think having it as arguments to the Main class would also be ideal:
org.jboss.shrinkwrap.descriptor.cli.Main -target build -package org.jboss.jca.common.dsl.ironjacamar /path/to/ironjacamar_1_0.xsd
would generate
build/org/jboss/jca/common/dsl/ironjacamar/api build/org/jboss/jca/common/dsl/ironjacamar/impl
directories with the files in them based on the XSD. Having test classes generated should be optional IMHO.
If you do
public class Main { void setTarget(String v) {} String getTarget() {} // and so on }
it would be easy to create the Ant Task and Maven MOJO for the generator. See https://github.com/jesperpedersen/tattletale/blob/master/src/main/java/org/jboss/tattletale/ant/ReportTask.java of how I did it in Tattletale.
It should be possible to generate the service files too...
-
2. Re: SHRINKDESC-92
rbattenfeld Oct 15, 2011 1:08 PM (in response to jesper.pedersen)Cool. Yes this as well possible. I will change the implementation as you have suggested. Two things are a little bit complicated:
- The context xml is still mandatory. The generation process requires such a file. So, I cannot leave this file out. That means, this file must be passed as parameter.
- Making the test classes optionally
I focus on this. The moving the ironjacamar xsd's is already done.
-
3. Re: SHRINKDESC-92
rbattenfeld Oct 16, 2011 10:57 AM (in response to rbattenfeld)I worked on this. You can have alook at: https://github.com/shrinkwrap/descriptors/pull/53
My repo for covering SHRINKDESC-92 is: https://github.com/rbattenfeld/descriptors/tree/SHRINKDESC-92
Meanwhile, I have an idea how to make test cases optional and also how to generating the service files. Comes soon:-)
-
4. Re: SHRINKDESC-92
jesper.pedersen Oct 18, 2011 10:58 AM (in response to rbattenfeld)It must possible then to bundle a default context.xml file and use that one - loaded as resource through the classloader of the cli.
You missed the "TransformerTask extends org.apache.tools.ant.Task" requirement... Also include an antlib.xml file in the .jar which identifies the available tasks. Same thing for Maven: org.apache.maven.plugin.AbstractMojo + plugin.xml
-
5. Re: SHRINKDESC-92
rbattenfeld Oct 20, 2011 1:36 PM (in response to jesper.pedersen)Yes, I will enhance the ant task. Cool, I am learning these ant + maven tasks
I am not sure about the context file. It looks strange to me that part of the configurations are passed via command line args but the context file not. The context file is part of the user configuration and defines in your case the ironjacamar xsd files. Even the name of the file is not static.
Why not having this file somewhere in your build system?
-
6. Re: SHRINKDESC-92
jesper.pedersen Oct 20, 2011 1:48 PM (in response to rbattenfeld)Well, the context.xml file can be argument, but having the settings exposed directly through command line arguments, Ant or Maven properties would be better IMHO.
<descriptor-generator src="${resources.dir}/ironjacamar_1_0.xsd" dest="${target.dir}" include-testsuite="false"> <package>org.jboss.jca.common.dsl.ironjacamar</package> </descriptor-generator>
and so on.
-
7. Re: SHRINKDESC-92
rbattenfeld Oct 21, 2011 11:19 AM (in response to jesper.pedersen)Hmm, I see your point. There are two reasons why this is difficult:
- The first xslt transformation requires exactly such a xml file. Even we could pass everything over command line, these arguments have to be written to an xml file.
- The number of arguments. I think even for the IronJacamar descriptors are about 10-15 arguments required. That is compared to other descriptors not so much. If you see the schemaJava6.xml file with all the descriptors belonging together, you will end up by passing up 100 command line arguments.
I will work over the weekend for resolving the things you have mentioned.
Regards,
Ralf
-
8. Re: SHRINKDESC-92
jesper.pedersen Oct 21, 2011 11:39 AM (in response to rbattenfeld)The first xslt transformation requires exactly such a xml file. Even we could pass everything over command line, these arguments have to be written to an xml file.
Well, hacks like taking the parameters passed and writing out an XML file based on those, and then pass that could work. Maybe system properties could be used for substitution...
The number of arguments. I think even for the IronJacamar descriptors are about 10-15 arguments required. That is compared to other descriptors not so much. If you see the schemaJava6.xml file with all the descriptors belonging together, you will end up by passing up 100 command line arguments.
Yeah, it is basically two different "schools" - I find it is easier for people to understand if everything is exposed directly in the build environment files (build.xml / pom.xml) versus "hidden" in a configuration file.
However, we should also look at it from a time PoV - using a configuration file and exposing the path to that in the build environment takes the least amount of time. Improvements can always be made down the road.
And since you are doing the coding means that you get to decide
-
9. Re: SHRINKDESC-92
rbattenfeld Oct 23, 2011 7:36 AM (in response to jesper.pedersen)Hi Jesper
You are right, we can go futher with the configuration file and improved it later. I would love to support all of your suggestions but I don't see a practical solution at the moment.
I implemented so far the maven plugin and the ant task according the guide lines I found. I am stuck at the moment with writing test cases for the maven cli plugin. How do you tested the tattletate maven plugin (and the ant task)? According http://maven.apache.org/plugin-developers/plugin-testing.html
there are several test strategies available. The one with using maven-plugin-testing-harness throws an exception during the setup of, I guess, plexus stuff.
-
10. Re: SHRINKDESC-92
jesper.pedersen Oct 24, 2011 9:32 AM (in response to rbattenfeld)I don't have any automated test suite for those - just a manual test. So up to you
-
11. Re: SHRINKDESC-92
rbattenfeld Oct 26, 2011 4:32 AM (in response to jesper.pedersen)The maven plugin is running. You can integrate it with the following declaration:
<plugin>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
<artifactId>shrinkwrap-descriptors-cli-plugin</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<id>transform</id>
<phase>install</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>
<contextFile>${project.build.directory}/../../cli/src/test/resources/xml/schemasIronJacamar.xml</contextFile>
<targetDir>${project.build.directory}/../../cli-test/src/main/java</targetDir>
<testDir>${project.build.directory}/../../cli-test/src/test/java</testDir>
<tempDir>${project.build.directory}/cli</tempDir>
<trace>true</trace>
</configuration>
</execution>
</executions>
</plugin>
Two things are not done so far:
- The ant task is not tested
- Generating of the service files
When you define an empty <testDir></testDir> then the test cases are not generated.
Do you need the ant task really?
Let me know what you think and how to proceed.
Regards,
Ralf
-
12. Re: SHRINKDESC-92
alrubinger Nov 14, 2011 9:41 AM (in response to rbattenfeld)Hey Ralf:
So per our last discussion in Stuttgart, I went to pull your latest rbattenfeld/SHRINKDESC-92 commits into upstream/SHRINKDESC-92. Some blockers on there, however:
https://shrinkwrap.ci.cloudbees.com/view/SWD/job/ShrinkWrap_Descriptors_rbattenfeld-SHRINKDESC-92/2
If you ping back when this is resolved then I'll squash it all and put into the upstream sync point for further dev on SHRINKDESC-92.
S,
ALR -
13. Re: SHRINKDESC-92
rbattenfeld Nov 14, 2011 1:17 PM (in response to alrubinger)Heya Andrew
Yep, I will have a look. I will tweet you when this is resolved. Have a good time at the devoxx converence.
Tx, Ralf
-
14. Re: SHRINKDESC-92
rbattenfeld Nov 24, 2011 10:27 AM (in response to rbattenfeld)Hi Jesper
Did you had a chance to look at the latest push? The current version should support almost everything you need. I couldn't test the ant task but the maven plugin task is integrated and is part of the build, e.g. it produces the ironjacamer descriptors which is then tested by the following cli-test module.
Let me know, if you need help.
Tx,
Ralf