Skip to content

Commit 58ecf75

Browse files
authored
Merge pull request #741 from openstudiocoalition/633_ShortStyleCopyright
Fix #633 - Apply short style copyright and hopefully for the last time
2 parents 2277fd5 + 074738c commit 58ecf75

File tree

582 files changed

+1202
-15082
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

582 files changed

+1202
-15082
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,3 +280,6 @@ c25573f81282ad7aa0eb72ac24e31c57308cb038
280280

281281
# [chore] Bump copyright to 2023 + about box [Julien Marrec, 2023-03-30]
282282
917bcb5e6576379fe6babb44f46a7f964ef581c6
283+
284+
# [chore] Apply short-style copyright, hopefully for the last time [Julien Marrec, 2024-09-04]
285+
c8c0ff69b8d8e96661d2e5f7384816c09ab3d5ad

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ set(QT_INSTALL_DIR "" CACHE PATH "Path to Qt Install")
524524
set(QT_VERSION "6.5.2" CACHE STRING "Qt target version, defaults to 6.5.2")
525525

526526
# For AboutBox, but also validates that the version is valid
527+
string(TIMESTAMP CURRENT_YEAR "%Y")
527528
string(REGEX MATCH "^([0-9]+\\.[0-9]+)"
528529
QT_VERSION_MAJOR_MINOR ${QT_VERSION})
529530
if(NOT QT_VERSION_MAJOR_MINOR)

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
OpenStudio(R), Copyright (c) 2020-2023, OpenStudio Coalition and other contributors. All rights reserved.
1+
OpenStudio(R), Copyright (c) 2020-2024, OpenStudio Coalition and other contributors. All rights reserved.
22

33
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
44
following conditions are met:

developer/ruby/ApplyCopyright.rb

Lines changed: 40 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -3,140 +3,86 @@
33
# Inputs:
44
# ARGV[0] - path to top level cmake source directory (one level above 'src' directory)
55

6-
require 'pathname'
7-
require 'rubygems'
86
require 'fileutils'
7+
require 'pathname'
98

109
include FileUtils
1110

12-
# check that called from command line directly
13-
if not ($0 == __FILE__)
14-
puts "#{__FILE__} called from external script"
15-
exit
16-
end
11+
ROOT_DIR = Pathname.new(__dir__).parent.parent
1712

18-
basepath = ARGV[0].gsub("\\", "/")
13+
license_lines = [
14+
"OpenStudio(R), Copyright (c) OpenStudio Coalition and other contributors.\n",
15+
"See also https://openstudiocoalition.org/about/software_license/\n",
16+
]
1917

2018
copyright = "/***********************************************************************************************************************\n"
2119
ruby_copyright = "########################################################################################################################\n"
22-
File.open(basepath + "/LICENSE.md") do |file|
23-
while (line = file.gets)
24-
if line.strip.empty?
25-
copyright += "*" + line
26-
ruby_copyright += "#" + line
27-
28-
else
29-
copyright += "* " + line
30-
ruby_copyright += "# " + line
31-
end
20+
license_lines.each do |line|
21+
if line.strip.empty?
22+
copyright += '*' + line
23+
ruby_copyright += '#' + line
24+
25+
else
26+
copyright += '* ' + line
27+
ruby_copyright += '# ' + line
3228
end
3329
end
3430
copyright += "***********************************************************************************************************************/\n\n"
3531
ruby_copyright += "########################################################################################################################\n\n"
3632

3733
# first do c++
3834

39-
# exceptions are files that are not part of OpenStudio
40-
exceptions = [basepath + "/src/qtwinmigrate/",
41-
"mainpage.hpp"]
35+
# exclusions are files that are not part of OpenStudio
36+
folder_exclusions = [
37+
ROOT_DIR / 'src/qtwinmigrate',
38+
]
39+
filename_exclusions = [
40+
'mainpage.hpp',
41+
]
4242

4343
# glob for hpp and cpp
44-
files = Dir.glob(basepath + "/src/**/*.[ch]pp")
45-
files.concat Dir.glob(basepath + "/ruby/**/*.[ch]pp")
46-
files.concat Dir.glob(basepath + "/src/**/*.cxx.in")
47-
files.concat Dir.glob(basepath + "/src/**/*.tmp")
44+
files = ROOT_DIR.glob('src/**/*.[ch]pp')
45+
files += ROOT_DIR.glob('ruby/**/*.[ch]pp')
46+
files += ROOT_DIR.glob('src/**/*.[ch]xx.in')
47+
files += ROOT_DIR.glob('src/**/*.tmp')
4848

4949
# reject exceptions
5050
files.reject! do |p|
51-
result = false
52-
exceptions.each do |e|
53-
if p.include?(e)
54-
result = true
55-
puts p
56-
break
57-
end
58-
end
59-
result
51+
filename_exclusions.any? { |fname| p.basename.to_s == fname } ||
52+
p.ascend { |path| break true if folder_exclusions.any? { |p2| path == p2 } }
6053
end
6154

6255
# loop over all files
6356
files.each do |p|
64-
65-
# start with copyright
66-
text = copyright
67-
68-
# read file
69-
File.open(p, "r") do |file|
70-
# read until end of current copyright
71-
while (line = file.gets)
72-
if not /^\s?[\/\*]/.match(line)
73-
if not line.chomp.empty?
74-
text += line
75-
end
76-
break
77-
end
78-
end
79-
80-
# now keep rest of file
81-
while (line = file.gets)
82-
text += line
83-
end
84-
end
57+
# Read lines and remove copyright
58+
lines = p.readlines
59+
lines.shift(lines.find_index { |line| !(line.chomp.empty? || %r{^\s?[/*]}.match(line)) })
8560

8661
# write file
87-
File.open(p, "w") do |file|
88-
file << text
89-
end
90-
62+
p.write(copyright + lines.join)
9163
end
9264

9365
# now do ruby
9466

9567
# exceptions are files that are not part of OpenStudio
96-
exceptions = []
68+
folder_exclusions = []
69+
filename_exclusions = []
9770

9871
# glob for rb
99-
files = Dir.glob(basepath + "/ruby/**/*.rb")
72+
files = ROOT_DIR.glob('ruby/**/*.rb')
10073

10174
# reject exceptions
10275
files.reject! do |p|
103-
result = false
104-
exceptions.each do |e|
105-
if p.include?(e)
106-
result = true
107-
break
108-
end
109-
end
110-
result
76+
filename_exclusions.any? { |fname| p.basename.to_s == fname } ||
77+
p.ascend { |path| break true if folder_exclusions.any? { |p2| path == p2 } }
11178
end
11279

11380
# loop over all files
11481
files.each do |p|
115-
116-
# start with copyright
117-
text = ruby_copyright
118-
119-
# read file
120-
File.open(p, "r") do |file|
121-
# read until end of current copyright
122-
while (line = file.gets)
123-
if not /^#/.match(line)
124-
if not line.chomp.empty?
125-
text += line
126-
end
127-
break
128-
end
129-
end
130-
131-
# now keep rest of file
132-
while (line = file.gets)
133-
text += line
134-
end
135-
end
82+
# Read lines and remove copyright
83+
lines = p.readlines
84+
lines.shift(lines.find_index { |line| !(line.chomp.empty? || /^#/.match(line)) })
13685

13786
# write file
138-
File.open(p, "w") do |file|
139-
file << text
140-
end
141-
87+
p.write(ruby_copyright + lines.join)
14288
end

ruby/RubyAPI.hpp

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,6 @@
11
/***********************************************************************************************************************
2-
* OpenStudio(R), Copyright (c) 2020-2023, OpenStudio Coalition and other contributors. All rights reserved.
3-
*
4-
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
5-
* following conditions are met:
6-
*
7-
* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following
8-
* disclaimer.
9-
*
10-
* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
11-
* disclaimer in the documentation and/or other materials provided with the distribution.
12-
*
13-
* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products
14-
* derived from this software without specific prior written permission from the respective party.
15-
*
16-
* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works
17-
* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior
18-
* written permission from Alliance for Sustainable Energy, LLC.
19-
*
20-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
21-
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED
23-
* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24-
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25-
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26-
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27-
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2+
* OpenStudio(R), Copyright (c) OpenStudio Coalition and other contributors.
3+
* See also https://openstudiocoalition.org/about/software_license/
284
***********************************************************************************************************************/
295

306
#ifndef RUBYAPI_HPP

ruby/openstudio_modeleditor.rb

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,9 @@
11
########################################################################################################################
2-
# OpenStudio(R), Copyright (c) 2020-2023, OpenStudio Coalition and other contributors. All rights reserved.
3-
#
4-
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
5-
# following conditions are met:
6-
#
7-
# (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following
8-
# disclaimer.
9-
#
10-
# (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
11-
# disclaimer in the documentation and/or other materials provided with the distribution.
12-
#
13-
# (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products
14-
# derived from this software without specific prior written permission from the respective party.
15-
#
16-
# (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works
17-
# may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior
18-
# written permission from Alliance for Sustainable Energy, LLC.
19-
#
20-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
21-
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED
23-
# STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24-
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25-
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26-
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27-
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2+
# OpenStudio(R), Copyright (c) OpenStudio Coalition and other contributors.
3+
# See also https://openstudiocoalition.org/about/software_license/
284
########################################################################################################################
295

30-
# add binary dir to system path
31-
original_path = ENV['PATH']
6+
original_path = ENV['PATH'] # add binary dir to system path
327
original_dll_directory = nil
338
platform_specific_path = nil
349

ruby/openstudio_modeleditor_rb.cpp

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,6 @@
11
/***********************************************************************************************************************
2-
* OpenStudio(R), Copyright (c) 2020-2023, OpenStudio Coalition and other contributors. All rights reserved.
3-
*
4-
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
5-
* following conditions are met:
6-
*
7-
* (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following
8-
* disclaimer.
9-
*
10-
* (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
11-
* disclaimer in the documentation and/or other materials provided with the distribution.
12-
*
13-
* (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products
14-
* derived from this software without specific prior written permission from the respective party.
15-
*
16-
* (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works
17-
* may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior
18-
* written permission from Alliance for Sustainable Energy, LLC.
19-
*
20-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
21-
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED
23-
* STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24-
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25-
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26-
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27-
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2+
* OpenStudio(R), Copyright (c) OpenStudio Coalition and other contributors.
3+
* See also https://openstudiocoalition.org/about/software_license/
284
***********************************************************************************************************************/
295

306
#include <RubyAPI.hpp>

ruby/test/PathWatcher_Test.rb

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,6 @@
11
########################################################################################################################
2-
# OpenStudio(R), Copyright (c) 2020-2023, OpenStudio Coalition and other contributors. All rights reserved.
3-
#
4-
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
5-
# following conditions are met:
6-
#
7-
# (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following
8-
# disclaimer.
9-
#
10-
# (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
11-
# disclaimer in the documentation and/or other materials provided with the distribution.
12-
#
13-
# (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products
14-
# derived from this software without specific prior written permission from the respective party.
15-
#
16-
# (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works
17-
# may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior
18-
# written permission from Alliance for Sustainable Energy, LLC.
19-
#
20-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
21-
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED
23-
# STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24-
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25-
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26-
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27-
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2+
# OpenStudio(R), Copyright (c) OpenStudio Coalition and other contributors.
3+
# See also https://openstudiocoalition.org/about/software_license/
284
########################################################################################################################
295

306
require 'openstudio'

ruby/test/WorkspaceWatcher_Test.rb

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,6 @@
11
########################################################################################################################
2-
# OpenStudio(R), Copyright (c) 2020-2023, OpenStudio Coalition and other contributors. All rights reserved.
3-
#
4-
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
5-
# following conditions are met:
6-
#
7-
# (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following
8-
# disclaimer.
9-
#
10-
# (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
11-
# disclaimer in the documentation and/or other materials provided with the distribution.
12-
#
13-
# (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products
14-
# derived from this software without specific prior written permission from the respective party.
15-
#
16-
# (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works
17-
# may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior
18-
# written permission from Alliance for Sustainable Energy, LLC.
19-
#
20-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
21-
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED
23-
# STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24-
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25-
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26-
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27-
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2+
# OpenStudio(R), Copyright (c) OpenStudio Coalition and other contributors.
3+
# See also https://openstudiocoalition.org/about/software_license/
284
########################################################################################################################
295

306
require 'openstudio'

0 commit comments

Comments
 (0)