This repository has been archived by the owner on Aug 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
TrackerTask.groovy
64 lines (52 loc) · 1.78 KB
/
TrackerTask.groovy
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
//
// ============================================================================
// (C) Copyright Schalk W. Cronje 2013-2016
//
// This software is licensed under the Apache License 2.0
// See http://www.apache.org/licenses/LICENSE-2.0 for license details
//
// Unless required by applicable law or agreed 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.
//
// ============================================================================
//
package org.ysb33r.gradle.gnumake.internal
import groovy.transform.CompileStatic
import groovy.transform.PackageScope
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.StopActionException
import org.gradle.api.tasks.TaskAction
import org.gradle.process.ExecResult
import org.ysb33r.gradle.gnumake.GnuMakeBuild
/**
* @author Schalk W. Cronjé
* @since 1.0
*/
@CompileStatic
class TrackerTask extends DefaultTask {
/** Runs a single target only
*
*/
@Input
String target
/** The GnuMakeBuild task that is tracked.
*
*/
@Input
String trackName
/** Stores the result of running a make command */
ExecResult execResult
@TaskAction
void exec() {
assert trackName != null
GnuMakeBuild tracks = project.tasks.getByName(trackName) as GnuMakeBuild
if(!executor) {
executor = new MakeExecutor(project)
}
def cmdargs = TaskUtils.buildCmdArgs(project,tracks,[target])
execResult = executor.runMake(tracks.executable,cmdargs,tracks.workingDir,tracks.environment)
}
Executor executor
}