Module: Pindo::BuildSourceFilesGuard

Defined in:
lib/pindo/module/source_files_guard.rb

Overview

autobuild 会注入配置的固定源码清单。路径中的工程名、Target 名和 Module 名用 glob 匹配。

Constant Summary collapse

IOS_PATTERNS =
[
  'config.json',
  'Podfile.lock',
  '**/*.xcodeproj/project.pbxproj',
  '**/Info.plist',
  '**/*.entitlements',
  '**/AppIcon.appiconset',
  '**/iMessage App Icon.stickersiconset'
].freeze
ANDROID_PATTERNS =
[
  'build.gradle',
  'build.gradle.kts',
  'settings.gradle',
  'settings.gradle.kts',
  'google-services.json',
  '**/build.gradle',
  '**/build.gradle.kts',
  '**/google-services.json',
  '**/src/main/AndroidManifest.xml',
  '**/src/main/res'
].freeze
UNITY_PATTERNS =

Unity 工程判定即要求该文件存在(BuildHelper#unity_project?),故用精确路径而非 glob, 避免匹配到 Packages 下嵌入工程里的同名副本。

[
  'ProjectSettings/ProjectSettings.asset'
].freeze
EXCLUDED_PATH_COMPONENTS =
%w[
  .git
  .gradle
  .build
  Pods
  build
  DerivedData
  GoodPlatform
].freeze

Class Method Summary collapse

Class Method Details

.android(project_path) ⇒ Object



61
62
63
# File 'lib/pindo/module/source_files_guard.rb', line 61

def android(project_path)
  source_paths(project_path, ANDROID_PATTERNS)
end

.for_project(project_path) ⇒ Object



46
47
48
49
50
51
52
53
54
55
# File 'lib/pindo/module/source_files_guard.rb', line 46

def for_project(project_path)
  case Pindo::BuildHelper.share_instance.project_type(project_path)
  when :ios
    ios(project_path)
  when :android
    android(project_path)
  else
    unity(project_path)
  end
end

.ios(project_path) ⇒ Object



57
58
59
# File 'lib/pindo/module/source_files_guard.rb', line 57

def ios(project_path)
  source_paths(project_path, IOS_PATTERNS)
end

.unity(project_path) ⇒ Object

导出的平台工程落在已忽略的 GoodPlatform 里,不需要提交。 但 ProjectSettings.asset 是 Unity 源码配置,构建期间会被 Unity 写入 (版本号、编译宏等),性质与 iOS 的 project.pbxproj / Info.plist 相同, 不提交就会在构建后残留为未提交改动,且 tag 上拿不到构建实际用的配置。



69
70
71
# File 'lib/pindo/module/source_files_guard.rb', line 69

def unity(project_path)
  source_paths(project_path, UNITY_PATTERNS)
end