Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

Commit

Permalink
Add support for automatically mapping used framework for generated up… (
Browse files Browse the repository at this point in the history
#104)

* Add support for automatically mapping used framework for generated upm package directories
* Use the newer integration spec on this plugin already
* Fix the bug with paketInstall on windows in UPM mode
* Normalized paket package folder name
* Remove the unused assembly definition strategy
* Improve naming on task, new properties

---------

Co-authored-by: Joaquim Alvino de Mesquita Neto <[email protected]>
  • Loading branch information
Azurelol and Joaquimmnetto authored Mar 13, 2024
1 parent cc3fcb3 commit 8bbd60f
Show file tree
Hide file tree
Showing 33 changed files with 704 additions and 580 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ gradle-app.setting
# gradle/wrapper/gradle-wrapper.properties
userHome/

bin
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import spock.lang.Shared
import spock.lang.Unroll
import wooga.gradle.paket.base.PaketBasePlugin

abstract class PaketIntegrationBaseSpec extends IntegrationSpec {
abstract class BootstrapPaketIntegrationSpec extends PaketIntegrationSpec {

@Shared
def bootstrapTestCases
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package wooga.gradle.paket
import spock.lang.IgnoreIf
import spock.lang.Unroll

abstract class PaketIntegrationArgumentsSpec extends IntegrationSpec {
abstract class PaketIntegrationArgumentsSpec extends PaketIntegrationSpec {

abstract Class getTestPlugin()
abstract List<String> getTestTasks()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import wooga.gradle.paket.get.PaketGetPlugin
import wooga.gradle.paket.unity.internal.DefaultPaketUnityPluginExtension
import wooga.gradle.paket.unity.PaketUnityPlugin

abstract class PaketIntegrationDependencyFileSpec extends PaketIntegrationBaseSpec {
abstract class PaketIntegrationDependencyFileSpec extends BootstrapPaketIntegrationSpec {

@Unroll
def "skips paket call with [NO-SOURCE] when no [paket.dependencies] file is present when running #taskToRun"(String taskToRun) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,25 @@

package wooga.gradle.paket

import nebula.test.functional.ExecutionResult
import com.wooga.gradle.test.IntegrationSpec
import org.apache.commons.io.FileUtils
import org.apache.commons.lang3.StringEscapeUtils
import org.junit.Rule
import org.junit.contrib.java.lang.system.ProvideSystemProperty
import spock.lang.Shared
import wooga.gradle.paket.base.utils.internal.PaketDependencies
import wooga.gradle.paket.unity.internal.DefaultPaketUnityPluginExtension

class IntegrationSpec extends nebula.test.IntegrationSpec{
/**
* The base class for all tests in this test package
*/
class PaketIntegrationSpec extends IntegrationSpec {

@Rule
ProvideSystemProperty properties = new ProvideSystemProperty("ignoreDeprecations", "true")

@Shared
File cachedPaketDir

def escapedPath(String path) {
String osName = System.getProperty("os.name").toLowerCase()
if (osName.contains("windows")) {
return StringEscapeUtils.escapeJava(path)
}
path
}

def convertToWindowsPath(String path) {
new File(path).toString()
}
Expand Down Expand Up @@ -91,7 +87,26 @@ class IntegrationSpec extends nebula.test.IntegrationSpec{
}
}

Boolean outputContains(ExecutionResult result, String message) {
result.standardOutput.contains(message) || result.standardError.contains(message)
File generateDependenciesFile(PaketDependencies dependencies){
def file = createFile("paket.dependencies")
file << dependencies.toString()
file
}

File generateUnityProject(String name, boolean rooted) {
File unityProjDir = rooted ? projectDir : new File(projectDir, name)
new File(unityProjDir, "Assets").mkdirs()
new File(unityProjDir, "Packages").mkdirs()
def manifestJson = new File(unityProjDir, "Packages/manifest.json")
manifestJson.createNewFile()
unityProjDir
}

File generateReferencesFile(PaketDependencies dependencies, File baseDir = null) {
baseDir ?= projectDir
File file = new File(baseDir, DefaultPaketUnityPluginExtension.DEFAULT_PAKET_UNITY_REFERENCES_FILE_NAME)
file.createNewFile()
file << dependencies.getNugetDependencies().join(System.lineSeparator())
file
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ package wooga.gradle.paket.base
import org.gradle.language.base.plugins.LifecycleBasePlugin
import spock.lang.Shared
import spock.lang.Unroll
import wooga.gradle.paket.PaketIntegrationBaseSpec
import wooga.gradle.paket.BootstrapPaketIntegrationSpec
import wooga.gradle.paket.get.PaketGetPlugin

class PaketBaseIntegrationSpec extends PaketIntegrationBaseSpec {
class PaketBaseIntegrationSpec extends BootstrapPaketIntegrationSpec {

def setupSpec() {
System.setProperty("USE_DEPENDENCY_TEST", "NO")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
package wooga.gradle.paket.base.dependencies

import spock.lang.Unroll
import wooga.gradle.paket.IntegrationSpec
import wooga.gradle.paket.PaketIntegrationSpec
import wooga.gradle.paket.base.PaketBasePlugin
import wooga.gradle.paket.get.PaketGetPlugin

class PaketNugetDependenciesIntegrationSpec extends IntegrationSpec {
class PaketNugetDependenciesIntegrationSpec extends PaketIntegrationSpec {
def setup() {
buildFile << """
group = 'test'
Expand Down Expand Up @@ -234,8 +234,8 @@ class PaketNugetDependenciesIntegrationSpec extends IntegrationSpec {

then:
paketDependencies.exists()
paketDependencies.text.contains("source ${convertToWindowsPath('../path/to/source/one')}")
paketDependencies.text.contains("source ${convertToWindowsPath('../path/to/source/two')}")
paketDependencies.text.contains("source ${osPath('../path/to/source/one')}")
paketDependencies.text.contains("source ${osPath('../path/to/source/two')}")

where:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ package wooga.gradle.paket.get
import spock.lang.Ignore
import spock.lang.Shared
import spock.lang.Unroll
import wooga.gradle.paket.PaketIntegrationBaseSpec
import wooga.gradle.paket.BootstrapPaketIntegrationSpec

class PaketRestoreIntegrationSpec extends PaketIntegrationBaseSpec {
class PaketRestoreIntegrationSpec extends BootstrapPaketIntegrationSpec {

def setup() {
buildFile << """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package wooga.gradle.paket.publish

import groovy.json.StringEscapeUtils

import org.jfrog.artifactory.client.Artifactory
import org.jfrog.artifactory.client.ArtifactoryClientBuilder
import org.jfrog.artifactory.client.model.RepoPath
Expand All @@ -33,7 +33,7 @@ class PaketPublishIntegrationSpec extends PaketIntegrationDependencyFileSpec {
@Shared
def version = "1.0.0"

def uniquPackagePostfix() {
static def uniquePackagePostfix() {
String key = "TRAVIS_JOB_NUMBER"
def env = System.getenv()
if (env.containsKey(key)) {
Expand All @@ -43,7 +43,7 @@ class PaketPublishIntegrationSpec extends PaketIntegrationDependencyFileSpec {
}

@Shared
def packageID = "Wooga.Test" + uniquPackagePostfix()
def packageID = "Wooga.Test" + uniquePackagePostfix()

@Shared
def repoName = "integration"
Expand Down Expand Up @@ -71,7 +71,19 @@ class PaketPublishIntegrationSpec extends PaketIntegrationDependencyFileSpec {
}

def setupSpec() {
String artifactoryCredentials = System.getenv("artifactoryCredentials")
String username
String password

String artifactoryCredentials
def usr = System.getenv("ATLAS_READ_USR")
def pwd = System.getenv("ATLAS_READ_PSW")
if (usr && pwd) {
artifactoryCredentials = "${usr}:${pwd}"
}
else{
artifactoryCredentials = System.getenv("artifactoryCredentials")
}

assert artifactoryCredentials
def credentials = artifactoryCredentials.split(':')
artifactory = ArtifactoryClientBuilder.create()
Expand Down Expand Up @@ -223,7 +235,7 @@ class PaketPublishIntegrationSpec extends PaketIntegrationDependencyFileSpec {
and: "paket.dependencies and paket.lock file"
createFile("paket.lock")
createFile("paket.dependencies")
def escapedPath = escapedPath(localPath.absolutePath)
def escapedPath = osPath (localPath.absolutePath)

and: "a build.gradle file with a local publish entry"
buildFile.text = ""
Expand All @@ -238,7 +250,7 @@ class PaketPublishIntegrationSpec extends PaketIntegrationDependencyFileSpec {
repositories {
nuget {
name "$repoName"
path "$escapedPath"
path ${wrapValueBasedOnType(escapedPath, String)}
}
}
}
Expand All @@ -265,12 +277,4 @@ class PaketPublishIntegrationSpec extends PaketIntegrationDependencyFileSpec {
where:
taskToRun << ["publish-${packageIdToName(packageID)}", "publish${repoName.capitalize()}-${packageIdToName(packageID)}", "publish${repoName.capitalize()}", "publish"]
}

def escapedPath(String path) {
String osName = System.getProperty("os.name").toLowerCase()
if (osName.contains("windows")) {
return StringEscapeUtils.escapeJava(path)
}
path
}
}

This file was deleted.

Loading

0 comments on commit 8bbd60f

Please sign in to comment.