diff options
author | Allan Wang <me@allanwang.ca> | 2019-07-03 00:06:02 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-07-03 00:06:02 -0700 |
commit | 33274faf9bb68eb95cb3e2e095cd0cef84aa6fd7 (patch) | |
tree | 82ffc3467fae807d33abf5ff9f8c61dcb4f87134 | |
parent | 93d2d28af68c932e1bdd931fcb4a62943c45e14d (diff) | |
download | frost-33274faf9bb68eb95cb3e2e095cd0cef84aa6fd7.tar.gz frost-33274faf9bb68eb95cb3e2e095cd0cef84aa6fd7.tar.bz2 frost-33274faf9bb68eb95cb3e2e095cd0cef84aa6fd7.zip |
Remove custom extensions and use plugin as is
-rw-r--r-- | app/build.gradle | 22 | ||||
-rw-r--r-- | app/src/web/package-lock.json | 41 | ||||
-rw-r--r-- | app/src/web/package.json | 4 | ||||
-rw-r--r-- | buildSrc/build.gradle.kts | 1 | ||||
-rw-r--r-- | buildSrc/src/main/kotlin/FrostPlugin.kt | 37 | ||||
-rw-r--r-- | buildSrc/src/main/kotlin/WebGenInstallTask.kt | 69 |
6 files changed, 36 insertions, 138 deletions
diff --git a/app/build.gradle b/app/build.gradle index 0f5188b7..b286a754 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,7 +5,18 @@ apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' apply plugin: 'com.getkeepsafe.dexcount' apply plugin: 'com.gladed.androidgitversion' -apply plugin: FrostPlugin + + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath "com.moowork.gradle:gradle-node-plugin:${Versions.nodeGradle}" + } +} + +apply plugin: com.moowork.gradle.node.NodePlugin apply from: '../spotless.gradle' group = APP_GROUP @@ -168,6 +179,15 @@ android { } +node { + download = true + nodeModulesDir = file("${project.projectDir}/src/web") +} + +task frostWebGen(type: NpmTask) { + args = ['run', 'compile'] +} + repositories { google() jcenter() diff --git a/app/src/web/package-lock.json b/app/src/web/package-lock.json index 8c7e9b78..1c7a7931 100644 --- a/app/src/web/package-lock.json +++ b/app/src/web/package-lock.json @@ -429,8 +429,7 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true, - "optional": true + "bundled": true }, "aproba": { "version": "1.2.0", @@ -448,13 +447,11 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true, - "optional": true + "bundled": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -467,18 +464,15 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "concat-map": { "version": "0.0.1", - "bundled": true, - "optional": true + "bundled": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, - "optional": true + "bundled": true }, "core-util-is": { "version": "1.0.2", @@ -581,8 +575,7 @@ }, "inherits": { "version": "2.0.3", - "bundled": true, - "optional": true + "bundled": true }, "ini": { "version": "1.3.5", @@ -592,7 +585,6 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -605,20 +597,17 @@ "minimatch": { "version": "3.0.4", "bundled": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true, - "optional": true + "bundled": true }, "minipass": { "version": "2.3.5", "bundled": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -635,7 +624,6 @@ "mkdirp": { "version": "0.5.1", "bundled": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -708,8 +696,7 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true, - "optional": true + "bundled": true }, "object-assign": { "version": "4.1.1", @@ -719,7 +706,6 @@ "once": { "version": "1.4.0", "bundled": true, - "optional": true, "requires": { "wrappy": "1" } @@ -795,8 +781,7 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true, - "optional": true + "bundled": true }, "safer-buffer": { "version": "2.1.2", @@ -826,7 +811,6 @@ "string-width": { "version": "1.0.2", "bundled": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -844,7 +828,6 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -883,13 +866,11 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true, - "optional": true + "bundled": true }, "yallist": { "version": "3.0.3", - "bundled": true, - "optional": true + "bundled": true } } }, diff --git a/app/src/web/package.json b/app/src/web/package.json index fbdc2442..ef323afb 100644 --- a/app/src/web/package.json +++ b/app/src/web/package.json @@ -2,6 +2,10 @@ "scripts": { "compile": "tsc -p tsconfig.json && sass --no-source-map --style compressed --update scss:assets/css" }, + "license": "GPL-3.0", + "repository": { + "url": "https://github.com/AllanWang/Frost-for-Facebook" + }, "dependencies": { "typescript": "^3.3.1", "sass": "^1.19.0" diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index d9ff7951..3afa0486 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -33,5 +33,4 @@ gradlePlugin { dependencies { implementation("ca.allanwang.kau:gradle-plugin:$kau") - implementation("com.moowork.gradle:gradle-node-plugin:1.3.1") }
\ No newline at end of file diff --git a/buildSrc/src/main/kotlin/FrostPlugin.kt b/buildSrc/src/main/kotlin/FrostPlugin.kt deleted file mode 100644 index 7b5075f8..00000000 --- a/buildSrc/src/main/kotlin/FrostPlugin.kt +++ /dev/null @@ -1,37 +0,0 @@ -import com.moowork.gradle.node.NodeExtension -import com.moowork.gradle.node.NodePlugin -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.apply -import org.gradle.kotlin.dsl.create - -class FrostPlugin : Plugin<Project> { - - companion object { - private const val NODE_VERSION = "12.4.0" - } - - override fun apply(project: Project) { - println("Applying Frost Plugin") - project.plugins.withId("java-base") { - project.applyWebGenPlugin() - } - project.gradle.taskGraph.whenReady { - if (!project.plugins.hasPlugin("java-base")) { - throw IllegalArgumentException("Frost plugin can't be applied without Android or Java or Kotlin plugin.") - } - } - } - - private fun Project.applyWebGenPlugin() { - setupNode() - tasks.create(WebGenInstallTask.NAME, WebGenInstallTask::class) - } - - private fun Project.setupNode() { - plugins.apply(NodePlugin::class) - val nodeConfig = extensions.findByName("node") as NodeExtension - nodeConfig.download = true - nodeConfig.version = NODE_VERSION - } -}
\ No newline at end of file diff --git a/buildSrc/src/main/kotlin/WebGenInstallTask.kt b/buildSrc/src/main/kotlin/WebGenInstallTask.kt deleted file mode 100644 index a185a7f0..00000000 --- a/buildSrc/src/main/kotlin/WebGenInstallTask.kt +++ /dev/null @@ -1,69 +0,0 @@ -import com.moowork.gradle.node.npm.NpmTask -import org.gradle.api.DefaultTask -import org.gradle.api.logging.LogLevel -import org.gradle.api.tasks.CacheableTask -import org.gradle.api.tasks.OutputDirectory -import org.gradle.api.tasks.OutputFile -import org.gradle.api.tasks.TaskAction -import java.io.File - -/** - * Based on https://github.com/apollographql/apollo-android/blob/master/apollo-gradle-plugin/src/main/groovy/com/apollographql/apollo/gradle/ApolloCodegenInstallTask.groovy - */ -@CacheableTask -open class WebGenInstallTask : DefaultTask() { - - companion object { - const val TAG = "frost-web-gen" - const val NAME = "installWebGen" - val INSTALLATION_PATH = TAG + File.separator + "node_modules" - val PACKAGE_FILE_PATH = TAG + File.separator + "package.json" - - const val TYPESCRIPT_VERSION = "3.3.1" - const val SASS_VERSION = "1.19.0" - } - - @OutputDirectory - val installDir = project.layout.directoryProperty() - @OutputFile - val packageFile = project.layout.fileProperty() - - val npmTask = NpmTask() - - init { - group = "frost" - description = "Runs npm install for $TAG" - - installDir.set(project.file(File(project.buildDir, INSTALLATION_PATH))) - packageFile.set(project.file(File(project.buildDir, PACKAGE_FILE_PATH))) - npmTask.setWorkingDir(File(project.buildDir, TAG)) - } - - @TaskAction - fun exec() { - installDir.get().asFile.takeIf { it.isDirectory }?.deleteRecursively() - writePackageFile(packageFile.get().asFile) - npmTask.setArgs( - listOf( - "install", - "typescript@$TYPESCRIPT_VERSION", - "sass@$SASS_VERSION", - "--save", - "--save-exact" - ) - ) - npmTask.logging.captureStandardOutput(LogLevel.INFO) - npmTask.exec() - } - - private fun writePackageFile(packageFile: File) { - packageFile.writeText( - """ - { - "name": "$TAG", - "version": "1.0" - } - """.trimIndent() - ) - } -}
\ No newline at end of file |