Skip to content

Commit

Permalink
Fix the outdir to refer to task workdir
Browse files Browse the repository at this point in the history
Fix publihs outdir to use _workdir

@bengy's auto work dir change the workdir for

Verified locally.

Earlier ../pants goal publish src/scala/com/pants/example:jvm-run-example-lib --publish-local=~tdesai/m2/ used to fail.

12:44:56 00:01     [publish]Skipping check for a clean master in test mode.

               FAILURE
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 116, in copy
    copyfile(src, dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 81, in copyfile
    with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: u'/Users/tdesai/projects/pants/.pants.d/publish/jar_create_publish/com.pants-jvm-run-example-lib.jar'
[tw-172-25-20-142 pants]$

=================================
Now

[tw-172-25-20-142 pants]$ PANTS_DEV=1 ./pants goal publish src/scala/com/pants/example:jvm-run-example-lib --publish-local=~tdesai/m2/
*** Running pants in dev mode from /Users/tdesai/projects/pants/src/python/pants/bin/pants_exe.py ***

16:29:26 00:00 [main]
               See a report at: http://localhost:59125/run/pants_run_2014_05_12_16_29_26_234
16:29:26 00:00   [setup]
16:29:26 00:00     [bootstrap]
16:29:26 00:00     [parse]
16:29:26 00:00   [bootstrap]
16:29:26 00:00     [bootstrap-jvm-tools]
16:29:26 00:00   [gen]
16:29:26 00:00     [thrift]
16:29:26 00:00     [scrooge]
16:29:26 00:00     [protoc]
16:29:26 00:00     [antlr]
16:29:26 00:00   [check-exclusives]
16:29:26 00:00     [check-exclusives]
16:29:26 00:00   [resolve]
16:29:26 00:00     [ivy]
16:29:26 00:00   [compile]
16:29:26 00:00     [jvm]
16:29:26 00:00       [scala]
16:29:26 00:00   [resources]
16:29:26 00:00     [prepare]
16:29:26 00:00   [publish]
16:29:26 00:00     [javadoc_publish]
16:29:26 00:00     [scaladoc_publish]
16:29:26 00:00     [jar_create_publish]
16:29:26 00:00     [publish]Skipping check for a clean tdesai/fix_publish in test mode.

               SUCCESS
[tw-172-25-20-142 pants]$

Testing Done:
SO this fixes publishing in dryrun  regression of pantsbuild@1d86550

CI
https://travis-ci.org/pantsbuild/pants/builds/25022520

Bugs closed: 119

Reviewed at https://rbcommons.com/s/twitter/r/335/
  • Loading branch information
tejal29 authored and Tejal Desai committed May 13, 2014
1 parent b3d0140 commit f331c59
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/python/pants/tasks/jar_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,7 @@ def __init__(self, context, workdir, scm=None):
ScmPublish.__init__(self, scm or get_scm(),
self.context.config.getlist(
JarPublish._CONFIG_SECTION, 'restrict_push_branches'))
self.outdir = os.path.join(context.config.getdefault('pants_workdir'), 'publish')
self.cachedir = os.path.join(self.outdir, 'cache')
self.cachedir = os.path.join(self.workdir, 'cache')

self._jvmargs = context.config.getlist(JarPublish._CONFIG_SECTION, 'ivy_jvmargs', default=[])

Expand Down Expand Up @@ -468,7 +467,7 @@ def fingerprint_internal(tgt):
return fingerprint or '0.0.0'

def artifact_path(jar, version, name=None, suffix='', extension='jar', artifact_ext=''):
return os.path.join(self.outdir, jar.org, jar.name + artifact_ext,
return os.path.join(self.workdir, jar.org, jar.name + artifact_ext,
'%s%s-%s%s.%s' % ((name or jar.name),
artifact_ext if name != 'ivy' else '',
version,
Expand Down Expand Up @@ -514,7 +513,7 @@ def stage_artifacts(tgt, jar, version, changelog, confs=None):

head_sha = self.scm.commit_id

safe_rmtree(self.outdir)
safe_rmtree(self.workdir)
published = []
skip = (self.restart_at is not None)
for target in exported_targets:
Expand Down Expand Up @@ -602,10 +601,10 @@ def publish(ivyxml_path):
args = [
'-settings', ivysettings,
'-ivy', ivyxml_path,
'-deliverto', '%s/[organisation]/[module]/ivy-[revision].xml' % self.outdir,
'-deliverto', '%s/[organisation]/[module]/ivy-[revision].xml' % self.workdir,
'-publish', resolver,
'-publishpattern', '%s/[organisation]/[module]/'
'[artifact]-[revision](-[classifier]).[ext]' % self.outdir,
'[artifact]-[revision](-[classifier]).[ext]' % self.workdir,
'-revision', newver.version(),
'-m2compatible',
]
Expand Down Expand Up @@ -751,10 +750,10 @@ def changelog(self, target, sha):
def generate_ivysettings(self, publishedjars, publish_local=None):
template_relpath = os.path.join('templates', 'jar_publish', 'ivysettings.mustache')
template = pkgutil.get_data(__name__, template_relpath)
with safe_open(os.path.join(self.outdir, 'ivysettings.xml'), 'w') as wrapper:
with safe_open(os.path.join(self.workdir, 'ivysettings.xml'), 'w') as wrapper:
generator = Generator(template,
ivysettings=self.ivysettings,
dir=self.outdir,
dir=self.workdir,
cachedir=self.cachedir,
published=[TemplateData(org=jar.org, name=jar.name)
for jar in publishedjars],
Expand Down

0 comments on commit f331c59

Please sign in to comment.