[change] Installer使用tag而不是commit id,安装时不必拉取整个branch,大幅缩短安装时间

[change] 升级hybridclr和il2cpp_plus版本
main v2.0.5
walon 2023-02-22 10:43:30 +08:00
parent 15f2f0b83c
commit a9ca9fc613
4 changed files with 21 additions and 22 deletions

View File

@ -2,18 +2,18 @@
"versions": [ "versions": [
{ {
"unity_version":"2019", "unity_version":"2019",
"hybridclr" : { "branch":"main", "hash":"531f98365eebce5d1390175be2b41c41e217d918"}, "hybridclr" : { "branch":"v2.0.1"},
"il2cpp_plus": { "branch":"2019-main", "hash":"ebe5190b0404d1857832bd1d52ebec7c3730a01d"} "il2cpp_plus": { "branch":"v2019-2.0.1"}
}, },
{ {
"unity_version":"2020", "unity_version":"2020",
"hybridclr" : { "branch":"main", "hash":"531f98365eebce5d1390175be2b41c41e217d918"}, "hybridclr" : { "branch":"v2.0.1"},
"il2cpp_plus": { "branch":"2020-main", "hash":"c6cf54285381d0b03a58126e0d39b6e4d11937b7"} "il2cpp_plus": { "branch":"v2020-2.0.1"}
}, },
{ {
"unity_version":"2021", "unity_version":"2021",
"hybridclr" : { "branch":"main", "hash":"531f98365eebce5d1390175be2b41c41e217d918"}, "hybridclr" : { "branch":"v2.0.1"},
"il2cpp_plus": { "branch":"2021-main", "hash":"99cd1cbbfc1f637460379e81c9a7776cd3e662ad"} "il2cpp_plus": { "branch":"v2021-2.0.1"}
} }
] ]
} }

View File

@ -54,7 +54,7 @@ namespace HybridCLR.Editor.Installer
{ {
public string branch; public string branch;
public string hash; //public string hash;
} }
[Serializable] [Serializable]
@ -156,9 +156,9 @@ namespace HybridCLR.Editor.Installer
} }
} }
public string HybridclrLocalVersion => _curDefaultVersion.hybridclr.hash; public string HybridclrLocalVersion => _curDefaultVersion.hybridclr.branch;
public string Il2cppPlusLocalVersion => _curDefaultVersion.il2cpp_plus.hash; public string Il2cppPlusLocalVersion => _curDefaultVersion.il2cpp_plus.branch;
private string GetIl2CppPathByContentPath(string contentPath) private string GetIl2CppPathByContentPath(string contentPath)
@ -169,12 +169,7 @@ namespace HybridCLR.Editor.Installer
public void InstallDefaultHybridCLR() public void InstallDefaultHybridCLR()
{ {
InstallLocalHybridCLR(HybridclrLocalVersion, Il2cppPlusLocalVersion); RunInitLocalIl2CppData(GetIl2CppPathByContentPath(EditorApplication.applicationContentsPath), _curVersion);
}
public void InstallLocalHybridCLR(string hybridclrVer, string il2cppPlusVer)
{
RunInitLocalIl2CppData(GetIl2CppPathByContentPath(EditorApplication.applicationContentsPath), _curVersion, hybridclrVer, il2cppPlusVer);
} }
public bool HasInstalledHybridCLR() public bool HasInstalledHybridCLR()
@ -201,14 +196,13 @@ namespace HybridCLR.Editor.Installer
#endif #endif
} }
void CloneSpeicificCommitId(string workDir, string repoUrl, string branch, string repoDir, string commitId) void CloneBranch(string workDir, string repoUrl, string branch, string repoDir)
{ {
BashUtil.RemoveDir(repoDir); BashUtil.RemoveDir(repoDir);
BashUtil.RunCommand(workDir, "git", new string[] {"clone", "-b", branch, repoUrl, repoDir}); BashUtil.RunCommand(workDir, "git", new string[] {"clone", "-b", branch, "--depth", "1", repoUrl, repoDir});
BashUtil.RunCommand($"{repoDir}", "git", new string[] { "checkout", commitId });
} }
private void RunInitLocalIl2CppData(string editorIl2cppPath, UnityVersion version, string hybridclrVer, string il2cppPlusVer) private void RunInitLocalIl2CppData(string editorIl2cppPath, UnityVersion version)
{ {
if (!IsComaptibleVersion()) if (!IsComaptibleVersion())
{ {
@ -226,12 +220,12 @@ namespace HybridCLR.Editor.Installer
// clone hybridclr // clone hybridclr
string hybridclrRepoURL = HybridCLRSettings.Instance.hybridclrRepoURL; string hybridclrRepoURL = HybridCLRSettings.Instance.hybridclrRepoURL;
string hybridclrRepoDir = $"{workDir}/{hybridclr_repo_path}"; string hybridclrRepoDir = $"{workDir}/{hybridclr_repo_path}";
CloneSpeicificCommitId(workDir, hybridclrRepoURL, _curDefaultVersion.hybridclr.branch, hybridclrRepoDir, hybridclrVer); CloneBranch(workDir, hybridclrRepoURL, _curDefaultVersion.hybridclr.branch, hybridclrRepoDir);
// clone il2cpp_plus // clone il2cpp_plus
string il2cppPlusRepoURL = HybridCLRSettings.Instance.il2cppPlusRepoURL; string il2cppPlusRepoURL = HybridCLRSettings.Instance.il2cppPlusRepoURL;
string il2cppPlusRepoDir = $"{workDir}/{il2cpp_plus_repo_path}"; string il2cppPlusRepoDir = $"{workDir}/{il2cpp_plus_repo_path}";
CloneSpeicificCommitId(workDir, il2cppPlusRepoURL, _curDefaultVersion.il2cpp_plus.branch, il2cppPlusRepoDir, il2cppPlusVer); CloneBranch(workDir, il2cppPlusRepoURL, _curDefaultVersion.il2cpp_plus.branch, il2cppPlusRepoDir);
// create LocalIl2Cpp // create LocalIl2Cpp
string localUnityDataDir = SettingsUtil.LocalUnityDataDir; string localUnityDataDir = SettingsUtil.LocalUnityDataDir;

View File

@ -1,4 +1,9 @@
# hybridclr_unity # hybridclr_unity
Unity Package for HybridCLR Unity Package for HybridCLR
## 改动日志
- v2.0.5 Installer使用tag而不是commit id安装时不必拉取整个branch大幅缩短安装时间

View File

@ -1,6 +1,6 @@
{ {
"name": "com.focus-creative-games.hybridclr_unity", "name": "com.focus-creative-games.hybridclr_unity",
"version": "2.0.4", "version": "2.0.5",
"displayName": "HybridCLR", "displayName": "HybridCLR",
"description": "Unity package for HybridCLR. It includes editor and runtime scripts and assets for HybridCLR", "description": "Unity package for HybridCLR. It includes editor and runtime scripts and assets for HybridCLR",
"category": "Runtime", "category": "Runtime",