-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration tests which cover the entire DSL at once (closes #968)
- Loading branch information
Showing
12 changed files
with
376 additions
and
3 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
product/gradle-plugin/src/test/integration/data/Dsl/common/app/constraints-certifi.txt
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 @@ | ||
certifi<=2023.9.9 |
1 change: 1 addition & 0 deletions
1
product/gradle-plugin/src/test/integration/data/Dsl/common/app/constraints-six.txt
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 @@ | ||
six<=1.15.5 |
5 changes: 5 additions & 0 deletions
5
product/gradle-plugin/src/test/integration/data/Dsl/common/app/src/main/python/sp_method.py
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,5 @@ | ||
from java import static_proxy | ||
|
||
|
||
class MethodProxy(static_proxy()): | ||
pass |
5 changes: 5 additions & 0 deletions
5
...uct/gradle-plugin/src/test/integration/data/Dsl/common/app/src/main/python/sp_property.py
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,5 @@ | ||
from java import static_proxy | ||
|
||
|
||
class PropertyProxy(static_proxy()): | ||
pass |
Empty file.
Empty file.
Empty file.
Empty file.
101 changes: 101 additions & 0 deletions
101
product/gradle-plugin/src/test/integration/data/Dsl/groovy_new/app/build.gradle
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,101 @@ | ||
plugins { | ||
id 'com.android.application' | ||
id 'com.chaquo.python' | ||
} | ||
|
||
android { | ||
namespace "com.chaquo.python.test" | ||
compileSdk 23 | ||
|
||
defaultConfig { | ||
applicationId "com.chaquo.python.test" | ||
minSdk 21 | ||
targetSdk 23 | ||
versionCode 1 | ||
versionName "0.0.1" | ||
ndk { | ||
abiFilters "x86" | ||
} | ||
} | ||
|
||
flavorDimensions "variant" | ||
productFlavors { | ||
property { dimension "variant" } | ||
method { dimension "variant" } | ||
bpProperty { dimension "variant" } | ||
bpMethod { dimension "variant" } | ||
} | ||
} | ||
|
||
// defaultConfig properties (all other sub-properties are covered by productFlavors) | ||
chaquopy.defaultConfig.extractPackages.add "ep_default_property" | ||
|
||
// defaultConfig methods | ||
chaquopy { | ||
defaultConfig { | ||
extractPackages("ep_default_method") | ||
} | ||
} | ||
|
||
// productFlavors properties | ||
def p = chaquopy.productFlavors.property | ||
p.version = "3.9" | ||
p.extractPackages.add "ep_property" | ||
p.staticProxy.add "sp_property" | ||
p.pip.install("certifi") | ||
p.pip.options("-c", "constraints-certifi.txt") | ||
p.pyc.src = true | ||
p.pyc.pip = false | ||
p.pyc.stdlib = false | ||
|
||
// productFlavors methods | ||
chaquopy { | ||
productFlavors { | ||
method { | ||
version "3.10" | ||
extractPackages("ep_method") | ||
staticProxy("sp_method") | ||
pip { | ||
install("six") | ||
options("-c", "constraints-six.txt") | ||
} | ||
pyc { | ||
src false | ||
pip true | ||
stdlib false | ||
} | ||
} | ||
|
||
// The easiest way to test buildPython is by causing a failure. | ||
bpProperty { | ||
buildPython = ["python-property"] | ||
pyc.src = true | ||
} | ||
bpMethod { | ||
buildPython("python-method") | ||
pyc.src true | ||
} | ||
|
||
try { | ||
getByName("nonexistent") | ||
throw new GradleException("getByName unexpectedly succeeded") | ||
} catch (UnknownDomainObjectException e) {} | ||
} | ||
} | ||
|
||
// sourceSets properties | ||
chaquopy.sourceSets.property.srcDir("src/ss_property") | ||
|
||
// sourceSets methods | ||
chaquopy { | ||
sourceSets { | ||
method { | ||
srcDir("src/ss_method") | ||
} | ||
|
||
try { | ||
getByName("nonexistent") | ||
throw new GradleException("getByName unexpectedly succeeded") | ||
} catch (UnknownDomainObjectException e) {} | ||
} | ||
} |
111 changes: 111 additions & 0 deletions
111
product/gradle-plugin/src/test/integration/data/Dsl/groovy_old/app/build.gradle
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,111 @@ | ||
plugins { | ||
id 'com.android.application' | ||
id 'com.chaquo.python' | ||
} | ||
|
||
android { | ||
namespace "com.chaquo.python.test" | ||
compileSdk 23 | ||
|
||
defaultConfig { | ||
applicationId "com.chaquo.python.test" | ||
minSdk 21 | ||
targetSdk 23 | ||
versionCode 1 | ||
versionName "0.0.1" | ||
ndk { | ||
abiFilters "x86" | ||
} | ||
} | ||
|
||
flavorDimensions "variant" | ||
productFlavors { | ||
property { dimension "variant" } | ||
method { dimension "variant" } | ||
bpProperty { dimension "variant" } | ||
bpMethod { dimension "variant" } | ||
} | ||
} | ||
|
||
// defaultConfig properties (all other sub-properties are covered by productFlavors) | ||
android.defaultConfig.python.extractPackages.add "ep_default_property" | ||
|
||
// defaultConfig methods | ||
android { | ||
defaultConfig { | ||
python { | ||
extractPackages("ep_default_method") | ||
} | ||
} | ||
} | ||
|
||
// productFlavors properties | ||
def p = android.productFlavors.property.python | ||
p.version = "3.9" | ||
p.extractPackages.add "ep_property" | ||
p.staticProxy.add "sp_property" | ||
p.pip.install("certifi") | ||
p.pip.options("-c", "constraints-certifi.txt") | ||
p.pyc.src = true | ||
p.pyc.pip = false | ||
p.pyc.stdlib = false | ||
|
||
// productFlavors methods | ||
android { | ||
productFlavors { | ||
method { | ||
python { | ||
version "3.10" | ||
extractPackages("ep_method") | ||
staticProxy("sp_method") | ||
pip { | ||
install("six") | ||
options("-c", "constraints-six.txt") | ||
} | ||
pyc { | ||
src false | ||
pip true | ||
stdlib false | ||
} | ||
} | ||
} | ||
|
||
// The easiest way to test buildPython is by causing a failure. | ||
bpProperty { | ||
python { | ||
buildPython = ["python-property"] | ||
pyc.src = true | ||
} | ||
} | ||
bpMethod { | ||
python { | ||
buildPython("python-method") | ||
pyc.src true | ||
} | ||
} | ||
|
||
try { | ||
getByName("nonexistent") | ||
throw new GradleException("getByName unexpectedly succeeded") | ||
} catch (UnknownDomainObjectException e) {} | ||
} | ||
} | ||
|
||
// sourceSets properties | ||
android.sourceSets.property.python.srcDir("src/ss_property") | ||
|
||
// sourceSets methods | ||
android { | ||
sourceSets { | ||
method { | ||
python { | ||
srcDir("src/ss_method") | ||
} | ||
} | ||
|
||
try { | ||
getByName("nonexistent") | ||
throw new GradleException("getByName unexpectedly succeeded") | ||
} catch (UnknownDomainObjectException e) {} | ||
} | ||
} |
101 changes: 101 additions & 0 deletions
101
product/gradle-plugin/src/test/integration/data/Dsl/kotlin/app/build.gradle.kts
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,101 @@ | ||
plugins { | ||
id("com.android.application") | ||
id("com.chaquo.python") | ||
} | ||
|
||
android { | ||
namespace = "com.chaquo.python.test" | ||
compileSdk = 23 | ||
|
||
defaultConfig { | ||
applicationId = "com.chaquo.python.test" | ||
minSdk = 21 | ||
targetSdk = 23 | ||
versionCode = 1 | ||
versionName = "0.0.1" | ||
ndk { | ||
abiFilters += "x86" | ||
} | ||
} | ||
|
||
flavorDimensions += "variant" | ||
productFlavors { | ||
create("property") { dimension = "variant" } | ||
create("method") { dimension = "variant" } | ||
create("bpProperty") { dimension = "variant" } | ||
create("bpMethod") { dimension = "variant" } | ||
} | ||
} | ||
|
||
// defaultConfig properties (all other sub-properties are covered by productFlavors) | ||
chaquopy.defaultConfig.extractPackages += "ep_default_property" | ||
|
||
// defaultConfig methods | ||
chaquopy { | ||
defaultConfig { | ||
extractPackages("ep_default_method") | ||
} | ||
} | ||
|
||
// productFlavors properties | ||
val p = chaquopy.productFlavors.getByName("property") | ||
p.version = "3.9" | ||
p.extractPackages += "ep_property" | ||
p.staticProxy += "sp_property" | ||
p.pip.install("certifi") | ||
p.pip.options("-c", "constraints-certifi.txt") | ||
p.pyc.src = true | ||
p.pyc.pip = false | ||
p.pyc.stdlib = false | ||
|
||
// productFlavors methods | ||
chaquopy { | ||
productFlavors { | ||
getByName("method") { | ||
version = "3.10" | ||
extractPackages("ep_method") | ||
staticProxy("sp_method") | ||
pip { | ||
install("six") | ||
options("-c", "constraints-six.txt") | ||
} | ||
pyc { | ||
src = false | ||
pip = true | ||
stdlib = false | ||
} | ||
} | ||
|
||
// The easiest way to test buildPython is by causing a failure. | ||
getByName("bpProperty") { | ||
buildPython = listOf("python-property") | ||
pyc.src = true | ||
} | ||
getByName("bpMethod") { | ||
buildPython("python-method") | ||
pyc.src = true | ||
} | ||
|
||
try { | ||
getByName("nonexistent") | ||
throw GradleException("getByName unexpectedly succeeded") | ||
} catch (e: UnknownDomainObjectException) {} | ||
} | ||
} | ||
|
||
// sourceSets properties | ||
chaquopy.sourceSets.getByName("property").srcDir("src/ss_property") | ||
|
||
// sourceSets methods | ||
chaquopy { | ||
sourceSets { | ||
getByName("method") { | ||
srcDir("src/ss_method") | ||
} | ||
|
||
try { | ||
getByName("nonexistent") | ||
throw GradleException("getByName unexpectedly succeeded") | ||
} catch (e: UnknownDomainObjectException) {} | ||
} | ||
} |
Oops, something went wrong.