From commits-return-8260-archive-asf-public=cust-asf.ponee.io@buildr.apache.org Thu May 10 01:46:45 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id A84CE1807AC for ; Thu, 10 May 2018 01:46:43 +0200 (CEST) Received: (qmail 38909 invoked by uid 500); 9 May 2018 23:46:42 -0000 Mailing-List: contact commits-help@buildr.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@buildr.apache.org Delivered-To: mailing list commits@buildr.apache.org Received: (qmail 38828 invoked by uid 99); 9 May 2018 23:46:42 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2018 23:46:42 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 3E67C3A0D25 for ; Wed, 9 May 2018 23:46:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r26822 [12/45] - in /dev/buildr/1.5.6: ./ dist/ site/ site/css/ site/images/ site/rdoc/ site/rdoc/Buildr/ site/rdoc/Buildr/ArchiveTask/ site/rdoc/Buildr/ArtifactNamespace/ site/rdoc/Buildr/Assets/ site/rdoc/Buildr/CPom/ site/rdoc/Buildr/Che... Date: Wed, 09 May 2018 23:46:39 -0000 To: commits@buildr.apache.org From: donaldp@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20180509234641.3E67C3A0D25@svn01-us-west.apache.org> Added: dev/buildr/1.5.6/site/rdoc/Buildr/ActsAsArtifact.html ============================================================================== --- dev/buildr/1.5.6/site/rdoc/Buildr/ActsAsArtifact.html (added) +++ dev/buildr/1.5.6/site/rdoc/Buildr/ActsAsArtifact.html Wed May 9 23:46:39 2018 @@ -0,0 +1,1007 @@ + + + + + + +module Buildr::ActsAsArtifact - buildr + + + + + + + + + + + + + + +
+

+ module Buildr::ActsAsArtifact +

+ +
+ +

Mixin with a task to make it behave like an artifact. Implemented by the +packaging tasks.

+ +

An artifact has an identifier, group identifier, type, version number and +optional classifier. All can be used to locate it in the local repository, +download from or upload to a remote repository.

+ +

The to_spec and to_hash methods allow it to +be used everywhere an artifact is accepted.

+ +
+ + + + +
+ + + + + +
+
+

Constants

+
+
+ +
ARTIFACT_ATTRIBUTES + +
+ + +
MAVEN_METADATA + +
+ + +
+
+ + + +
+
+

Attributes

+
+ + +
+
+ buildr_project[RW] +
+ +
+ + + +
+
+ +
+
+ classifier[R] +
+ +
+ +

Optional artifact classifier.

+ +
+
+ +
+
+ group[R] +
+ +
+ +

The group identifier.

+ +
+
+ +
+
+ id[R] +
+ +
+ +

The artifact identifier.

+ +
+
+ +
+
+ type[R] +
+ +
+ +

The file type. (Symbol)

+ +
+
+ +
+
+ version[R] +
+ +
+ +

The version number.

+ +
+
+ +
+ + + +
+
+

Public Instance Methods

+
+ + +
+ +
+ final_version() + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/packaging/artifact.rb, line 82
+def final_version
+  return version unless snapshot?
+  Time.now.strftime("%Y%m%d.%H%M%S")
+end
+
+ +
+ + + + +
+ + +
+ +
+ install() + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/packaging/artifact.rb, line 188
+def install
+  invoke
+  in_local_repository = Buildr.repositories.locate(self)
+  if pom && pom != self && classifier.nil?
+    pom.invoke
+    pom.install
+  end
+  if name != in_local_repository
+    mkpath File.dirname(in_local_repository)
+    cp name, in_local_repository, :preserve => false
+    info "Installed #{name} to #{in_local_repository}"
+  end
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + javadoc_artifact → Artifact + + + click to toggle source + +
+ + + +
+ +

Convenience method that returns the associated javadoc artifact

+ + + + +
+
# File lib/buildr/packaging/artifact.rb, line 138
+def javadoc_artifact
+  javadoc_spec = to_spec_hash.merge(:classifier=>'javadoc')
+  javadoc_task = OptionalArtifact.define_task(Buildr.repositories.locate(javadoc_spec))
+  javadoc_task.send :apply_spec, javadoc_spec
+  javadoc_task
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + maven_metadata_xml → string + + + click to toggle source + +
+ + + +
+ +

