@react-native/gradle-plugin 0.75.0-rc.7 → 0.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native/gradle-plugin",
3
- "version": "0.75.0-rc.7",
3
+ "version": "0.75.0",
4
4
  "description": "Gradle Plugin for React Native",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -32,6 +32,7 @@
32
32
  "README.md",
33
33
  "react-native-gradle-plugin",
34
34
  "settings-plugin",
35
- "shared"
35
+ "shared",
36
+ "shared-testutil"
36
37
  ]
37
38
  }
@@ -0,0 +1,38 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
9
+ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
10
+
11
+ plugins { alias(libs.plugins.kotlin.jvm) }
12
+
13
+ repositories { mavenCentral() }
14
+
15
+ group = "com.facebook.react"
16
+
17
+ dependencies { implementation(libs.junit) }
18
+
19
+ java { targetCompatibility = JavaVersion.VERSION_11 }
20
+
21
+ kotlin { jvmToolchain(17) }
22
+
23
+ tasks.withType<KotlinCompile>().configureEach {
24
+ kotlinOptions {
25
+ apiVersion = "1.6"
26
+ jvmTarget = "11"
27
+ allWarningsAsErrors = true
28
+ }
29
+ }
30
+
31
+ tasks.withType<Test>().configureEach {
32
+ testLogging {
33
+ exceptionFormat = TestExceptionFormat.FULL
34
+ showExceptions = true
35
+ showCauses = true
36
+ showStackTraces = true
37
+ }
38
+ }
@@ -0,0 +1,52 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ package com.facebook.react.tests
9
+
10
+ import org.junit.rules.TestRule
11
+ import org.junit.runner.Description
12
+ import org.junit.runners.model.Statement
13
+
14
+ /**
15
+ * A JUnit [TestRule] to override values of [System.getProperties] with the support of the [WithOs]
16
+ * annotation.
17
+ */
18
+ class OsRule : TestRule {
19
+
20
+ private var retainOs: String? = null
21
+ private var retainArch: String? = null
22
+
23
+ override fun apply(statement: Statement, description: Description): Statement {
24
+ return object : Statement() {
25
+ override fun evaluate() {
26
+ val annotation = description.annotations.filterIsInstance<WithOs>().firstOrNull()
27
+
28
+ annotation?.os?.propertyName?.let {
29
+ retainOs = System.getProperty(OS_NAME_KEY)
30
+ System.setProperty(OS_NAME_KEY, it)
31
+ }
32
+ annotation?.arch?.let {
33
+ if (it.isNotBlank()) {
34
+ retainArch = System.getProperty(OS_ARCH_KEY)
35
+ System.setProperty(OS_ARCH_KEY, it)
36
+ }
37
+ }
38
+ try {
39
+ statement.evaluate()
40
+ } finally {
41
+ retainOs?.let { System.setProperty(OS_NAME_KEY, it) }
42
+ retainArch?.let { System.setProperty(OS_ARCH_KEY, it) }
43
+ }
44
+ }
45
+ }
46
+ }
47
+
48
+ companion object {
49
+ const val OS_NAME_KEY = "os.name"
50
+ const val OS_ARCH_KEY = "os.arch"
51
+ }
52
+ }
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ package com.facebook.react.tests
9
+
10
+ /** Annotation to specify an Operating System to override the "os.name" System Property. */
11
+ @Retention(AnnotationRetention.RUNTIME) annotation class WithOs(val os: OS, val arch: String = "")
12
+
13
+ enum class OS(val propertyName: String) {
14
+ WIN("Windows"),
15
+ MAC("MacOs"),
16
+ LINUX("Linux")
17
+ }