daml/templates/BUILD.bazel

76 lines
2.8 KiB
Python
Raw Normal View History

# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
exports_files(glob(["create-daml-app-test-resources/*"]))
genrule(
name = "templates-tarball",
srcs = glob([
2019-07-16 16:59:08 +03:00
"default-gitignore",
2019-09-11 22:09:53 +03:00
"default-dlint-yaml",
"skeleton/**",
Include create-daml-app as a template project for daml new (#5259) * Initial commit with create-daml-app master * Include create-daml-app in build rule * Make daml.yaml a template in version and project name * Remove git attributes * Remove license and azure config * Remove scripts * Don't overwrite config files in build rule * Template version numbers in package.json, to be replaced by the assistant * Rename to package.json.template changelog_begin changelog_end * Add copyright headers * Do template substitutions in all .template files And don't special case daml new create-daml-app (so it treats it as a regular template). * Add create-daml-app to integration tests * Remove WIP warning * Move towards setup that works on head * Make local copies of the TS libs in the templates tarball * Hardcode project name for now * Use isExtensionOf * Remove service worker * remove robots.txt (don't even know what it is) * Revert "Make local copies of the TS libs in the templates tarball" This reverts commit 1289581fb4a82af3ab534baf978a2c6ed895d538. * Retemplatize TS lib versions. For head builds these will be installed using npm * Remove daml/ledger from resolutions for daml-ts * Comment about test secret * Remove special create-daml-app assistant command and test that won't work anymore * Remove redundant imports and export * Remove old create-daml-app tests * Remove yarn.lock * Clean up integration test (just daml new and build atm) * Add daml/ledger as a resolution for daml-ts * Remove top level package.json * Update daml.js version * Use new import scheme for generated TS * Update readme with new codegen and build steps * Use start-navigator in daml.yaml * Increase a couple of timeouts in tests (either sandbox or TS lib is a bit slower?) * Update GSG intro with new build steps * Remove daml2ts -p flag and --start-navigator flag from GSG instructions * Don't use start-navigator flag in ui tests * Temporary readme describing how to manually test the create-daml-app template * Update code samples in app arch section of GSG * Update code samples in testing doc * Remove copied create-daml-app code * Indent docs markers to be more subtle * Update visible code in Messages (after) section This needs to be kept up to date properly somehow. * Update text to useLedger * Restore code/ui-before copies until the Bazel magic is figured out We need to make the template code a dependency in the Bazel rule as otherwise we can't find the files in the docs build. * Update create-daml-app/readme and make templates/readme more detailed * Use jsx comments for docs markers so they don't show up in the app
2020-04-02 03:30:07 +03:00
"create-daml-app/**",
"quickstart-java/**",
"quickstart-scala/**",
]) + [
"//docs:quickstart-java.tar.gz",
"//docs:daml-intro-templates",
"//docs:daml-patterns",
"//docs:copy-trigger-template",
"//docs:script-example-template",
"//language-support/scala/examples:quickstart-scala-dir",
],
outs = ["templates-tarball.tar.gz"],
cmd = """
SRC=templates
OUT=templates-tarball
2019-07-16 16:59:08 +03:00
# templates in templates dir
Include create-daml-app as a template project for daml new (#5259) * Initial commit with create-daml-app master * Include create-daml-app in build rule * Make daml.yaml a template in version and project name * Remove git attributes * Remove license and azure config * Remove scripts * Don't overwrite config files in build rule * Template version numbers in package.json, to be replaced by the assistant * Rename to package.json.template changelog_begin changelog_end * Add copyright headers * Do template substitutions in all .template files And don't special case daml new create-daml-app (so it treats it as a regular template). * Add create-daml-app to integration tests * Remove WIP warning * Move towards setup that works on head * Make local copies of the TS libs in the templates tarball * Hardcode project name for now * Use isExtensionOf * Remove service worker * remove robots.txt (don't even know what it is) * Revert "Make local copies of the TS libs in the templates tarball" This reverts commit 1289581fb4a82af3ab534baf978a2c6ed895d538. * Retemplatize TS lib versions. For head builds these will be installed using npm * Remove daml/ledger from resolutions for daml-ts * Comment about test secret * Remove special create-daml-app assistant command and test that won't work anymore * Remove redundant imports and export * Remove old create-daml-app tests * Remove yarn.lock * Clean up integration test (just daml new and build atm) * Add daml/ledger as a resolution for daml-ts * Remove top level package.json * Update daml.js version * Use new import scheme for generated TS * Update readme with new codegen and build steps * Use start-navigator in daml.yaml * Increase a couple of timeouts in tests (either sandbox or TS lib is a bit slower?) * Update GSG intro with new build steps * Remove daml2ts -p flag and --start-navigator flag from GSG instructions * Don't use start-navigator flag in ui tests * Temporary readme describing how to manually test the create-daml-app template * Update code samples in app arch section of GSG * Update code samples in testing doc * Remove copied create-daml-app code * Indent docs markers to be more subtle * Update visible code in Messages (after) section This needs to be kept up to date properly somehow. * Update text to useLedger * Restore code/ui-before copies until the Bazel magic is figured out We need to make the template code a dependency in the Bazel rule as otherwise we can't find the files in the docs build. * Update create-daml-app/readme and make templates/readme more detailed * Use jsx comments for docs markers so they don't show up in the app
2020-04-02 03:30:07 +03:00
for d in skeleton create-daml-app quickstart-scala quickstart-java; do
2019-07-16 16:59:08 +03:00
mkdir -p $$OUT/$$d
cp -rL $$SRC/$$d/* $$OUT/$$d/
Include create-daml-app as a template project for daml new (#5259) * Initial commit with create-daml-app master * Include create-daml-app in build rule * Make daml.yaml a template in version and project name * Remove git attributes * Remove license and azure config * Remove scripts * Don't overwrite config files in build rule * Template version numbers in package.json, to be replaced by the assistant * Rename to package.json.template changelog_begin changelog_end * Add copyright headers * Do template substitutions in all .template files And don't special case daml new create-daml-app (so it treats it as a regular template). * Add create-daml-app to integration tests * Remove WIP warning * Move towards setup that works on head * Make local copies of the TS libs in the templates tarball * Hardcode project name for now * Use isExtensionOf * Remove service worker * remove robots.txt (don't even know what it is) * Revert "Make local copies of the TS libs in the templates tarball" This reverts commit 1289581fb4a82af3ab534baf978a2c6ed895d538. * Retemplatize TS lib versions. For head builds these will be installed using npm * Remove daml/ledger from resolutions for daml-ts * Comment about test secret * Remove special create-daml-app assistant command and test that won't work anymore * Remove redundant imports and export * Remove old create-daml-app tests * Remove yarn.lock * Clean up integration test (just daml new and build atm) * Add daml/ledger as a resolution for daml-ts * Remove top level package.json * Update daml.js version * Use new import scheme for generated TS * Update readme with new codegen and build steps * Use start-navigator in daml.yaml * Increase a couple of timeouts in tests (either sandbox or TS lib is a bit slower?) * Update GSG intro with new build steps * Remove daml2ts -p flag and --start-navigator flag from GSG instructions * Don't use start-navigator flag in ui tests * Temporary readme describing how to manually test the create-daml-app template * Update code samples in app arch section of GSG * Update code samples in testing doc * Remove copied create-daml-app code * Indent docs markers to be more subtle * Update visible code in Messages (after) section This needs to be kept up to date properly somehow. * Update text to useLedger * Restore code/ui-before copies until the Bazel magic is figured out We need to make the template code a dependency in the Bazel rule as otherwise we can't find the files in the docs build. * Update create-daml-app/readme and make templates/readme more detailed * Use jsx comments for docs markers so they don't show up in the app
2020-04-02 03:30:07 +03:00
# use default .gitignore and .dlint.yaml if they don't exist in the template
cp -n $$SRC/default-gitignore $$OUT/$$d/.gitignore
cp -n $$SRC/default-dlint-yaml $$OUT/$$d/.dlint.yaml
# We avoid introducing infix syntax in the GSG so we disable
# the lint there.
if [ "$$d" = "create-daml-app" ]; then
cat >> $$OUT/$$d/.dlint.yaml <<EOF
# This rule is enabled by default but we avoid
# infix syntax here to keep things simple.
- ignore: {name: Use infix }
EOF
fi
2019-07-16 16:59:08 +03:00
done
2019-07-16 16:59:08 +03:00
## special cases we should work to remove
# quickstart-java template
2019-07-16 16:59:08 +03:00
# right now, uses the preexisting quickstart-java rule and replaces the
# da.yaml template with a daml.yaml template; in the future, move
# everything into //templates/quickstart-java and avoid untar, rm here
tar xf $(location //docs:quickstart-java.tar.gz) --strip-components=1 -C $$OUT/quickstart-java
# quickstart-scala template
cp -r $(location //language-support/scala/examples:quickstart-scala-dir)/* $$OUT/quickstart-scala/
# daml intro templates
tar xf $(location //docs:daml-intro-templates) -C $$OUT
mkdir -p $$OUT/copy-trigger
tar xf $(location //docs:copy-trigger-template) -C $$OUT/copy-trigger
mkdir -p $$OUT/script-example
tar xf $(location //docs:script-example-template) -C $$OUT/script-example
mkdir -p $$OUT/daml-patterns
tar xf $(location //docs:daml-patterns) --strip-components=1 -C $$OUT/daml-patterns
tar c templates-tarball \
--owner=0 --group=0 --numeric-owner --mtime=2000-01-01\ 00:00Z --sort=name \
| gzip -n >$(location :templates-tarball.tar.gz)
""",
visibility = ["//visibility:public"],
)