Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Added new maven-targets option to maven plugin. #627
Conversation
snappy-m-o
commented
Jul 3, 2016
|
Can one of the admins verify this patch? |
snappy-m-o
commented
Jul 3, 2016
|
Can one of the admins verify this patch? |
ZenHarbinger
added some commits
Jul 3, 2016
|
ok to test |
|
|
snappy-m-o
commented
Jul 7, 2016
|
Can one of the admins verify this patch? |
snappy-m-o
commented
Jul 7, 2016
|
Can one of the admins verify this patch? |
|
ok to test |
kyrofa
reviewed
Jul 7, 2016
| + raise RuntimeError("could not find any" | ||
| + "built jar files for part") | ||
| + basedir = 'jar' if jarfiles and len(f) == 0 else ( | ||
| + 'war' if warfiles and len(f) == 0 else f) |
ZenHarbinger
Jul 7, 2016
Contributor
I get that, but then I couldn't pass the coverage and complexity.
ZenHarbinger
Jul 7, 2016
Contributor
I have no idea how the dummy testing works, or how to set up a composite maven project for that. I'm willing to do it though.
kyrofa
Jul 7, 2016
Member
Yes please-- that's how we ensure this 1) works correctly, and 2) doesn't break in the future
ZenHarbinger
Jul 7, 2016
Contributor
Where can I find any docs on this, it was pretty rough to understand what was there to begin with.
kyrofa
Jul 7, 2016
Member
I'm afraid there are none. You have a good start-- you added the maven_targets to the Options class there, but you need to write some tests that actually make use of them and verify the results. This test is probably the simplest place to start, learn from, and build upon.
kyrofa
reviewed
Jul 7, 2016
| + | ||
| + targetdir = os.path.join(self.installdir, basedir) | ||
| + os.makedirs(targetdir, exist_ok=True) | ||
| + self.run(['cp', '-a'] + arfiles + [targetdir]) |
kyrofa
Jul 7, 2016
Member
I'd prefer to use the python utilities for copying files rather than shelling out.
sergiusens
Jul 7, 2016
Collaborator
El 07/07/16 a las 16:35, Kyle Fazzari escribió:
In snapcraft/plugins/maven.py
#627 (comment):
for f in self.options.maven_targets:src = os.path.join(self.builddir, f, 'target')
jarfiles = glob.glob(os.path.join(src, '*.jar'))warfiles = glob.glob(os.path.join(src, '*.war'))arfiles = glob.glob(os.path.join(src, '*.[jw]ar'))
if not (arfiles):raise RuntimeError("could not find any""built jar files for part")basedir = 'jar' if jarfiles and len(f) == 0 else ('war' if warfiles and len(f) == 0 else f)
targetdir = os.path.join(self.installdir, basedir)os.makedirs(targetdir, exist_ok=True)self.run(['cp', '-a'] + arfiles + [targetdir])I'd prefer to use the python utilities for copying files rather than
shelling out.
Ah, nice catch!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/snapcore/snapcraft/pull/627/files/c8dc9a6288c6c68c11da4f5c45e3e4b49493bae0#r69972186,
or mute the thread
https://github.com/notifications/unsubscribe/ABF_5QIHLRzqaA1js3VMss5evoyqw9icks5qTVUbgaJpZM4JD7dL.
sergiusens
Jul 7, 2016
Collaborator
El 07/07/16 a las 16:37, Matthew Aguirre escribió:
In snapcraft/plugins/maven.py
#627 (comment):
for f in self.options.maven_targets:src = os.path.join(self.builddir, f, 'target')
jarfiles = glob.glob(os.path.join(src, '*.jar'))warfiles = glob.glob(os.path.join(src, '*.war'))arfiles = glob.glob(os.path.join(src, '*.[jw]ar'))
if not (arfiles):raise RuntimeError("could not find any""built jar files for part")basedir = 'jar' if jarfiles and len(f) == 0 else ('war' if warfiles and len(f) == 0 else f)
targetdir = os.path.join(self.installdir, basedir)os.makedirs(targetdir, exist_ok=True)self.run(['cp', '-a'] + arfiles + [targetdir])Sure, that's just what was already there.
@kyrofa pass the secret sauce on copytree link_or_copy ;-)
kyrofa
Jul 7, 2016
Member
@kyrofa pass the secret sauce on copytree link_or_copy ;-)
Ah, good idea.
Instead of copying this, you can hard-link them (and copy as a backup) using something like this.
ZenHarbinger
Jul 7, 2016
Contributor
OK, I just checked in a fix for this, I will work on the tests later.
Use of: shutil.copy(); we don't want to copy the tree of the target directory because it would grab all the intermediary output too, not just the jar or war file.
|
This is looking good, thank you! A little more work to do. Also, please make sure that:
More details about both of these items can be found in the contribution guide. |
|
Who is: Canonical Project Manager or contact for the contributor agreement? |
ZenHarbinger commentedJul 3, 2016
•
Edited 1 time
-
ZenHarbinger
Jul 4, 2016
Composite maven projects do not build to 'target'. This update allows the user to specify the child target to copy.
By default, the basedir/target directory is searched, otherwise it uses the 'target' directory of each specified value.
The installdir for each child project is the name of the child project. If no values are specified, it reverts to the default of 'jar' or 'war' depending on the target type of the project.