コンテンツ
説明
※あとで文言を考える
Perforce Helix Core 2019.1ではHelix Core Extension(p4 extensionコマンド)が追加されました。
Helix Core Extensionを使用することにより、自社で作成したスクリプトを簡単に管理することができます。
また、使用可能なスクリプト言語はlua言語のみのため、プラットフォームへの移植性が高くなりました
Perforeサーバへ展開することにより、サーバの動作を拡張することができます。
これにより、作成したスクリプトが実行環境に依存することがなくなります。
また、
注意
Helix Core ExtensionはWindows Serverでは使用できません。
利用手順
例として、Perforce Workshopで公開されている”narrow_workspace_mappings”というサンプルを使用します。
その他の設定は以下の通りです
ルートディレクトリ:/master
サーバエクステンション用ディレクトリ:/master/narrow_workspace_mappings
1.サーバエクステンションのスケルトン作成
"/master/narrow_workspace_mappings" に移動し、スケルトンを作成します
p4 extension --sample narrow_workspace_mappings
Extension template created in the 'narrow_workspace_mappings' directory.
※"main.lua"、"manifest.json"の2ファイルが作成されます。
2."narrow_workspace_mappings"のダウンロード
ダウンロードサイトより"narrow_workspace_mappings"の"main.lua"を入手し
/master/narrow_workspace_mappingsディレクトリ内のファイルを置き換えます
※本項は例題として"narrow_workspace_mappings"を使用するための手順です。実運用の際は不要です
3.main.luaの編集
main.luaファイルを編集してロジックを追加します。
4.".p4-extension"ファイルの作成
クライアントで".p4-extension"ファイルを作成します。
5.サーバエクステンションのインストール(確認)
作成したサーバエクステンションをHelixサーバに実際にインストールする前にプレビューを確認します。
p4 extension --install narrow_workspace_mappings.p4-extension
Would install Extension 'ExampleInc::narrow_workspace_mappings'
⋮
Version: '2019.1'
UUID: 22BB3349-4AD5-8617-203B-575747XXXXXX
Developer: Perforce Software Inc.
Description: [Example Extension, sample code] Restrict client views to have a configurable minimum
directory depth. This is to prevent user from
having a wide open workspace leading to getting unecessary files.
E.g. reject a mapping of //depot/... and allow //depot/some/more/narrow/path/...
License: BSD
Homepage URL: https://swarm.workshop.perforce.com/files/guest/perforce_software/extensions/2019-1
Compatible products: p4d
⋮
This was report mode. Use -y to perform the operation.
6.サーバエクステンションのインストール(実行)
実行結果が確認できたら"-y"オプションを追加し、インストールを実行します。
p4 extension --install narrow_workspace_mappings.p4-extension -y
Extension 'ExampleInc::narrow_workspace_mappings' version '2019.1' installed successfully.
7.インストールされているサーバエクステンションの確認
p4 extension --list –type=extensions
... extension ExampleInc::narrow_workspace_mappings
... rev 1
... developer Perforce Software Inc.
... description-snippet [Example Extension,
... UUID 22BB3349-4AD5-8617-203B-575747XXXXXX
... version 2019.1
... enabled false
... arch-dir server.extensions.dir/22BB3349-4AD5-8617-203B-575747XXXXXX/1-arch
... data-dir server.extensions.dir/22BB3349-4AD5-8617-203B-575747XXXXXX/1-data
8.サーバエクステンション構成のグローバル設定
インストールしたサーバエクステンションのグローバル設定を変更します。
p4 extension --configure ExampleInc::narrow_workspace_mappings
⋮
ExtP4USER: super ●"sampleExtensionsUser"から変更
⋮
9.サーバエクステンション構成のインスタンス設定
インストールしたサーバエクステンションのインスタンス設定を変更します。
p4 extension --configure ExampleInc::narrow_workspace_mappings --name extCfg
⋮
ExtConfig:
exempt_users:
super ●"Space-separated list of which users do NOT have this restriction"を修正
num_level:
3 ●"insert minimum number of level across all"を修正
⋮
10.インストールしたサーバエクステンションの動作確認