- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.4k
Templates #9211
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
          
     Draft
      
      
            johnbute
  wants to merge
  246
  commits into
  swiftlang:main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
johnbute:templates
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
                
     Draft
            
            Templates #9211
Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    …need to revisit in future
…ding product of type template works
…ing target of type template works
… and retuning the build result of the plugin delegate collections, will need to revisit in a future
…ests for this too
…avior as an executable
…avior as an executable pt2
…ert back to major, minor once demo completed
…re not shared outside that branch + improved dry-run output to print command line arguments
…o get clarity on handling of subcommands
…ored coordinator + plugin managers
| @swift-ci please test | 
| @swift-ci please test | 
…nction names for clarity, add test for compiling manifest file for templates, removed tests regarding building a template as they are already handled by E2E tests
| @swift-ci please test | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Motivation:
Currently, SwiftPM supports a handful of hardcoded templates that act as a starting point for user projects. These built-in templates, accessible via
swift package init, allow users to initialize basic packages such as libraries, tools, executables, and macros. Whileswift package initremains valuable for initializing simple packages, many Swift developers face more complex requirements when starting a new project, whether that may be initializing an HTTPS server or creating a package that implements an OpenAPI specification. These more complex package initializations have to be achieved through third-party command-line tools or custom scripts, many of which operate outside the SwiftPM ecosystem. This disconnect increases the complexity and makes it harder for users to discover, share, or customize initialization workflows.Modifications:
Modifying Package.swift to store template metadata, added template utilities, new init function that supports old workflow and new template workflow, test template function, prompting system. Added show-templates function.
Result:
Now, users can initialize packages based on templates from local disk, git, or registry. Furthermore, they can author templates and test them with test template. For more, read documentation.