Skip to content

Commit

Permalink
Merge pull request #741 from openstudiocoalition/633_ShortStyleCopyright
Browse files Browse the repository at this point in the history
Fix #633 - Apply short style copyright and hopefully for the last time
  • Loading branch information
jmarrec authored Sep 4, 2024
2 parents 2277fd5 + 074738c commit 58ecf75
Show file tree
Hide file tree
Showing 582 changed files with 1,202 additions and 15,082 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -280,3 +280,6 @@ c25573f81282ad7aa0eb72ac24e31c57308cb038

# [chore] Bump copyright to 2023 + about box [Julien Marrec, 2023-03-30]
917bcb5e6576379fe6babb44f46a7f964ef581c6

# [chore] Apply short-style copyright, hopefully for the last time [Julien Marrec, 2024-09-04]
c8c0ff69b8d8e96661d2e5f7384816c09ab3d5ad
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ set(QT_INSTALL_DIR "" CACHE PATH "Path to Qt Install")
set(QT_VERSION "6.5.2" CACHE STRING "Qt target version, defaults to 6.5.2")

# For AboutBox, but also validates that the version is valid
string(TIMESTAMP CURRENT_YEAR "%Y")
string(REGEX MATCH "^([0-9]+\\.[0-9]+)"
QT_VERSION_MAJOR_MINOR ${QT_VERSION})
if(NOT QT_VERSION_MAJOR_MINOR)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OpenStudio(R), Copyright (c) 2020-2023, OpenStudio Coalition and other contributors. All rights reserved.
OpenStudio(R), Copyright (c) 2020-2024, OpenStudio Coalition and other contributors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
Expand Down
134 changes: 40 additions & 94 deletions developer/ruby/ApplyCopyright.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,140 +3,86 @@
# Inputs:
# ARGV[0] - path to top level cmake source directory (one level above 'src' directory)

require 'pathname'
require 'rubygems'
require 'fileutils'
require 'pathname'

include FileUtils

# check that called from command line directly
if not ($0 == __FILE__)
puts "#{__FILE__} called from external script"
exit
end
ROOT_DIR = Pathname.new(__dir__).parent.parent

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

copyright = "/***********************************************************************************************************************\n"
ruby_copyright = "########################################################################################################################\n"
File.open(basepath + "/LICENSE.md") do |file|
while (line = file.gets)
if line.strip.empty?
copyright += "*" + line
ruby_copyright += "#" + line

else
copyright += "* " + line
ruby_copyright += "# " + line
end
license_lines.each do |line|
if line.strip.empty?
copyright += '*' + line
ruby_copyright += '#' + line

else
copyright += '* ' + line
ruby_copyright += '# ' + line
end
end
copyright += "***********************************************************************************************************************/\n\n"
ruby_copyright += "########################################################################################################################\n\n"

# first do c++

# exceptions are files that are not part of OpenStudio
exceptions = [basepath + "/src/qtwinmigrate/",
"mainpage.hpp"]
# exclusions are files that are not part of OpenStudio
folder_exclusions = [
ROOT_DIR / 'src/qtwinmigrate',
]
filename_exclusions = [
'mainpage.hpp',
]

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

# reject exceptions
files.reject! do |p|
result = false
exceptions.each do |e|
if p.include?(e)
result = true
puts p
break
end
end
result
filename_exclusions.any? { |fname| p.basename.to_s == fname } ||
p.ascend { |path| break true if folder_exclusions.any? { |p2| path == p2 } }
end

# loop over all files
files.each do |p|

# start with copyright
text = copyright

# read file
File.open(p, "r") do |file|
# read until end of current copyright
while (line = file.gets)
if not /^\s?[\/\*]/.match(line)
if not line.chomp.empty?
text += line
end
break
end
end

# now keep rest of file
while (line = file.gets)
text += line
end
end
# Read lines and remove copyright
lines = p.readlines
lines.shift(lines.find_index { |line| !(line.chomp.empty? || %r{^\s?[/*]}.match(line)) })

# write file
File.open(p, "w") do |file|
file << text
end

p.write(copyright + lines.join)
end

# now do ruby

# exceptions are files that are not part of OpenStudio
exceptions = []
folder_exclusions = []
filename_exclusions = []

# glob for rb
files = Dir.glob(basepath + "/ruby/**/*.rb")
files = ROOT_DIR.glob('ruby/**/*.rb')

# reject exceptions
files.reject! do |p|
result = false
exceptions.each do |e|
if p.include?(e)
result = true
break
end
end
result
filename_exclusions.any? { |fname| p.basename.to_s == fname } ||
p.ascend { |path| break true if folder_exclusions.any? { |p2| path == p2 } }
end

# loop over all files
files.each do |p|

# start with copyright
text = ruby_copyright

# read file
File.open(p, "r") do |file|
# read until end of current copyright
while (line = file.gets)
if not /^#/.match(line)
if not line.chomp.empty?
text += line
end
break
end
end

# now keep rest of file
while (line = file.gets)
text += line
end
end
# Read lines and remove copyright
lines = p.readlines
lines.shift(lines.find_index { |line| !(line.chomp.empty? || /^#/.match(line)) })

# write file
File.open(p, "w") do |file|
file << text
end

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

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

# add binary dir to system path
original_path = ENV['PATH']
original_path = ENV['PATH'] # add binary dir to system path
original_dll_directory = nil
platform_specific_path = nil

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

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

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

require 'openstudio'
Expand Down
Loading

0 comments on commit 58ecf75

Please sign in to comment.