Skip to content

Commit 9a5f176

Browse files
authored
Merge pull request #3 from mitza-oci/ghs-custom-cmd
ghs projects: create a .cmd file for all custom commands
2 parents ff131ee + 52614e1 commit 9a5f176

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

modules/GHSProjectCreator.pm

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ use vars qw(@ISA);
2525
# Data Section
2626
# ************************************************************
2727

28+
my %templates = ('ghs' => '.gpj',
29+
'ghscmd' => '.cmd');
30+
my @tkeys = sort keys %templates;
31+
my $default_template = 'ghs';
32+
2833
my $startre;
2934

3035
# ************************************************************
@@ -67,6 +72,7 @@ sub post_file_creation {
6772
return undef;
6873
}
6974

75+
7076
sub compare_output {
7177
#my $self = shift;
7278
return 1;
@@ -79,6 +85,26 @@ sub project_file_extension {
7985
}
8086

8187

88+
sub get_template {
89+
return @tkeys;
90+
}
91+
92+
93+
sub file_visible { # (self, template)
94+
return $_[1] eq $default_template;
95+
}
96+
97+
98+
sub project_file_name {
99+
my($self, $name, $template) = @_;
100+
my $project_file_name = $self->SUPER::project_file_name($name, $template);
101+
if (!$self->file_visible($template)) {
102+
$project_file_name =~ s/\.gpj$/.cmd/;
103+
}
104+
return $project_file_name;
105+
}
106+
107+
82108
sub fill_value {
83109
my($self, $name) = @_;
84110
my $value;

templates/ghscmd.mpd

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
pushd <%convert_slashes(reltop)%>
2+
<%foreach(custom_types)%>
3+
<%foreach(custom_type->input_files)%>
4+
<%if(flag_overrides(custom_type->input_file, gendir))%>
5+
<%mkdir%> <%flag_overrides(custom_type->input_file, gendir)%><%postmkdir%>
6+
<%endif%>
7+
<%translate_vars(custom_type->command, win32)%> ^
8+
<%if(flag_overrides(custom_type->input_file, commandflags))%>
9+
<%translate_vars(flag_overrides(custom_type->input_file, commandflags), win32)%> ^
10+
<%else%>
11+
<%translate_vars(custom_type->commandflags, win32)%> ^
12+
<%endif%>
13+
<%if(custom_type->output_option)%>
14+
<%custom_type->input_file%> <%custom_type->output_option%> <%custom_type->input_file->output_file%>
15+
<%else%>
16+
<%custom_type->input_file%>
17+
<%endif%>
18+
<%endfor%>
19+
<%endfor%>
20+
popd

0 commit comments

Comments
 (0)