Skip to content

Commit 9f8c823

Browse files
OracleLabsAutomationelkorchi
authored andcommitted
[GR-57721] Backport to 24.1: Create Gradle plugin with similar features as our Maven plugin.
PullRequest: graalpython/3476
2 parents 9f301a4 + b5643f6 commit 9f8c823

File tree

35 files changed

+2587
-327
lines changed

35 files changed

+2587
-327
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ graalpython/com.oracle.graal.python.test/src/tests/patched_package/build/
8787
graalpython/com.oracle.graal.python.test/src/tests/patched_package/src/patched_package.egg-info
8888
graalpython/com.oracle.graal.python.test.integration/target
8989
graalpython/graalpy-maven-plugin/target
90+
graalpython/graalpy-gradle-plugin/target
9091
graalpython/graalpy-archetype-polyglot-app/target
91-
graalpython/graalpy-micronaut-embedding/target
9292
graalpython/com.oracle.graal.python.test/src/tests/standalone/micronaut/hello/target/
9393
graalpython/com.oracle.graal.python.test/src/tests/cpyext/build/
9494
pom-mx.xml
9595
.venv
96+
!graalpython/com.oracle.graal.python.test/src/tests/standalone/gradle/gradle-test-project/gradle/wrapper/gradle-wrapper.jar

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
This changelog summarizes major changes between GraalVM versions of the Python
44
language runtime. The main focus is on user-observable behavior of the engine.
55

6-
## Version 24.2.0
6+
## Version 24.1.1
77
* Updated developer metadata of Maven artifacts.
8+
* Added gradle plugin for polyglot embedding of Python packages into Java.
89

910
## Version 24.1.0
1011
* GraalPy is now considered stable for pure Python workloads. While many workloads involving native extension modules work, we continue to consider them experimental. You can use the command-line option `--python.WarnExperimentalFeatures` to enable warnings for such modules at runtime. In Java embeddings the warnings are enabled by default and you can suppress them by setting the context option 'python.WarnExperimentalFeatures' to 'false'.

ci.jsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "overlay": "48f1878b69beb17b05dabcbb6915e2a7b3b3131e" }
1+
{ "overlay": "f69f5dbda69ddf38828351e21ac61cdb04962068" }

graalpython/com.oracle.graal.python.test/src/graalpytest.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,16 @@ class TextTestResult :
854854
class TestSuite:
855855
pass
856856

857+
def removeAttr(cls, attr):
858+
if(cls is object):
859+
return
860+
if hasattr(cls, attr):
861+
try:
862+
delattr(cls, attr)
863+
except AttributeError as e:
864+
pass
865+
for b in cls.__bases__:
866+
removeAttr(b, attr)
857867

858868
def skip_deselected_test_functions(globals):
859869
"""
@@ -876,7 +886,7 @@ def skip_deselected_test_functions(globals):
876886
if idx % total != batch - 1:
877887
n = test_func.__name__
878888
if isinstance(owner, type):
879-
delattr(owner, n)
889+
removeAttr(owner, n)
880890
else:
881891
del owner[n]
882892

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
plugins {
2+
id "application"
3+
id 'org.graalvm.python' version '24.1.1'
4+
id "org.graalvm.buildtools.native" version "0.10.2"
5+
}
6+
7+
repositories {
8+
mavenCentral()
9+
}
10+
11+
application {
12+
mainClass = "org.example.GraalPy"
13+
}
14+
15+
dependencies {
16+
implementation("org.graalvm.python:python-community:24.1.1")
17+
}
18+
19+
run {
20+
enableAssertions = true
21+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
plugins {
2+
application
3+
id("org.graalvm.python") version "24.1.1"
4+
id("org.graalvm.buildtools.native") version "0.10.2"
5+
}
6+
7+
repositories {
8+
mavenCentral()
9+
}
10+
11+
application {
12+
// Define the main class for the application.
13+
mainClass = "org.example.GraalPy"
14+
}
15+
16+
val r = tasks.run.get()
17+
r.enableAssertions = true
18+
r.outputs.upToDateWhen {false}
19+
20+
dependencies {
21+
implementation("org.graalvm.python:python-community:24.1.1")
22+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pluginManagement {
2+
repositories {
3+
gradlePluginPortal()
4+
}
5+
}
6+
7+
rootProject.name = "graalpy-gradle-test-project"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pluginManagement {
2+
repositories {
3+
gradlePluginPortal()
4+
}
5+
}
6+
7+
rootProject.name = "graalpy-gradle-test-project"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https://services.gradle.org/distributions/gradle-8.9-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)