Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheme file format mismatch #214

Closed
ilyapuchka opened this issue Jan 11, 2018 · 1 comment
Closed

Scheme file format mismatch #214

ilyapuchka opened this issue Jan 11, 2018 · 1 comment

Comments

@ilyapuchka
Copy link
Contributor

ilyapuchka commented Jan 11, 2018

What 🌱

Xcode stores project schemes in a format that is different to format used by xcproj, more specifically it adds new lines when xcproj does not, order of actions is different, it adds empty blocks when xcproj does not. That leads to files content being completely overridden when changes are made either by Xcode or xcproj or even when the project is saved by xcproj without any chnages in schemes.

The same seems to happen with all other xml files, like workspace data.

Example.
Xcode generated scheme:

<?xml version="1.0" encoding="UTF-8"?>
<Scheme
   LastUpgradeVersion = "0910"
   version = "1.3">
   <BuildAction
      parallelizeBuildables = "YES"
      buildImplicitDependencies = "YES">
      <BuildActionEntries>
         <BuildActionEntry
            buildForTesting = "YES"
            buildForRunning = "YES"
            buildForProfiling = "YES"
            buildForArchiving = "YES"
            buildForAnalyzing = "YES">
            <BuildableReference
               BuildableIdentifier = "primary"
               BlueprintIdentifier = "64E201A21EAE8FBF00EAD8A2"
               BuildableName = "SourceryRuntime.framework"
               BlueprintName = "SourceryRuntime"
               ReferencedContainer = "container:Sourcery.xcodeproj">
            </BuildableReference>
         </BuildActionEntry>
      </BuildActionEntries>
   </BuildAction>
   <TestAction
      buildConfiguration = "Debug"
      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
      language = ""
      shouldUseLaunchSchemeArgsEnv = "YES"
      codeCoverageEnabled = "YES">
      <Testables>
      </Testables>
      <AdditionalOptions>
      </AdditionalOptions>
   </TestAction>
   <LaunchAction
      buildConfiguration = "Debug"
      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
      language = ""
      launchStyle = "0"
      useCustomWorkingDirectory = "NO"
      ignoresPersistentStateOnLaunch = "NO"
      debugDocumentVersioning = "YES"
      debugServiceExtension = "internal"
      allowLocationSimulation = "YES">
      <MacroExpansion>
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "64E201A21EAE8FBF00EAD8A2"
            BuildableName = "SourceryRuntime.framework"
            BlueprintName = "SourceryRuntime"
            ReferencedContainer = "container:Sourcery.xcodeproj">
         </BuildableReference>
      </MacroExpansion>
      <AdditionalOptions>
      </AdditionalOptions>
   </LaunchAction>
   <ProfileAction
      buildConfiguration = "Release"
      shouldUseLaunchSchemeArgsEnv = "YES"
      savedToolIdentifier = ""
      useCustomWorkingDirectory = "NO"
      debugDocumentVersioning = "YES">
   </ProfileAction>
   <AnalyzeAction
      buildConfiguration = "Debug">
   </AnalyzeAction>
   <ArchiveAction
      buildConfiguration = "Release"
      revealArchiveInOrganizer = "YES">
   </ArchiveAction>
</Scheme>

xcrpoj generated scheme

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Scheme LastUpgradeVersion="0910" version="1.3">
	<AnalyzeAction buildConfiguration="Debug" />
	<ArchiveAction buildConfiguration="Release" revealArchiveInOrganizer="YES" />
	<TestAction selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" codeCoverageEnabled="YES" shouldUseLaunchSchemeArgsEnv="YES" buildConfiguration="Debug">
		<Testables />
	</TestAction>
	<ProfileAction savedToolIdentifier="" useCustomWorkingDirectory="NO" shouldUseLaunchSchemeArgsEnv="YES" buildConfiguration="Release" debugDocumentVersioning="YES" />
	<BuildAction parallelizeBuildables="YES" buildImplicitDependencies="YES">
		<BuildActionEntries>
			<BuildActionEntry buildForArchiving="YES" buildForTesting="YES" buildForRunning="YES" buildForProfiling="YES" buildForAnalyzing="YES">
				<BuildableReference BlueprintIdentifier="64E201A21EAE8FBF00EAD8A2" ReferencedContainer="container:Sourcery.xcodeproj" BuildableName="SourceryRuntime.framework" BlueprintName="SourceryRuntime" BuildableIdentifier="primary" />
			</BuildActionEntry>
		</BuildActionEntries>
	</BuildAction>
	<LaunchAction selectedDebuggerIdentifier="Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier="Xcode.DebuggerFoundation.Launcher.LLDB" launchStyle="0" buildConfiguration="Debug" debugServiceExtension="internal" ignoresPersistentStateOnLaunch="NO" useCustomWorkingDirectory="NO" allowLocationSimulation="YES" debugDocumentVersioning="YES" />
</Scheme>

Proposal 🎉

Option 1. xcproj should match Xcode format to avoid unneeded changes. This may break on each Xcode update
Option 2. still override all the content of the file, but only when changes are made. This will be at least something, but still will have unneeded side effects when xcproj is used as helper by another tool, i.e. Sourcery

@welcome
Copy link

welcome bot commented Jan 11, 2018

Thanks for opening your first issue here! Be sure to follow the issue template!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant