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

Improve paket-unity install filter for assembly definition files #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class PaketUnityIntegrationSpec extends IntegrationSpec {
result.wasExecuted(PaketUnityPlugin.UNWRAP_UPM_TASK_NAME)
}

@Unroll("Copy assembly definitions when includeAssemblyDefinitions is #includeAssemblyDefinitions and set in #configurationString")
@Unroll("#message assembly definitions when includeAssemblyDefinitions is #includeAssemblyDefinitions and set in #configurationString")
def "copy assembly definition files"() {

given: "apply paket get plugin to get paket install task"
Expand All @@ -221,8 +221,12 @@ class PaketUnityIntegrationSpec extends IntegrationSpec {

and: "setup assembly definition file in package"
def asmdefFileName = "${dependencyName}.${PaketUnityInstall.assemblyDefinitionFileExtension}"
def asmdefRefName = "${dependencyName}.${PaketUnityInstall.assemblyReferenceFileExtension}"

def inputAsmdefFile = createFile("packages/${dependencyName}/content/${asmdefFileName}")
def inputAsmRefFile = createFile("packages/${dependencyName}/content/${asmdefRefName}")
assert inputAsmdefFile.exists()
assert inputAsmRefFile.exists()

when:
def result = runTasksSuccessfully(PaketUnityPlugin.INSTALL_TASK_NAME)
Expand All @@ -232,9 +236,10 @@ class PaketUnityIntegrationSpec extends IntegrationSpec {

then:
result.wasExecuted(PaketUnityPlugin.INSTALL_TASK_NAME)
def outputAsmdefFilePath = "${packagesDir}/${asmdefFileName}"
def outputAsmdefFile = new File(outputAsmdefFilePath)
def outputAsmdefFile = new File("${packagesDir}/${asmdefFileName}")
def outputAsmRefFile = new File("${packagesDir}/${asmdefRefName}")
includeAssemblyDefinitions == outputAsmdefFile.exists()
includeAssemblyDefinitions == outputAsmRefFile.exists()

where:
baseConfigurationString | includeAssemblyDefinitions
Expand All @@ -247,6 +252,7 @@ class PaketUnityIntegrationSpec extends IntegrationSpec {
taskName = PaketUnityPlugin.INSTALL_TASK_NAME + unityProjectName
dependencyName = "Wooga.TestDependency"
configurationString = baseConfigurationString.replace("#taskName%%", "'${taskName}'")
message = includeAssemblyDefinitions ? "Skip copy" : "copy"
}

private void setupPaketProject(dependencyName, unityProjectName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class PaketUnityInstall extends ConventionTask {
AssemblyDefinitionFileStrategy assemblyDefinitionFileStrategy

public final static String assemblyDefinitionFileExtension = "asmdef"
public final static String assemblyReferenceFileExtension = "asmref"

/**
* @return the installation output directory
Expand Down Expand Up @@ -143,6 +144,9 @@ class PaketUnityInstall extends ConventionTask {

if (!getIncludeAssemblyDefinitions()) {
fileTree.exclude("**/*.${assemblyDefinitionFileExtension}")
fileTree.exclude("**/*.${assemblyDefinitionFileExtension}.meta")
fileTree.exclude("**/*.${assemblyReferenceFileExtension}")
fileTree.exclude("**/*.${assemblyReferenceFileExtension}.meta")
}

def files = fileTree.files
Expand Down