aboutsummaryrefslogtreecommitdiffstats
path: root/buildSrc/src/main/groovy/refinery-frontend-worktree.gradle
diff options
context:
space:
mode:
Diffstat (limited to 'buildSrc/src/main/groovy/refinery-frontend-worktree.gradle')
-rw-r--r--buildSrc/src/main/groovy/refinery-frontend-worktree.gradle95
1 files changed, 0 insertions, 95 deletions
diff --git a/buildSrc/src/main/groovy/refinery-frontend-worktree.gradle b/buildSrc/src/main/groovy/refinery-frontend-worktree.gradle
deleted file mode 100644
index 1d239fd5..00000000
--- a/buildSrc/src/main/groovy/refinery-frontend-worktree.gradle
+++ /dev/null
@@ -1,95 +0,0 @@
1plugins {
2 id 'refinery-frontend-conventions'
3}
4
5frontend {
6 yarnGlobalInstallScript = "install -g yarn@${project.ext['frontend.yarn1Version']}"
7 yarnInstallScript = "set version ${frontend.yarnVersion.get()} --only-if-needed"
8 if (project.hasProperty('ci')) {
9 installScript = 'install --immutable --inline-builds'
10 } else {
11 installScript = 'install'
12 }
13}
14
15ext.frontedPropertiesFile = "${frontend.nodeInstallDirectory.get()}/frontend.properties"
16
17String getFrontendProperty(String propertyName) {
18 FileInputStream inputStream = null
19 Properties props = new Properties()
20 try {
21 inputStream = new FileInputStream(frontedPropertiesFile)
22 props.load(inputStream)
23 } catch (IOException ignored) {
24 return null
25 } finally {
26 if (inputStream != null) {
27 inputStream.close()
28 }
29 }
30 return props.get(propertyName)
31}
32
33void putFrontedProperty(String propertyName, String propertyValue) {
34 FileInputStream inputStream = null
35 Properties props = new Properties()
36 try {
37 inputStream = new FileInputStream(frontedPropertiesFile)
38 props.load(inputStream)
39 } catch (FileNotFoundException ignored) {
40 // Use an empty Properties object instead
41 } finally {
42 if (inputStream != null) {
43 inputStream.close()
44 }
45 }
46 props.put(propertyName, propertyValue)
47 FileOutputStream outputStream = null
48 try {
49 outputStream = new FileOutputStream(frontedPropertiesFile)
50 props.store(outputStream, null)
51 } catch (IOException ignored) {
52 } finally {
53 if (outputStream != null) {
54 outputStream.close()
55 }
56 }
57}
58
59tasks.named('installNode') {
60 onlyIf {
61 getFrontendProperty('installedNodeVersion') != frontend.nodeVersion.get()
62 }
63 doLast {
64 putFrontedProperty('installedNodeVersion', frontend.nodeVersion.get())
65 }
66}
67
68tasks.named('installYarnGlobally') {
69 onlyIf {
70 getFrontendProperty('installedYarn1Version') != project.ext['frontend.yarn1Version']
71 }
72 doLast {
73 putFrontedProperty('installedYarn1Version', project.ext['frontend.yarn1Version'])
74 }
75 outputs.dir "${frontend.nodeInstallDirectory.get()}/lib/node_modules/yarn"
76}
77
78tasks.named('installYarn') {
79 outputs.file ".yarn/releases/yarn-${frontend.yarnVersion.get()}.cjs"
80}
81
82tasks.named('installFrontend') {
83 inputs.files('package.json', 'yarn.lock')
84 outputs.files('.pnp.cjs', '.pnp.loader.mjs')
85}
86
87tasks.register('clobberFrontend', Delete) {
88 delete frontend.nodeInstallDirectory.get()
89 delete '.yarn/cache'
90 delete '.yarn/install-state.gz'
91 delete '.yarn/sdks'
92 delete '.yarn/unplugged'
93 delete '.pnp.cjs'
94 delete '.pnp.loader.mjs'
95}