blob: b05758e1e0cd8541766223f9649379a36e0f94f5 [file] [log] [blame]
alshabib676bef52016-06-02 12:18:32 -07001/*
2 * Copyright 2012 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17import org.opencord.gradle.rules.*
18import org.yaml.snakeyaml.Yaml
19
20allprojects {
21 apply plugin: 'base'
22 apply plugin: 'de.gesellix.docker'
23 //apply plugin: 'com.tmiyamon.config'
24
25 docker {
26 // dockerHost = System.env.DOCKER_HOST ?: 'unix:///var/run/docker.sock'
27 // dockerHost = System.env.DOCKER_HOST ?: 'https://192.168.99.100:2376'
28 // certPath = System.getProperty('docker.cert.path') ?: "${System.getProperty('user.home')}/.docker/machine/machines/default"
29 // authConfigPlain = [
30 // "username" : "joe",
31 // "password" : "some-pw-as-needed",
32 // "email" : "joe@acme.com",
33 // "serveraddress" : "https://index.docker.io/v1/"
34 // ]
35 }
36}
37
38ext {
39
40 appVersion = null
41
42 // Target registry to be used to publish docker images needed for deployment
43 targetReg = project.hasProperty('targetReg') ? project.getProperty('targetReg') : 'localhost:5000'
44
45 // The tag used to tag the docker images push to the target registry
46 targetTag = project.hasProperty('targetTag') ? project.getProperty('targetTag') : 'candidate'
47
48 comps = [
49 'aaa' : [
50 'type': 'gitmodule',
51 'upstream': 'https://gerrit.opencord.org/aaa',
52 'branch' : 'master',
53 'tag' : appVersion,
54 'componentDir': './apps/aaa'
55 ],
56 'vtn' : [
57 'type': 'gitmodule',
58 'upstream': 'https://gerrit.opencord.org/vtn',
59 'branch' : 'master',
60 'tag' : appVersion,
61 'componentDir': './apps/vtn'
62 ],
63 'mcast' : [
64 'type': 'gitmodule',
65 'upstream': 'https://gerrit.opencord.org/mcast',
66 'branch' : 'master',
67 'tag' : appVersion,
68 'componentDir': './apps/mcast'
69 ],
70 'igmp' : [
71 'type': 'gitmodule',
72 'upstream': 'https://gerrit.opencord.org/igmp',
73 'branch' : 'master',
74 'tag' : appVersion,
75 'componentDir': './apps/igmp'
76 ],
77 'olt' : [
78 'type': 'gitmodule',
79 'upstream': 'https://gerrit.opencord.org/olt',
80 'branch' : 'master',
81 'tag' : appVersion,
82 'componentDir': './apps/olt'
83 ],
84 'config' : [
85 'type': 'gitmodule',
86 'upstream': 'https://gerrit.opencord.org/config',
87 'branch' : 'master',
88 'tag' : appVersion,
89 'componentDir': './apps/config'
90 ]
91 ]
92}
93
94// ~~~~~~~~~~~~~~~~~~~ Global tasks ~~~~~~~~~~~~~~~~~~~~~~~
95
96task fetchGitSubmodules {
97 comps.each { name, spec -> if (spec.type == 'gitmodule') { dependsOn "gitupdate" + name } }
98}
99
100task fetch {
101 dependsOn fetchGitSubmodules
102}
103
104// To be used to generate all needed binaries that need to be present on the target
105// as docker images in the local docker runner.
106task buildImages (dependsOn: fetch, type: Exec){
107 workingDir './apps'
108 commandLine 'mvn', 'clean', 'install'
109}
110
111// Publish image(s) built during the build step into targetReg registry using the targetTag
112// tag. See maas subproject for examples on how to do this.
113task publish {
114 // ...
115}
116
117tasks.addRule(new GitSubmoduleUpdateRule(project))