development

Xcode에서 기본 헤더 주석 라이센스 변경

big-blog 2020. 9. 24. 08:01
반응형

Xcode에서 기본 헤더 주석 라이센스 변경


Xcode에서 새 .cpp / .h 파일을 만들 때마다 파일 상단에 주석이 추가됩니다. 예를 들면 :

/*
 *  <file>.cpp
 *  <Name of project>
 *
 *  Created by <My name> on <Date>.
 *  Copyright <Year and company>. All rights reserved.
 *
 */

기본 댓글을 GPL / LGPL / 또는 다른 라이선스와 같은 다른 라이선스로 변경하고 싶습니다. Xcode에서이 동작을 변경할 수있는 곳이 있습니까?


/ Developer / Library / XCode / 파일 템플릿

SDK를 업데이트하면 여기에서 변경 사항이 삭제되므로 템플릿을 다른 곳에 백업 해 두십시오.


엑스 코드 (9) A는 아래의 세부 사항을 찾을 수있는 옵션이 내장있다.

  1. IDETemplateMacros.plist라는 속성 목록 파일을 만듭니다.
  2. FILEHEADER루트에 값을 추가하고 다음 과 같은 저작권 텍스트로 문자열 값을 설정합니다.Copyright © 2017 ...
  3. 다음 위치 중 하나에 파일을 복사합니다.
    • 단일 프로젝트 및 사용자 용 <ProjectName>.xcodeproj/xcuserdata/[username].xcuserdatad/IDETemplateMacros.plist
    • 단일 프로젝트의 모든 팀원 <ProjectName>.xcodeproj/xcshareddata/IDETemplateMacros.plist
    • 단일 사용자를위한 작업 공간의 모든 프로젝트 <WorkspaceName>.xcworkspace/xcuserdata/[username].xcuserdatad/IDETemplateMacros.plist
    • 모든 팀 구성원을위한 작업 공간의 모든 프로젝트 <WorkspaceName>.xcworkspace/xcshareddata/IDETemplateMacros.plist
    • 프로젝트에 관계없이 모든 작업에 ~/Library/Developer/Xcode/UserData/IDETemplateMacros.plist
  4. 새 저작권 헤더를 볼 수있는 새 파일을 만듭니다.

IDETemplateMacros.plist복사 및 붙여 넣기 샘플 :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>FILEHEADER</key>
    <string>
//  Created by Your Name on 29.12.17.
//  Copyright © 2017 Your Company. All rights reserved.
//  </string>
</dict>
</plist>

먼저 주소록 에서 이름과 조직의 연락처 카드를 변경해보십시오 .

그래도 작동하지 않으면 시스템 환경 설정 > 사용자 및 그룹을 열고 사용자를 마우스 오른쪽 버튼으로 클릭 (시스템 환경 설정이 이미 잠금 해제되어 있어야 함)> 고급 옵션 ...> 전체 이름 텍스트 상자 에서 이름 변경 .

Xcode에서 조직 이름을 변경하려면 프로젝트 파일을 클릭하여 선택합니다 (프로젝트 탐색기에서 Xcode의 왼쪽 사이드 바)> 파일 검사기 (Xcode의 오른쪽 사이드 바)에서 조직 텍스트 상자를 변경합니다 .

조직 텍스트 상자


이 블로그 게시물에는 Xcode 4.3에서 파일 템플릿을 수정하기위한 몇 가지 좋은 단계가 있습니다.

http://error-success.piku.org.uk/2012/04/27/how-to-make-xcode-4-3-2-templates/

/Developer당신에있는 Xcode.app 번들 내에서 템플릿을 복사 할 수 있도록 폴더가 더 이상 존재하지 않는다 /Applications:

/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File \ Templates /

그리고 이전과 같이 수정 된 사본을 여기에 배치합니다.

~ / Library / Developer / Xcode / Templates / File \ Templates /

UPDATE: I decided to write a script that would extract the built in Xcode templates and replace the headers. Source and instructions can be found at the following url:

https://github.com/royclarkson/xcode-templates


Don't edit anything in /Developer as Apple can overwrite this at any time.

The following works for Xcode 4, 5 and 6 except later source differs and is under /Applications

Instead copy the templates that you want to change from /Applications/Xcode<version>.app/Contents/Developer/Library/Xcode/Templates to ~/Library/Developer/Xcode/Templates/File Templates and then edit the files keeping the same directory structure but edit the directory name that is the template to not show up a a duplicate in Xcode.

e.g for a new category of C/C+ files in Xcode 5 copy /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates/C and C++ to ~/Library/Developer/Xcode/Templates/File Templates/GPL C and C++

this process is copied from Red Glasses's blog

For Xcode 4 the source path is or for Xcode 4 /Developer/Library/Xcode/Templates/File Templates


It's very simple:

  1. Open up terminal
  2. In one line, write the following:

    defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions -dict ORGANIZATIONNAME "Blah, Inc"
    

You don't have to worry about changing directories beforehand or anything else. It works instantly.


– Press ⌘ 1 to display the File Navigator.
– Click on the name of your project at the top of the File Navigator.
– Press ⌘⌥⇧ ⏎ (that's Command Option Shift Return) to view the Version Editor.
– Make sure that the Comparison View is shown(View > Version Editor > Show Comparison View).

This lets you see the raw text of your project's project.pbxproj file.

– Press ⌘ f to search the project.pbxproj file, paste in ORGANIZATIONNAME and press Return.

This is where the name of the organization that follows the copyright text is defined.


Change the details in your Address Book - add a company name. It will pick it up from there.


이 파일을 수정 해보십시오.

/Developer/Library/Xcode/File\ Templates/C\ and\ C++/Header\ File.pbfiletemplate/header.h

Xcode 4.2에서는 다음과 같습니다.

/Developer/Library/Xcode/Templates/File Templates

참고 URL : https://stackoverflow.com/questions/2381149/changing-the-default-header-comment-license-in-xcode

반응형