reality-generators 1.16.0 → 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: acd8a4936db77dd749853e4acafb77c085a1dcc850fc2f05765f81a3b5062c47
4
- data.tar.gz: 0c4eec47b3067dfc911819a8f0d73b883ea6dfa28882c3abecdba01f577bb095
3
+ metadata.gz: fc49b7084dd8c304b394d4239e66db433771c2be21644d833443fc64575d058a
4
+ data.tar.gz: c9df932fbcd415525cb5357f33e3bd0e19b366fe5f7087102a398be634bae10d
5
5
  SHA512:
6
- metadata.gz: fd269c773287b32e7420552b595134d5405c0d7954377fc23e76bada75b61308de2f801369f12a70197add6a40346c41ec0f50ce5fcc37a4336d4334028423a5
7
- data.tar.gz: 77e1e1c98b11647d59647369576b9c72713bf39ce03cbb21c28bccb1cf3e62217f3af7722e79c75c1c0431ee80a011461b2b67504c46ff829a33b7953d5bf342
6
+ metadata.gz: c2956dd24501a523e7afd2a492b8218dfce9a79544e3eeccd4d50ceae995f67eff43ea005db0e5cd4e0fecea5af937c001c3d5a8fc936e60cbed3153efd491d4
7
+ data.tar.gz: 07ae6c65e4f97a0e4f40884f33fde589f900f79414c94a69f574e8117f8c734987a129aaee5d9ebb3bfc00f4d52bbd66e5092969e32c89ce5c4a06c2bb8dc225
@@ -19,7 +19,7 @@ module Reality #nodoc
19
19
  # This method is called from a Rake or Buildr task to configure the Buildr
20
20
  # project so that it knows the location of all the generated artifacts and
21
21
  # adds them to the appropriate compile paths etc.
22
- def configure_buildr_project(buildr_project, generator_task, templates, target_dir)
22
+ def configure_buildr_project(buildr_project, generator_task, templates, target_dir, mark_as_generated_in_ide)
23
23
  if buildr_project.nil?
24
24
  task('clean') do
25
25
  rm_rf target_dir
@@ -37,7 +37,7 @@ module Reality #nodoc
37
37
  buildr_project.compile.using :javac
38
38
  buildr_project.compile.from main_java_dir
39
39
  # Need to force this as it may have already been cached and thus will not recalculate
40
- buildr_project.iml.main_generated_source_directories << main_java_dir if buildr_project.iml?
40
+ buildr_project.iml.main_generated_source_directories << main_java_dir if mark_as_generated_in_ide && buildr_project.iml?
41
41
  end
42
42
 
43
43
  # Is there resources generated in project?
@@ -56,7 +56,7 @@ module Reality #nodoc
56
56
  end
57
57
  end
58
58
  end
59
- buildr_project.iml.main_generated_resource_directories << main_resources_dir if buildr_project.iml?
59
+ buildr_project.iml.main_generated_resource_directories << main_resources_dir if mark_as_generated_in_ide && buildr_project.iml?
60
60
  end
61
61
 
62
62
  # Is there assets generated in project?
@@ -76,7 +76,7 @@ module Reality #nodoc
76
76
  end
77
77
  buildr_project.test.compile.from test_java_dir
78
78
  # Need to force this as it may have already been cached and thus will not recalculate
79
- buildr_project.iml.test_generated_source_directories << test_java_dir if buildr_project.iml?
79
+ buildr_project.iml.test_generated_source_directories << test_java_dir if mark_as_generated_in_ide && buildr_project.iml?
80
80
  end
81
81
 
82
82
  # Is there resources generated in project?
@@ -95,7 +95,7 @@ module Reality #nodoc
95
95
  end
96
96
  end
97
97
  end
98
- buildr_project.iml.test_generated_resource_directories << test_resources_dir if buildr_project.iml?
98
+ buildr_project.iml.test_generated_resource_directories << test_resources_dir if mark_as_generated_in_ide && buildr_project.iml?
99
99
  end
100
100
  end
101
101
  end
@@ -33,6 +33,7 @@ module Reality #nodoc
33
33
  element_key = options[:"#{root_element_type}_key"]
34
34
  target_dir = options[:target_dir]
35
35
  buildr_project = options[:buildr_project]
36
+ clean_generated_files = options[:clean_generated_files].nil? ? true : !!options[:clean_generated_files]
36
37
 
37
38
  if buildr_project.nil? && ::Buildr.application.current_scope.size > 0
38
39
  buildr_project = ::Buildr.project(::Buildr.application.current_scope.join(':')) rescue nil
@@ -46,7 +47,11 @@ module Reality #nodoc
46
47
  end
47
48
 
48
49
  if target_dir.nil? && !buildr_project.nil?
49
- target_dir = buildr_project._(:target, :generated, self.generated_type_path_prefix, build_key)
50
+ if clean_generated_files
51
+ target_dir = buildr_project._(:target, :generated, self.generated_type_path_prefix, build_key)
52
+ else
53
+ target_dir = buildr_project._(:srcgen, self.generated_type_path_prefix, build_key)
54
+ end
50
55
  elsif !target_dir.nil? && !buildr_project.nil?
51
56
  self.log_container.warn("#{self.name}.define_generate_task specifies a target directory parameter but it can be be derived from the context. The parameter should be removed.")
52
57
  end
@@ -55,6 +60,10 @@ module Reality #nodoc
55
60
  self.log_container.error("#{self.name}.define_generate_task should specify a target directory as it can not be derived from the context.")
56
61
  end
57
62
 
63
+ if clean_generated_files && buildr_project
64
+ buildr_project.clean { rm_rf target_dir }
65
+ end
66
+
58
67
  self.const_get(:GenerateTask).new(element_key, build_key, generator_keys, target_dir, buildr_project, &block)
59
68
  end
60
69
  end
@@ -65,6 +74,7 @@ module Reality #nodoc
65
74
  attr_accessor :namespace_key
66
75
  attr_accessor :filter
67
76
  attr_writer :verbose
77
+ attr_writer :mark_as_generated_in_ide
68
78
 
69
79
  attr_reader :root_element_key
70
80
  attr_reader :key
@@ -81,11 +91,12 @@ module Reality #nodoc
81
91
  @filter = nil
82
92
  # Turn on verbose messages if buildr is turned on tracing
83
93
  @verbose = trace?
94
+ @mark_as_generated_in_ide = true
84
95
  @target_dir = target_dir
85
96
  yield self if block_given?
86
97
  define
87
98
  @templates = self.template_set_container.generator.load_templates_from_template_sets(generator_keys)
88
- Reality::Generators::Buildr.configure_buildr_project(buildr_project, task_name, @templates, target_dir)
99
+ Reality::Generators::Buildr.configure_buildr_project(buildr_project, task_name, @templates, target_dir, mark_as_generated_in_ide?)
89
100
  end
90
101
 
91
102
  protected
@@ -140,6 +151,10 @@ module Reality #nodoc
140
151
 
141
152
  private
142
153
 
154
+ def mark_as_generated_in_ide?
155
+ !!@mark_as_generated_in_ide
156
+ end
157
+
143
158
  def verbose?
144
159
  !!@verbose
145
160
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{reality-generators}
5
- s.version = '1.16.0'
5
+ s.version = '1.18.0'
6
6
  s.platform = Gem::Platform::RUBY
7
7
 
8
8
  s.authors = ['Peter Donald']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reality-generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.0
4
+ version: 1.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Donald
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-19 00:00:00.000000000 Z
11
+ date: 2023-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reality-core