Creates Maven Metadata XML content for this artifact.

+ + + + +
+
# File lib/buildr/packaging/artifact.rb, line 171
+def maven_metadata_xml
+  xml = Builder::XmlMarkup.new(:indent=>2)
+  xml.instruct!
+  xml.metadata do
+    xml.groupId       group
+    xml.artifactId    id
+    xml.version       version
+    xml.versioning do
+      xml.snapshot do
+        xml.timestamp final_version
+        xml.buildNumber 1
+      end
+      xml.lastupdated Time.now.strftime("%Y%m%d%H%M%S")
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + pom → Artifact + + + click to toggle source + +
+ + + +
+ +

Convenience method that returns a POM artifact.

+ + + + +
+
# File lib/buildr/packaging/artifact.rb, line 118
+def pom
+  return self if type == :pom
+  Buildr.artifact(:group=>group, :id=>id, :version=>version, :type=>:pom)
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + pom_xml → string + + + click to toggle source + +
+ + + +
+ +

Creates POM XML for this artifact.

+ + + + +
+
# File lib/buildr/packaging/artifact.rb, line 149
+def pom_xml
+  if self.buildr_project
+    Buildr::CustomPom.pom_xml(self.buildr_project, self)
+  else
+    Proc.new do
+      xml = Builder::XmlMarkup.new(:indent => 2)
+      xml.instruct!
+      xml.project do
+        xml.modelVersion '4.0.0'
+        xml.groupId group
+        xml.artifactId id
+        xml.version version
+        xml.classifier classifier if classifier
+      end
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+ snapshot?() + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/packaging/artifact.rb, line 78
+def snapshot?
+  version =~ /-SNAPSHOT$/
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + sources_artifact → Artifact + + + click to toggle source + +
+ + + +
+ +

Convenience method that returns a sources artifact.

+ + + + +
+
# File lib/buildr/packaging/artifact.rb, line 127
+def sources_artifact
+  sources_spec = to_spec_hash.merge(:classifier=>'sources')
+  sources_task = OptionalArtifact.define_task(Buildr.repositories.locate(sources_spec))
+  sources_task.send :apply_spec, sources_spec
+  sources_task
+end
+
+ +
+ + + + +
+ + +
+ +
+ to_hash() + +
+ + +
+ + + + + + +
+ + + + +
+ Alias for: to_spec_hash +
+ +
+ + +
+ + +
+ + to_spec → String + + + click to toggle source + +
+ + + +
+ +

Returns the artifact specification, in the structure:

+ +
<group>:<artifact>:<type>:<version>
+ +

or

+ +
<group>:<artifact>:<type>:<classifier>:<version>
+ + + + +
+
# File lib/buildr/packaging/artifact.rb, line 110
+def to_spec
+  classifier ? "#{group}:#{id}:#{type}:#{classifier}:#{version}" : "#{group}:#{id}:#{type}:#{version}"
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + to_spec_hash → Hash + + + click to toggle source + +
+ + + +
+ +

Returns the artifact specification as a hash. For example:

+ +
com.example:app:jar:1.2
+ +

becomes:

+ +
{ :group=>'com.example',
+  :id=>'app',
+  :type=>:jar,
+  :version=>'1.2' }
+
+ + + + +
+
# File lib/buildr/packaging/artifact.rb, line 97
+def to_spec_hash
+  base = { :group=>group, :id=>id, :type=>type, :version=>version }
+  classifier ? base.merge(:classifier=>classifier) : base
+end
+
+ +
+ + +
+ Also aliased as: to_hash +
+ + + +
+ + +
+ +
+ uninstall() + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/packaging/artifact.rb, line 202
+def uninstall
+  installed = Buildr.repositories.locate(self)
+  rm installed if File.exist?(installed)
+  pom.uninstall if pom && pom != self && classifier.nil?
+end
+
+ +
+ + + + +
+ + +
+ + +
+ + upload + + + click to toggle source + +
+ +
+ + upload(url) + + +
+ +
+ + upload(options) + + +
+ + + +
+ +

Uploads the artifact, its POM and digital signatures +to remote server.

+ +

In the first form, uses the upload options specified by +repositories.release_to or repositories.snapshot_to if the subject is a +snapshot artifact. In the second form, uses a URL that includes all the +relevant information. In the third form, uses a hash with the options :url, +:username, :password, and :permissions. All but :url are optional.

