This repository has been archived by the owner on Dec 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pods and workspace support (#63)
Description =========== This patch adds a new task `podInstall` to the plugin which is a dependend task for `xcodeArchive`. It only executes when a `Podfile` is in the project directory. The `xcodeArchive` task has a new workspace property which is set by default to the workspace generated by podInstall. The workspace has a higher precedance than the project. If the workspace does not exist the task falls back to the project. The issue is the very nature how cocoapods handles workspaces. You can configure pods to use a preexisting workspace or it generates a new workspace based on the project it finds in the same directory. The current patch only tries to solve a current workflow issue and needs changes and tests! Changes ======= * ![ADD] `pods` and `workspace` support
- Loading branch information
Showing
5 changed files
with
88 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
53 changes: 53 additions & 0 deletions
53
src/main/groovy/wooga/gradle/build/unity/ios/tasks/PodInstallTask.groovy
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package wooga.gradle.build.unity.ios.tasks | ||
|
||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.file.FileCollection | ||
import org.gradle.api.tasks.* | ||
|
||
class PodInstallTask extends DefaultTask { | ||
private Object projectPath | ||
|
||
@Internal | ||
File getProjectPath() { | ||
project.files(projectPath).getSingleFile() | ||
} | ||
|
||
void setProjectPath(Object path) { | ||
projectPath = path | ||
} | ||
|
||
XCodeArchiveTask projectPath(Object path) { | ||
setProjectPath(path) | ||
} | ||
|
||
@InputFiles | ||
@SkipWhenEmpty | ||
protected FileCollection getInputFiles() { | ||
def podFile = project.file("Podfile") | ||
def inputFiles = [podFile] | ||
|
||
if(podFile.exists()) { | ||
inputFiles << project.file( "Podfile.lock") | ||
} | ||
|
||
project.files(inputFiles.findAll { it.exists() }.toArray()) | ||
} | ||
|
||
@OutputDirectory | ||
protected getPodsDir() { | ||
project.file("Pods") | ||
} | ||
|
||
@OutputDirectory | ||
File getWorkspace() { | ||
project.file(getProjectPath().path.replaceAll('xcodeproj', 'xcworkspace')) | ||
} | ||
|
||
@TaskAction | ||
protected void install() { | ||
project.exec { | ||
executable 'pod' | ||
args 'install' | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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