// copyResources copies the required resources to the destination directory for the build. func (builder ScalaProjectBuilder) copyResources(verbose bool) error { if verbose { fmt.Println("----------") fmt.Println("Task: Copy resources.") fmt.Println("----------\n") } resourceCount := len(builder.project.Resources) if resourceCount == 0 { return nil } for i := 0; i < resourceCount; i++ { destinationDirectory := filepath.Dir(builder.project.Resources[i].Destination) utilities.EnsurePathExists(fmt.Sprintf("%s%s", builder.command.GetDestinationDirectory(), destinationDirectory)) utilities.CopyFile(fmt.Sprintf("%s%s", builder.command.DestinationDirectory, builder.project.Resources[i].Destination), fmt.Sprintf("%s%s", builder.command.SourceDirectory, builder.project.Resources[i].Source)) if verbose { fmt.Printf("Copying %s%s to %s%s", builder.command.SourceDirectory, builder.project.Resources[i].Source, builder.command.DestinationDirectory, builder.project.Resources[i].Destination) } } return nil }
// copyReferences copies the required reference files to the build destination // directory. func (builder CSharpProjectBuilder) copyReferences(verbose bool) error { if verbose { fmt.Println("----------") fmt.Println("Task: Copy references.") fmt.Println("----------\n") } referenceCount := len(builder.command.ReferencePaths) if referenceCount == 0 { return nil } destinationDirectory := builder.command.DestinationDirectory for i := 0; i < referenceCount; i++ { if builder.command.ReferencePaths[i].Path == "" { continue } path := builder.command.ReferencePaths[i].Path referenceName := builder.command.ReferencePaths[i].Name fileExtension := ".dll" utilities.CopyFile(fmt.Sprintf("%s%s%s", destinationDirectory, referenceName, fileExtension), fmt.Sprintf("%s%s%s", path, referenceName, fileExtension), ) if verbose { fmt.Printf("Copying %s%s%s to %s%s%s\n", path, referenceName, fileExtension, destinationDirectory, referenceName, fileExtension) } } return nil }