+ + + + +
+
# File lib/buildr/packaging/artifact.rb, line 220
+def upload(upload_to = nil)
+  upload_task(upload_to).invoke
+end
+
+ +
+ + + + +
+ + +
+ +
+ upload_task(upload_to = nil) + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/packaging/artifact.rb, line 224
+def upload_task(upload_to = nil)
+  upload_to ||= Buildr.repositories.snapshot_to if snapshot? && Buildr.repositories.snapshot_to != nil && Buildr.repositories.snapshot_to[:url] != nil
+  upload_to ||= Buildr.repositories.release_to
+  upload_to = { :url=>upload_to } unless Hash === upload_to
+  raise ArgumentError, 'Don\t know where to upload, perhaps you forgot to set repositories.release_to' unless upload_to[:url]
+
+  # Set the upload URI, including mandatory slash (we expect it to be the base directory).
+  # Username/password may be part of URI, or separate entities.
+  uri = URI.parse(upload_to[:url].clone)
+  uri.path = uri.path + '/' unless uri.path[-1] == '/'
+  to_escape = "!\"\#$%&'()*+,-./:;<=>?@{}|~`'"
+  uri.user = URI.encode(upload_to[:username], to_escape) if upload_to[:username]
+  uri.password = URI.encode(upload_to[:password], to_escape) if upload_to[:password]
+
+  path = group.gsub('.', '/') + "/#{id}/#{version}/#{upload_name}"
+
+  unless task = Buildr.application.lookup(uri+path)
+    deps = [self]
+    deps << pom.upload_task( upload_to ) if pom && pom != self && classifier.nil?
+
+    task = Rake::Task.define_task uri + path => deps do
+      # Upload artifact relative to base URL, need to create path before uploading.
+      options = upload_to[:options] || {:permissions => upload_to[:permissions]}
+      info "Deploying #{to_spec}"
+      URI.upload uri + path, name, options
+      if snapshot? && pom != self
+         maven_metadata = group.gsub('.', '/') + "/#{id}/#{version}/#{MAVEN_METADATA}"
+         URI.write uri + maven_metadata, maven_metadata_xml, :permissions => upload_to[:permissions]
+      end
+    end
+  end
+  task
+end
+
+ +
+ + + + +
+ + +
+ +
+
+

Protected Instance Methods

+
+ + +
+ +
+ apply_spec(spec) + + click to toggle source + +
+ + +
+ +

Apply specification to this artifact.

+ + + + +
+
# File lib/buildr/packaging/artifact.rb, line 261
+def apply_spec(spec)
+  spec = Artifact.to_hash(spec)
+  ARTIFACT_ATTRIBUTES.each { |key| instance_variable_set("@#{key}", spec[key]) }
+  self
+end
+
+ +
+ + + + +
+ + +
+ +
+ extract_type(type) + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/packaging/artifact.rb, line 276
+def extract_type(type)
+  return :jar if type == :bundle
+  type
+end
+
+ +
+ + + + +
+ + +
+ +
+ group_path() + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/packaging/artifact.rb, line 267
+def group_path
+  group.gsub('.', '/')
+end
+
+ +
+ + + + +
+ + +
+ +
+ upload_name() + + click to toggle source + +
+ + +
+ + + + + + +
+
# File lib/buildr/packaging/artifact.rb, line 271
+def upload_name
+  return File.basename(name) unless snapshot?
+  return File.basename(name).gsub(/SNAPSHOT/, "#{final_version}-1")
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + + Added: dev/buildr/1.5.6/site/rdoc/Buildr/Ant.html ============================================================================== --- dev/buildr/1.5.6/site/rdoc/Buildr/Ant.html (added) +++ dev/buildr/1.5.6/site/rdoc/Buildr/Ant.html Wed May 9 23:46:39 2018 @@ -0,0 +1,264 @@ + + + + + + +module Buildr::Ant - buildr + + + + + + + + + + + + + + +
+

+ module Buildr::Ant +

+ +
+ +
+ + + + +
+ + + + + +
+
+

Constants

+
+
+ +
VERSION + +

Which version of Ant we're using by default.

+ + +
+
+ + + + + +
+
+

Public Class Methods

+
+ + +
+ +
+ dependencies() + + click to toggle source + +
+ + +
+ +

