forked from gocd/gocd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildfile
100 lines (82 loc) · 3.01 KB
/
buildfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#*************************GO-LICENSE-START********************************
# Copyright 2014 ThoughtWorks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a-qgreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#*************************GO-LICENSE-END**********************************
require 'java' if RUBY_PLATFORM == "java"
$PROJECT_BASE = File.expand_path("../", __FILE__)
RUNNING_TESTS = 'running_tests'
def running_tests?
ENV[RUNNING_TESTS] == 'true'
end
def running_tests!
ENV[RUNNING_TESTS] = 'true'
end
def not_running_tests!
ENV[RUNNING_TESTS] = 'false'
end
# Generated by Buildr 1.3.4, change to your liking
# Version number for this release
VERSION_NUMBER = if ENV['GO_DIST_VERSION']
"15.2.0-#{ENV['GO_DIST_VERSION']}"
else
'15.2.0'
end
# Group identifier for your projects
GROUP = "cruise"
#discover the revision and commit digest
def stdout_of command
Util.win_os? && command.gsub!(/'/, '"')
stdout = `#{command}`
$?.success? || fail("`#{command}` failed")
stdout
end
vcs_rev_13=stdout_of("git log -1 --pretty='%H'")[0..13]
vcs_rev_short=stdout_of("git log -1 --pretty='%h'")
RELEASE_VCS_REV = (vcs_rev_short.length > vcs_rev_13.length) ? vcs_rev_short : vcs_rev_13
RELEASE_REVISION = stdout_of("git log --pretty=format:''").length
RELEASE_COMMIT = "#{RELEASE_REVISION}-#{RELEASE_VCS_REV}"
# Specify Maven 2.0 remote repositories here, like this:
repositories.remote << "http://repo1.maven.org/maven2/"
desc "Go - ThoughtWorks Studios"
define "cruise" do |project|
compile.options[:other] = %w[-encoding UTF-8 -target 1.7 -source 1.7]
TMP_DIR = test.options[:properties]['java.io.tmpdir'] = _('target/temp')
mkpath TMP_DIR
manifest['Go-Version'] = VERSION_NUMBER
project.version = VERSION_NUMBER
project.group = GROUP
ENV["VERSION_NUMBER"] = VERSION_NUMBER
ENV["RELEASE_COMMIT"] = RELEASE_COMMIT
require './cruise-modules'
desc "bump version number"
task :update_versions do
bump_command = "mvn versions:set -DnewVersion=#{VERSION_NUMBER} -DgenerateBackupPoms=false"
sh(bump_command)
cd('plugin-infra/sample-plugins') do
sh(bump_command)
end
['curl-plugin-old-api-based', 'curl-plugin', 'descriptor-hash-plugin'].each do |dir|
cd("plugin-infra/sample-plugins/#{dir}") do
existing_pom = File.read("pom.xml")
new_pom = existing_pom.gsub(%r{<version>15.2.0</version>}, "<version>#{VERSION_NUMBER}</version>")
File.open('pom.xml', 'w') do |f|
f.puts(new_pom)
end
end
end
end
clean do
mkpath TMP_DIR
end
end