Ant classpath dependencies.

+ + + + +
+
# File lib/buildr/java/ant.rb, line 34
+def dependencies
+  # Ant-Trax required for running the JUnitReport task, and there's no other place
+  # to put it but the root classpath.
+  @dependencies ||= ["org.apache.ant:ant:jar:#{version}", "org.apache.ant:ant-launcher:jar:#{version}"]
+end
+
+ +
+ + + + +
+ + +
+ +
+ version() + + click to toggle source + +
+ + +
+ +

Current version of Ant being used.

+ + + + +
+
# File lib/buildr/java/ant.rb, line 29
+def version
+  Buildr.settings.build['ant'] || VERSION
+end
+
+ +
+ + + + +
+ + +
+ +
+
+

Public Instance Methods

+
+ + +
+ + +
+ + ant(name) { |AntProject| ... } → AntProject + + + click to toggle source + +
+ + + +
+ +

Creates a new AntProject with the specified name, yield to the block for +defining various Ant tasks, and executes each task +as it's defined.

+ +

For example:

+ +
ant("hibernatedoclet') do |doclet|
+  doclet.taskdef :name=>'hibernatedoclet',
+    :classname=>'xdoclet.modules.hibernate.HibernateDocletTask', :classpath=>DOCLET
+  doclet.hibernatedoclet :destdir=>dest_dir, :force=>'true' do
+    hibernate :version=>'3.0'
+    fileset :dir=>source, :includes=>'**/*.java'
+  end
+end
+ + + + +
+
# File lib/buildr/java/ant.rb, line 60
+def ant(name, &block)
+  options = { :name=>name, :basedir=>Dir.pwd, :declarative=>true }
+  options.merge!(:logger=> Logger.new(STDOUT), :loglevel=> Logger::DEBUG) if trace?(:ant)
+  Java.load
+  Antwrap::AntProject.new(options).tap do |project|
+    # Set Ant logging level to debug (--trace), info (default) or error only (--quiet).
+    project.project.getBuildListeners().get(0).
+      setMessageOutputLevel((trace?(:ant) && 4) || (verbose && 2) || 0)
+    yield project if block_given?
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + + Added: dev/buildr/1.5.6/site/rdoc/Buildr/Apt.html ============================================================================== --- dev/buildr/1.5.6/site/rdoc/Buildr/Apt.html (added) +++ dev/buildr/1.5.6/site/rdoc/Buildr/Apt.html Wed May 9 23:46:39 2018 @@ -0,0 +1,171 @@ + + + + + + +module Buildr::Apt - buildr + + + + + + + + + + + + + + +
+

+ module Buildr::Apt +

+ +
+ +

Methods added to Project to support the Java Annotation Processor.

+ +
+ + + + +
+ + + + + + + + + +
+
+

Public Instance Methods

+
+ + +
+ + +
+ + apt(*sources) → task + + + click to toggle source + +
+ + + +
+ +

Returns a task that will use Java#apt to generate source files in +target/generated/apt, from all the source directories passed as arguments. +Uses the compile.sources list if on arguments supplied.

+ +

For example:

+ + + + +
+
# File lib/buildr/java/compiler.rb, line 109
+def apt(*sources)
+  sources = compile.sources if sources.empty?
+  file(path_to(:target, 'generated/apt')=>sources) do |task|
+    cmd_args = [ trace?(:apt) ? '-verbose' : '-nowarn' ]
+    cmd_args << '-nocompile' << '-s' << task.name
+    cmd_args << '-source' << compile.options.source if compile.options.source
+    classpath = Buildr.artifacts(compile.dependencies).map(&:to_s).each { |t| task(t).invoke }
+    cmd_args << '-classpath' << classpath.join(File::PATH_SEPARATOR) unless classpath.empty?
+    cmd_args += (sources.map(&:to_s) - [task.name]).
+      map { |file| File.directory?(file) ? FileList["#{file}/**/*.java"] : file }.flatten
+    unless Buildr.application.options.dryrun
+      info 'Running apt'
+      trace (['apt'] + cmd_args).join(' ')
+      Java.com.sun.tools.apt.Main.process(cmd_args.to_java(Java.java.lang.String)) == 0 or
+        fail 'Failed to process annotations, see errors above'
+    end
+  end
+end
+
+ +
+ + + + +
+ + +
+ +
+
+ + + +